Petit Computer Wiki
Advertisement

V1[]

BTRIG is not a function in SmileBasic V1.

V2[]

BTRIG is a system function that takes no parameters and indicates what buttons have been recently pressed. It functions the same as Button(1), and is just a convenient alias.

The value returned by BTRIG() is recalculated at the beginning of every "frame", that is, every 1/60th of a second (and for the duration of the frame, it does not change). If, during the previous frame, a button had changed from being up to being down, a bit is set in the value of BTRIG(), otherwise (if the button had been down all during the previous frame, or if it had remained up, or if it had changed from being down to being up) the bit is clear.

BTRIG() is usually used in conjunction with VSYNC; e.g., without VSYNC 1 between successive calls to BTRIG(), both calls may occur in the same frame, both indicating that a button has been recently pressed, and the program may behave as if the button had been pressed twice when it had actually only been pressed once.

The bit masks are the same as for BUTTON():

maskbutton
1D-pad up
2D-pad down
4D-pad left
8D-pad right
16A
32B
64X
128Y
256L
512R
1024START
2048SELECT

Since SELECT stops any running program when it is pressed, using SELECT is not useful with BTRIG().

V3[]

BTRIG has been replaced by BUTTON(2) .

Advertisement