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
triggerhelp [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
 
Easy Example 1

Lots of people are getting confused by all the $0 $1 $2 … in new BS2 function.

I'll try to explain this so it is easy to understand.

First, let's check this simple piece of code:

REMOVETRIGGER MyFunction
ON MyFunction SET rcvdParam0 $0
ON MyFunction SET rcvdParam1 $1
ON MyFunction SET rcvdParam2 $2
ON MyFunction SET rcvdParam3 $3
ON MyFunction SET ResultOfMyFunction ((($0 + $1) - $2) + $3)

Ok so this function, receive 4 parameters. Each $ is a parameters.<br> The SET rcvdParam part is only for easier understanding. So lets call the function like this:

EXEC MyFunctions 10 20 30 40

So when the function is executed * rcvdParam0=10 ($0) * rcvdParam1=20 ($1) * rcvdParam2=30 ($2) * rcvdParam3=40 ($3)

Then the last line is what the function do so lets make the calcul: * (((10 + 20) - 30) + 40) = 40 So after the function was executed with the given parameters, “ResulOfMyFunction” will contain the value 40.

Easy Example 2

This is a function from my cannonball mod, what it do is set a variable to 1, then set a timer to reset it to 0.

REMOVETRIGGER FREEZESHOT
ON FREEZESHOT SET SHOOTINGisFREEZED 1
ON FREEZESHOT TIMER $0 FRAMES UNFREEZESHOT
REMOVETRIGGER UNFREEZESHOT
ON UNFREEZESHOT SET SHOOTINGisFREEZED 0

This function is very simple, it only receive 1 parameter and it correspond to the number of frames you want to set the timer to.<br> So lets say i call the function like this:

EXEC FREEZESHOT 30

* First it set SHOOTINGisFREEZED to 1 * Then it set a timer to $0 Frames, $0 being the first parameter (and only) so $0=30. * So it set a timer at 30 Frames to execute UNFREEZESHOT. * 30 frames after, UNFREEZESHOT is executed, and SHOOTINGisFREEZED is set to 0. dissertation advice

 

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
triggerhelp.txt · Last modified: 2011/11/25 13:05 by chruse_arroyo
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki