diff --git a/artifacts/scripting/sfall function list.txt b/artifacts/scripting/sfall function list.txt index f761028a..16af197d 100644 --- a/artifacts/scripting/sfall function list.txt +++ b/artifacts/scripting/sfall function list.txt @@ -337,16 +337,25 @@ 0x8262 - void register_hook_proc(int hook, procedure proc) -0x8266 - char* message_str_game(int fileId, int messageId) -0x8267 - int sneak_success -0x8268 - int tile_light(int elevation, int tileNum) -0x8269 - ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType) -0x826a - ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType) -0x826b - array tile_get_objs(int tileNum, int elevation) -0x826c - array party_member_list(int includeHidden) -0x826d - array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType) -0x826e - ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius) -0x826f - int art_exists(int artFID) -0x8270 - int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) +0x826b - char* message_str_game(int fileId, int messageId) +0x826c - int sneak_success +0x826d - int tile_light(int elevation, int tileNum) +0x826e - ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType) +0x826f - ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType) +0x8270 - array tile_get_objs(int tileNum, int elevation) +0x8271 - array party_member_list(int includeHidden) +0x8272 - array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType) +0x8273 - ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius) +0x8274 - int art_exists(int artFID) +0x8275 - int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) + +0x8276 - any sfall_func0(char* funcName) +0x8277 - any sfall_func1(char* funcName, arg1) +0x8278 - any sfall_func2(char* funcName, arg1, arg2) +0x8279 - any sfall_func3(char* funcName, arg1, arg2, arg3) +0x827a - any sfall_func4(char* funcName, arg1, arg2, arg3, arg4) +0x827b - any sfall_func5(char* funcName, arg1, arg2, arg3, arg4, arg5) +0x827c - any sfall_func6(char* funcName, arg1, arg2, arg3, arg4, arg5, arg6) + * These functions require AllowUnsafeScripting to be enabled in ddraw.ini diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index cd140e25..ed487e3a 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -159,9 +159,9 @@ get/set_critter_skill_points will get/set the number of additional points a crit - It is not saved into the save game, so needs to be called once per reload. - Be careful not to let the player obtain a perk when no perks are available to pick, or the game may crash. -> ObjectPtr get_last_target(objptr) +> Object get_last_target(objptr) - will return the last critter to be deliberately attacked -> ObjectPtr get_last_attacker(objptr) +> Object get_last_attacker(objptr) - will return the last critter to deliberately launch an attack against the argument critter. - If a critter has not launched/recieved an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0. @@ -286,12 +286,12 @@ Some utility/math functions are available: > int tile_light(int elevation, int tileNum) - returns light intensity at the given tile in range from 0 to 65535 -> ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType) +> Object obj_blocking_line(Object objFrom, int tileTo, int blockingType) - returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h) - if path is clear (no blocker was encountered by selected function) - returns 0 - objFrom is always excluded from calculations, but is required to be a valid object -> ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType) +> Object obj_blocking_tile(int tileNum, int elevation, int blockingType) - returns first object blocking given tile using given blocking function or 0 if tile is clear > array tile_get_objs(int tileNum, int elevation) @@ -301,22 +301,58 @@ Some utility/math functions are available: > array party_member_list(int includeHidden) - returns array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.) -> array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType) +> array path_find_to(Object objFrom, int tileTo, int blockingType) - returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step - array length equals to a number of steps - empty array means that specified target cannot be reached -> ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius) +> Object create_spatial(int scriptID, int tile, int elevation, int radius) - creates new spatial script with given SID, at given tile, and radius > int art_exists(int artFID) - checks if given artFID exists in the game - useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000)) -> int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) +> int obj_is_carrying_obj(Object invenObj, Object itemObj) - returns number of itemObj inside invenObj's inventory, note that both arguments are object pointers - useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID) +> any sfall_funcX(char* funcName, ...) +- these opcodes allows to use additional scripting functions, that do not require new opcode +- first argument is always function name (string) +- there are 7 versions of this opcode for different number of additional arguments (for convenience) +- opcodes have return value, but it is not neccessary to use it + + +------------------------------------ +------ sfall_funcX functions ------- +------------------------------------ + +> Array sfall_func0("get_metarule_table") +- returns names of all currently available scripting functions (via sfall_funcX) + +> int sfall_func1("spatial_radius", Object object) +- return radius of spatial script, associated with given dummy-object (returned by create_spatial) + +> Object sfall_func2("critter_inven_obj2" Object invenObj, int type) +- works just like vanilla critter_inven_obj, but correctly reports item in player's inactive hand slot + +> void sfall_func0("intface_redraw") +- redraws main game interface +- useful after direct changes to current player weapons or stats to reflect changes + +> void sfall_func0("intface_hide") +- hides main interface + +> void sfall_func0("intface_show") +- shows main interface + +> int sfall_func0("intface_is_hidden") +- returns 1 if interface is currently hidden, 0 otherwise + +> void sfall_func0("exec_map_update_scripts") +- executes map_update_p_proc for all objects on map and global/hook scripts as well + ------------------------ ------ MORE INFO ------- ------------------------