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
triggers [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
 

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

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

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

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

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

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

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

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

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

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/pageutils.php on line 380

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/parser/metadata.php on line 289

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

Deprecated: Function split() is deprecated in /var/www/siebn.de/wiki/inc/pageutils.php on line 380

Creating Triggers

Normal Style

Triggers are created automatically when you add an Action to a Trigger.
For example you can create a Trigger that draws a filled circle using this code:

ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 100 100 10

You can execute this code using the EXEC command:

EXEC MyTrigger

If you want to add another Action to a Trigger simply add this line:

ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 200 200 10

If you execute this Trigger again you it will draw two filled circles.

If you save a MyTrigger in a .bs2 file and include this file several times you can get a problem. If the file is included two times every action is added to the triggers two times. So you should use REMOVETRIGGER before defining a Trigger. The file should look like this: MyTrigger.bs2

REMOVETRIGGER MyTrigger
ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 100 100 10
ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 200 200 10

Now you can include this file many times.

{ } Style

You can also create Triggers by using { }. To create MyTrigger you can write:

TRIGGER MyTrigger {
  DRAW ELEMENT:Earth FILLEDCIRCLE 100 100 10
  DRAW ELEMENT:Earth FILLEDCIRCLE 200 200 10
}

BS2 automatically translates this to:

REMOVETRIGGER MyTrigger
ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 100 100 10
ON MyTrigger DRAW ELEMENT:Earth FILLEDCIRCLE 200 200 10

The closing } must always have a own line.

This style can not be nested! “ON triggerabc TRIGGER { … }” will be the same as “TRIGGER { … }”.
Do NOT use this style if you send commands to BS2 over network!

Predefined Triggers

DRAW

This Trigger is Called when the Cursor is over the Sandbox and a mousebutton is pressed.
If DRAWSOLID is 1 then DRAW doesn't skip Pixels on fast mousemovements. If DRAWSOLID is 0 it can skip pixels.

DRAG

This is the same as DRAW with DRAWSOLID = 0.

DRAWSOLID

A mousebutton was released over the Sandbox.

QUIT

The X Icon on the BS2 windows or ALT+F4 was pressed.

STATUS

The statusinformation wants to be updated.

WINDOWRESIZED

The BS2 window was resized.

PHYSICS

This is the order BS2 executes Triggers:

WHILE (EXIT == 0) {
  EXEC PREPHYSICS
  IF (PHYSICS) calculating physics
  EXEC POSTPHYSICS
  EXEC PRETIMER
  running timers
  EXEC POSTTIMER
  EXEC PREUPDATESCREEN
  SET PREVIEW 1
  EXEC DRAW 
  SET PREVIEW 0
  updating screen
  EXEC POSTUPDATESCREEN
  running keys
  running mousegestures
}

KEYS

KEY_a is called when the “a” key was pressed.
KEYUP_a is called when the “a” key was released.
KEYREPEAT_a is called every few milliseconds while you hold “a”.
HOLDKEY_a is called every frame you hold “a”. This also works if your press several keys.

List of available keys:

  • KEY_a
  • KEY_b
  • KEY_c
  • KEY_d
  • KEY_e
  • KEY_f
  • KEY_g
  • KEY_h
  • KEY_i
  • KEY_j
  • KEY_k
  • KEY_l
  • KEY_m
  • KEY_n
  • KEY_o
  • KEY_p
  • KEY_q
  • KEY_r
  • KEY_s
  • KEY_t
  • KEY_u
  • KEY_v
  • KEY_w
  • KEY_x
  • KEY_y
  • KEY_z
  • KEY_1
  • KEY_2
  • KEY_3
  • KEY_4
  • KEY_5
  • KEY_6
  • KEY_7
  • KEY_8
  • KEY_9
  • KEY_0
  • KEY_F1
  • KEY_F2
  • KEY_F3
  • KEY_F4
  • KEY_F5
  • KEY_F6
  • KEY_F7
  • KEY_F8
  • KEY_F9
  • KEY_F10
  • KEY_F11
  • KEY_F12
  • KEY_BACKSPACE
  • KEY_TAB
  • KEY_SHIFT
  • KEY_ALT
  • KEY_CTRL
  • KEY_SPACE
  • KEY_ALTGR
  • KEY_MENU
  • KEY_UP
  • KEY_DOWN
  • KEY_RIGHT
  • KEY_LEFT
  • KEY_PAGEUP
  • KEY_PAGEDOWN
  • KEY_RETURN
  • KEY_DEL
  • KEY_INSERT
  • KEY_HOME
  • KEY_END
  • KEY_PAUSE
  • KEY_[
  • KEY_]
  • KEY_;
  • KEY_=
  • KEY_`
  • KEY_'
  • KEY_/
  • KEY_,
  • KEY_.
  • KEY_-
  • KEY_ESC
  • KEY_^

MOUSE

  • MOUSEWHEELUP: Guess what.
  • MOUSEWHEELDOWN: You have to figure out yourself.
  • MOUSEDOWN: Mousbutton was pressed.
  • MOUSEUP: Mousbutton was released.
  • MOUSEMOVE: Mouse has moved.
  • DRAG: Mouse has moved.
  • DRAW: Same as Mouse but can be used for solid lines.

Have a look at these variables: Draw Variables

dissertation help

 

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
triggers.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