![]() |
dsekai
World engine for retrocomputers.
|
Overview of the mobile scripting language. More...
Macros | |
#define | SCRIPT_CB_TABLE_24(f) f( 23, SHAKE, 'y' ) |
#define | SCRIPT_CB_TABLE_23(f) f( 23, DISABLE, 'd' ) SCRIPT_CB_TABLE_24( f ) |
DISABLE: Disable Scripting Interactions with the MOBILE running this script, while still executing script instructions. | |
#define | SCRIPT_CB_TABLE_22(f) f( 22, WARP, 'w' ) SCRIPT_CB_TABLE_23( f ) |
WARP: Warp to a tilemap identified by the string at the arg index in current TILEMAP::strpool. | |
#define | SCRIPT_CB_TABLE_21(f) f( 21, ANIM, 'n' ) SCRIPT_CB_TABLE_22( f ) |
#define | SCRIPT_CB_TABLE_20(f) f( 20, PUSH, 'v' ) SCRIPT_CB_TABLE_21( f ) |
#define | SCRIPT_CB_TABLE_19(f) f( 19, POP, '^' ) SCRIPT_CB_TABLE_20( f ) |
#define | SCRIPT_CB_TABLE_18(f) f( 18, EQJMP, '=' ) SCRIPT_CB_TABLE_19( f ) |
EQJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is EQUAL TO the value pushed before it. | |
#define | SCRIPT_CB_TABLE_17(f) f( 17, GTJMP, '>' ) SCRIPT_CB_TABLE_18( f ) |
GTJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is GREATER THAN the value pushed before it. | |
#define | SCRIPT_CB_TABLE_16(f) f( 16, LTJMP, '<' ) SCRIPT_CB_TABLE_17( f ) |
LTJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is LESS THAN the value pushed before it. | |
#define | SCRIPT_CB_TABLE_15(f) f( 15, ADD, '+' ) SCRIPT_CB_TABLE_16( f ) |
ADD: Add the argument to the last value pushed to the stack, and push the result back onto the stack. | |
#define | SCRIPT_CB_TABLE_14(f) f( 14, SUB, '-' ) SCRIPT_CB_TABLE_15( f ) |
SUB: Subtract the argument from the last value pushed to the stack, and push the result back onto the stack. | |
#define | SCRIPT_CB_TABLE_13(f) f( 13, GIVE, 'h' ) SCRIPT_CB_TABLE_14( f ) |
GIVE: Give an ITEM to DSEKAI_STATE::player based on ITEM::gid from TILEMAP::item_defs. | |
#define | SCRIPT_CB_TABLE_12(f) f( 12, TAKE, 'k' ) SCRIPT_CB_TABLE_13( f ) |
TAKE: Give an ITEM to DSEKAI_STATE::player based on ITEM::gid from TILEMAP::item_defs. | |
#define | SCRIPT_CB_TABLE_11(f) f( 11, DIE, 'z' ) SCRIPT_CB_TABLE_12( f ) |
DIE: Trigger death animation for MOBILE running this script and then vanish, becoming inactive. | |
#define | SCRIPT_CB_TABLE_10(f) f( 10, GGET, 'a' ) SCRIPT_CB_TABLE_11( f ) |
GGET: Push a copy of a value from the global table at onto MOBILE::script_stack. | |
#define | SCRIPT_CB_TABLE_9(f) f( 9, GSET, 'b' ) SCRIPT_CB_TABLE_10( f ) |
GSET: Pop a value from MOBILE::script_stack into the global table, overriding any previous value at that index. | |
#define | SCRIPT_CB_TABLE_8(f) f( 8, FACE, 'f' ) SCRIPT_CB_TABLE_9( f ) |
FACE: Set the actor to face one of the Cardinal Directions. | |
#define | SCRIPT_CB_TABLE_7(f) f( 7, RETURN, 'x' ) SCRIPT_CB_TABLE_8( f ) |
RETURN: Return from an interaction subroutine to the main script. | |
#define | SCRIPT_CB_TABLE_6(f) f( 6, SPEAK, 'p' ) SCRIPT_CB_TABLE_7( f ) |
SPEAK: Display a dialog window with the actor's MOBILE::sprite_id and a line of text from TILEMAP::strpool. | |
#define | SCRIPT_CB_TABLE_5(f) f( 5, GOTO, 'g' ) SCRIPT_CB_TABLE_6( f ) |
GOTO: Move script execution to a label defined by START. | |
#define | SCRIPT_CB_TABLE_4(f) f( 4, START, 't' ) SCRIPT_CB_TABLE_5( f ) |
START: Define a label index that can be jumped to. | |
#define | SCRIPT_CB_TABLE_3(f) f( 3, SLEEP, 's' ) SCRIPT_CB_TABLE_4( f ) |
SLEEP: Don't do anything for arg number of frames. | |
#define | SCRIPT_CB_TABLE_2(f) f( 2, WALK, 'u' ) SCRIPT_CB_TABLE_3( f ) |
WALK: The actor walks in the direction specified on the stack. | |
#define | SCRIPT_CB_TABLE_1(f) f( 1, INTERACT,'i' ) SCRIPT_CB_TABLE_2( f ) |
INTERACT: Define a Scripting Interactions callback label. | |
#define | SCRIPT_CB_TABLE(f) f( 0, NOOP, '\0' ) SCRIPT_CB_TABLE_1( f ) |
NOOP: Not a valid instruction. Beginning of the script callback table, used to implement script parsing. | |
Overview of the mobile scripting language.
All statements take a single numerical argument.
Args can range from 0 to SCRIPT_ARG_MAX. See scripting_args for more information on special arguments.
A script executed by a MOBILE also has access to MOBILE::script_stack, which can hold up to SCRIPT_STACK_DEPTH items.
Items on MOBILE::script_stack can range from 0 to SCRIPT_STACK_MAX in value.
#define SCRIPT_CB_TABLE_1 | ( | f | ) | f( 1, INTERACT,'i' ) SCRIPT_CB_TABLE_2( f ) |
INTERACT: Define a Scripting Interactions callback label.
Arguments
This statement does nothing by itself, but it defines a point in the code that will be jumped to when a player interacts with the MOBILE running this SCRIPT.
Please see the section on Scripting Interactions for details on this instruction.
#define SCRIPT_CB_TABLE_10 | ( | f | ) | f( 10, GGET, 'a' ) SCRIPT_CB_TABLE_11( f ) |
GGET: Push a copy of a value from the global table at onto MOBILE::script_stack.
Arguments
Stack Values Pushed
#define SCRIPT_CB_TABLE_11 | ( | f | ) | f( 11, DIE, 'z' ) SCRIPT_CB_TABLE_12( f ) |
DIE: Trigger death animation for MOBILE running this script and then vanish, becoming inactive.
See Mobile MP/HP for more information on mobile death.
#define SCRIPT_CB_TABLE_12 | ( | f | ) | f( 12, TAKE, 'k' ) SCRIPT_CB_TABLE_13( f ) |
TAKE: Give an ITEM to DSEKAI_STATE::player based on ITEM::gid from TILEMAP::item_defs.
Arguments
#define SCRIPT_CB_TABLE_13 | ( | f | ) | f( 13, GIVE, 'h' ) SCRIPT_CB_TABLE_14( f ) |
GIVE: Give an ITEM to DSEKAI_STATE::player based on ITEM::gid from TILEMAP::item_defs.
Arguments
#define SCRIPT_CB_TABLE_14 | ( | f | ) | f( 14, SUB, '-' ) SCRIPT_CB_TABLE_15( f ) |
SUB: Subtract the argument from the last value pushed to the stack, and push the result back onto the stack.
Arguments
Stack Values Popped
Stack Values Pushed
#define SCRIPT_CB_TABLE_15 | ( | f | ) | f( 15, ADD, '+' ) SCRIPT_CB_TABLE_16( f ) |
ADD: Add the argument to the last value pushed to the stack, and push the result back onto the stack.
Arguments
Stack Values Popped
Stack Values Pushed
#define SCRIPT_CB_TABLE_16 | ( | f | ) | f( 16, LTJMP, '<' ) SCRIPT_CB_TABLE_17( f ) |
LTJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is LESS THAN the value pushed before it.
Arguments
Stack Values Pushed
#define SCRIPT_CB_TABLE_17 | ( | f | ) | f( 17, GTJMP, '>' ) SCRIPT_CB_TABLE_18( f ) |
GTJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is GREATER THAN the value pushed before it.
Arguments
Stack Values Pushed
#define SCRIPT_CB_TABLE_18 | ( | f | ) | f( 18, EQJMP, '=' ) SCRIPT_CB_TABLE_19( f ) |
EQJMP: Move script execution to a label defined by START if the last value pushed to MOBILE::script_stack is EQUAL TO the value pushed before it.
Arguments
Stack Values Pushed
#define SCRIPT_CB_TABLE_2 | ( | f | ) | f( 2, WALK, 'u' ) SCRIPT_CB_TABLE_3( f ) |
WALK: The actor walks in the direction specified on the stack.
Arguments
Stack Values Popped
#define SCRIPT_CB_TABLE_22 | ( | f | ) | f( 22, WARP, 'w' ) SCRIPT_CB_TABLE_23( f ) |
WARP: Warp to a tilemap identified by the string at the arg index in current TILEMAP::strpool.
Arguments
#define SCRIPT_CB_TABLE_23 | ( | f | ) | f( 23, DISABLE, 'd' ) SCRIPT_CB_TABLE_24( f ) |
DISABLE: Disable Scripting Interactions with the MOBILE running this script, while still executing script instructions.
Arguments
#define SCRIPT_CB_TABLE_3 | ( | f | ) | f( 3, SLEEP, 's' ) SCRIPT_CB_TABLE_4( f ) |
SLEEP: Don't do anything for arg number of frames.
Arguments
#define SCRIPT_CB_TABLE_4 | ( | f | ) | f( 4, START, 't' ) SCRIPT_CB_TABLE_5( f ) |
START: Define a label index that can be jumped to.
Arguments
Labelled indexes defined with START may be jumped to later by GOTO or JMP instructions.
#define SCRIPT_CB_TABLE_5 | ( | f | ) | f( 5, GOTO, 'g' ) SCRIPT_CB_TABLE_6( f ) |
GOTO: Move script execution to a label defined by START.
Arguments
Stack Values Pushed
#define SCRIPT_CB_TABLE_6 | ( | f | ) | f( 6, SPEAK, 'p' ) SCRIPT_CB_TABLE_7( f ) |
SPEAK: Display a dialog window with the actor's MOBILE::sprite_id and a line of text from TILEMAP::strpool.
Arguments
#define SCRIPT_CB_TABLE_7 | ( | f | ) | f( 7, RETURN, 'x' ) SCRIPT_CB_TABLE_8( f ) |
RETURN: Return from an interaction subroutine to the main script.
Arguments
It is common to use this with SCRIPT_ARG_STACK_I, which uses the instruction number automatically pushed to the stack on interaction, and then increments the interaction count. This is not necessary, however, and more creative uses may be devised.
#define SCRIPT_CB_TABLE_8 | ( | f | ) | f( 8, FACE, 'f' ) SCRIPT_CB_TABLE_9( f ) |
FACE: Set the actor to face one of the Cardinal Directions.
Arguments
#define SCRIPT_CB_TABLE_9 | ( | f | ) | f( 9, GSET, 'b' ) SCRIPT_CB_TABLE_10( f ) |
GSET: Pop a value from MOBILE::script_stack into the global table, overriding any previous value at that index.
Arguments
Stack Values Popped