BTRIG is not a function in SmileBasic V1.
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
BTRIG has been replaced by BUTTON(2) .