Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 205

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 208

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 389

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/siebn.de/wiki/inc/parserutils.php on line 530

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/auth.php on line 154
bs2_codinghelp_artofmodding [Burning Sand Wiki]
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /var/www/siebn.de/wiki/inc/template.php on line 242
 

Help Main Menu

Here is some basic stuff you should put in a new mod.

Clearing the elements

You should always use this at the start of your mod:

GROUP CLEARALL
ELEMENTSCLEAR

This clear all groups & all elements.

Then if you want to have the default element appear, just add this after:

INCLUDE elements.bs2

Making new group appear

Creating a new group will not make him appear at startup, you will have to click on a group or an element to refresh the listing.

EXEC listgroups

Automaticly select an element at startup

If you create an element and want to start with it as the default element (instead of sand).<br> First you set ELEMENT1 to the element you want, then you refresh that group listing. Like this ('MyElement' is in the 'New' group):

SET ELEMENT1:MyElement
EXEC listelements GROUP:New

Debugging

Sometime you may want to see what is the value of a variable in real-time. You can setup a small function that will display any var you give to the status panel.

REMOVETRIGGER debugmenu
ON debugmenu STATUS CLEAR
ON debugmenu STATUS ADDTEXT "FPS: "
ON debugmenu STATUS ADDNUMBER FPS
ON debugmenu STATUS ADDTEXT "MyVar Value="
ON debugmenu STATUS ADDNUMBER MyVar
ON debugmenu TIMER 1 FRAMES debugmenu

So you can just replace MyVar by any variable you want, or add other line to see more than one variable at time.<br> To use it you just have to execute it once in your code, like at the end:

EXEC debugmenu

Modding structure

Here is some structure you should use to make your code easier to read.

Trigger

First thing when you create a new trigger is to clear every past reference to it, you should always make a trigger like this:

REMOVETRIGGER TriggerName
ON TriggerName Command

Also make your trigger in one bloc, dont make your trigger spread all over your code, keep it together.

New Method

Sieben implemented a new and easy way of creating trigger just use this syntax:

TRIGGER MyTrigger {
  EXEC TriggerAction1
  EXEC TriggerAction2
  ...
}

Variable

I highly recommend giving all your variables name some sense. It will be easier to retrieve it after or to know what was it for. Pay attention to CAPITAL letter, since BS2 is case sensitive you can easily look all night for your error to discover you forgot to put a capital letter in you variable name.

 

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /var/www/siebn.de/wiki/inc/template.php on line 785
bs2_codinghelp_artofmodding.txt · Last modified: 2008/08/08 14:19 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki