diff --git a/artifacts/scripting/headers/dik.h b/artifacts/scripting/headers/dik.h index 42feb350c..8665eda01 100644 --- a/artifacts/scripting/headers/dik.h +++ b/artifacts/scripting/headers/dik.h @@ -1,7 +1,7 @@ #ifndef H_DIK #define H_DIK -// Listed are keyboard scan code constants (in decimal), taken from dinput.h +// Listed are keyboard scan code constants (in decimal), taken from dinput.h #define DIK_ESCAPE 1 #define DIK_1 2 @@ -14,9 +14,9 @@ #define DIK_8 9 #define DIK_9 10 #define DIK_0 11 -#define DIK_MINUS 12 /* - on main keyboard */ +#define DIK_MINUS 12 /* - on main keyboard */ #define DIK_EQUALS 13 -#define DIK_BACK 14 /* backspace */ +#define DIK_BACK 14 /* backspace */ #define DIK_TAB 15 #define DIK_Q 16 #define DIK_W 17 @@ -116,20 +116,20 @@ #define DIK_RWIN 0xDC /* Right Windows key */ #define DIK_APPS 0xDD /* AppMenu key */ -#define DIK_BACKSPACE DIK_BACK /* backspace */ -#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ -#define DIK_LALT DIK_LMENU /* left Alt */ -#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ -#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ -#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ -#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ -#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ -#define DIK_RALT DIK_RMENU /* right Alt */ -#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ -#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ -#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ -#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ -#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ -#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ #endif diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h index 7bbd87054..7f14569a2 100644 --- a/artifacts/scripting/headers/sfall.h +++ b/artifacts/scripting/headers/sfall.h @@ -16,32 +16,32 @@ #define SKILLDEX (0x4000) //Valid arguments to register_hook -#define HOOK_TOHIT (0) -#define HOOK_AFTERHITROLL (1) -#define HOOK_CALCAPCOST (2) -#define HOOK_DEATHANIM1 (3) -#define HOOK_DEATHANIM2 (4) -#define HOOK_COMBATDAMAGE (5) -#define HOOK_ONDEATH (6) -#define HOOK_FINDTARGET (7) -#define HOOK_USEOBJON (8) -#define HOOK_REMOVEINVENOBJ (9) -#define HOOK_BARTERPRICE (10) -#define HOOK_MOVECOST (11) -#define HOOK_HEXMOVEBLOCKING (12) -#define HOOK_HEXAIBLOCKING (13) +#define HOOK_TOHIT (0) +#define HOOK_AFTERHITROLL (1) +#define HOOK_CALCAPCOST (2) +#define HOOK_DEATHANIM1 (3) +#define HOOK_DEATHANIM2 (4) +#define HOOK_COMBATDAMAGE (5) +#define HOOK_ONDEATH (6) +#define HOOK_FINDTARGET (7) +#define HOOK_USEOBJON (8) +#define HOOK_REMOVEINVENOBJ (9) +#define HOOK_BARTERPRICE (10) +#define HOOK_MOVECOST (11) +#define HOOK_HEXMOVEBLOCKING (12) +#define HOOK_HEXAIBLOCKING (13) #define HOOK_HEXSHOOTBLOCKING (14) #define HOOK_HEXSIGHTBLOCKING (15) -#define HOOK_ITEMDAMAGE (16) -#define HOOK_AMMOCOST (17) -#define HOOK_USEOBJ (18) -#define HOOK_KEYPRESS (19) -#define HOOK_MOUSECLICK (20) -#define HOOK_USESKILL (21) -#define HOOK_STEAL (22) +#define HOOK_ITEMDAMAGE (16) +#define HOOK_AMMOCOST (17) +#define HOOK_USEOBJ (18) +#define HOOK_KEYPRESS (19) +#define HOOK_MOUSECLICK (20) +#define HOOK_USESKILL (21) +#define HOOK_STEAL (22) #define HOOK_WITHINPERCEPTION (23) #define HOOK_INVENTORYMOVE (24) -#define HOOK_INVENWIELD (25) +#define HOOK_INVENWIELD (25) //Valid arguments to list_begin #define LIST_CRITTERS (0) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index ad917eec5..bf2c24645 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -390,7 +390,7 @@ What you can do: - add AP costs for all inventory movement including reloading - apply or remove some special scripted effects depending on PC's armor -int arg1 - Target slot (0 - main backback, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo) +int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo) Item arg2 - Item being moved Item arg3 - Item being replaced or weapon being reloaded (can be 0) diff --git a/artifacts/scripting/sfall function list.txt b/artifacts/scripting/sfall function list.txt index f55e4a03a..f761028ac 100644 --- a/artifacts/scripting/sfall function list.txt +++ b/artifacts/scripting/sfall function list.txt @@ -349,4 +349,4 @@ 0x826f - int art_exists(int artFID) 0x8270 - int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) -* These functions require AllowUnsafeScripting to be enabled in ddraw.ini \ No newline at end of file +* 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 421a782d4..76fd39355 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -48,7 +48,7 @@ set_fake_trait and set_fake_perk can be used to add additional traits and perks has_fake_trait and has_fake_perk return the number of levels the player has of the perks/traits with the given name. -perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state. +perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state. show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to 9 for custom boxes. Remember to add your messages to intrface.msg and setup the font colours in ddraw.ini if you're going to use custom boxes. @@ -81,44 +81,44 @@ get/set_critter_skill_points will get/set the number of additional points a crit ------ FUNCTION REFERENCE (incomplete) ------- ---------------------------------------------- -> int game_loaded() +> int game_loaded() - returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. It's primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too. -> void inc_npc_level(string npc) -- takes an npc name as an argument. The npc must be in your party. This function ignores player level requirements and the minimum 3 player level delay between npc level gains. It also ignores the random element, regardless of sfall's NPCAutoLevel setting. +> void inc_npc_level(string npc) +- takes an npc name as an argument. The npc must be in your party. This function ignores player level requirements and the minimum 3 player level delay between npc level gains. It also ignores the random element, regardless of sfall's NPCAutoLevel setting. > int get_npc_level(string npc) - also takes the npc name as an argument, and returns the npc's current level. Again, the npc needs to be in your party. -> int get_ini_setting(string setting) -- reads an integer value from an ini file in the fallout directory. -- It only takes a single argument; seperate the file name, section and key with a '|' character; e.g. 'myvar:=get_ini_setting("myini.ini|mysec|var1")' If the file or key cannot be found, -1 is returned. -- The file name is limited to 16 chars, including the extension. -- The section name is limited to 8 characters. +> int get_ini_setting(string setting) +- reads an integer value from an ini file in the fallout directory. +- It only takes a single argument; seperate the file name, section and key with a '|' character; e.g. 'myvar:=get_ini_setting("myini.ini|mysec|var1")' If the file or key cannot be found, -1 is returned. +- The file name is limited to 16 chars, including the extension. +- The section name is limited to 8 characters. - It can also be used to get sfalls settings, by using ddraw.ini as the file name. > string get_ini_string(string setting) -- reads a string value from an ini file in the fallout directory. +- reads a string value from an ini file in the fallout directory. > int get_game_mode() -- is a more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in. +- is a more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in. - These flags are the same as those used in the set_shader_mode function. > int get_uptime() - is just a wrapper around the windows GetTickCount() function. It's useful for making time fade effects in shaders, since they already have access to the current tick count. -> boolean in_world_map() -- returns 1 if the player is looking at the world map, or 0 at any other time. +> boolean in_world_map() +- returns 1 if the player is looking at the world map, or 0 at any other time. - Obviously this is only useful in global scripts, since normal scripts will never get the chance to run on the world map. -> void force_encounter(int map) -- can be called either from a global script while traveling on the world map, or from a normal script while on a local map. +> void force_encounter(int map) +- can be called either from a global script while traveling on the world map, or from a normal script while on a local map. - In either case the encounter occurs shortly after the next time the player moves on the world map. - The player will not get an outdoorsman skill check. > void force_encounter_with_flags(int map, int flags) -- does the same thing as force_encounter, but allows the specification of some extra options. -- Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it. +- does the same thing as force_encounter, but allows the specification of some extra options. +- Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it. - In this case use force_encounter_with_flags with the ENCOUNTER_FLAG_NO_CAR flag set. > int get_light_level() @@ -130,7 +130,7 @@ get/set_critter_skill_points will get/set the number of additional points a crit - This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of pathfinder would result in time passing at 25% the normal speed on the world map. > void remove_script(objptr) -- accepts a pointer to an object and will remove the script from that object. +- accepts a pointer to an object and will remove the script from that object. > void set_script(objptr, int scriptid) - accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6) @@ -138,31 +138,31 @@ get/set_critter_skill_points will get/set the number of additional points a crit - if you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run. > int get_script(objptr) -- accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted. +- accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted. -> void set_self(int obj) -- overrides the scripts self_obj for the next function call. -- It is primarily used to allow the calling of functions which take an implicit self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts; +> void set_self(int obj) +- overrides the scripts self_obj for the next function call. +- It is primarily used to allow the calling of functions which take an implicit self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts; - self_obj will revert back to its original value after the next function call. - calling self_obj(0) will also revert self_obj to original value - source_obj, target_obj, and similar functions will not work if preceeded by "set_self" > void mod_skill_points_per_level(int x) -- accepts a value of between -100 and 100, and modifies the number of skill points the player recieves when they level up. -- This is a modification of what would otherwise happen, rather than a replacement. +- accepts a value of between -100 and 100, and modifies the number of skill points the player recieves when they level up. +- This is a modification of what would otherwise happen, rather than a replacement. - The value is not saved into the save game, so should be reset in the game_loaded section of a script. > void seq_perk_freq(int x) -- sets the number of levels between each perk. -- Setting 0 will reset it back to the default. -- This overrides the effects of the skilled trait. -- It is not saved into the save game, so needs to be called once per reload. +- sets the number of levels between each perk. +- Setting 0 will reset it back to the default. +- This overrides the effects of the skilled trait. +- 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) -- will return the last critter to be deliberately attacked -> ObjectPtr get_last_attacker(objptr) -- will return the last critter to deliberately launch an attack against the argument critter. +> ObjectPtr get_last_target(objptr) +- will return the last critter to be deliberately attacked +> ObjectPtr 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. > void set_base_pickpocket_mod(int max, int mod) @@ -173,43 +173,43 @@ get/set_critter_skill_points will get/set the number of additional points a crit > void set_critter_pickpocket_mod(CritterPtr, int max, int mod) - the same as above, but applies only to specific critter -> void reg_anim_combat_check +> void reg_anim_combat_check - allows to enable all reg_anim_* functions in combat (including vanilla functions) if set to 0. It is automatically reset at the end of each frame, so you need to call it before "reg_anim_begin" - "reg_anim_end" block. - -Some additional reg_anim_* functions were introduced. They all work in the same convention as vanilla functions and use the same underlying code. -> void reg_anim_destroy(object) +Some additional reg_anim_* functions were introduced. They all work in the same convention as vanilla functions and use the same underlying code. + +> void reg_anim_destroy(object) - given object is destroyed at the end of current animation set - -> void reg_anim_animate_and_hide(object, animID, delay) + +> void reg_anim_animate_and_hide(object, animID, delay) - exactly like "reg_anim_animate" but the object will automatically disappear after the last animation frame (but not destroyed) -> void reg_anim_light(object, light, delay) +> void reg_anim_light(object, light, delay) - change light of any object. light argument is a light radius (0-8), but you can use highest 2 bytes to pass light intensity as well (example: 0xFFFF0008 - intensity 65535 and radius 8). If highest 2 bytes are 0, intensity will not be changed. Intensity range is from 0 to 65535 (0xFFFF). -> void reg_anim_change_fid(object, fid, delay) +> void reg_anim_change_fid(object, fid, delay) - should work like art_change_fid_num but in reg_anim sequence -> void reg_anim_take_out(object, holdFrameID, delay) +> void reg_anim_take_out(object, holdFrameID, delay) - plays "take out weapon" animation for given holdFrameID. It is not required to have such weapon in critter's inventory. - -> void reg_anim_turn_towards(object, tile/target, delay) + +> void reg_anim_turn_towards(object, tile/target, delay) - makes object change it's direction to face given tile num or target object. > int metarule2_explosions(int arg1, int arg2) was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h: -> void set_attack_explosion_pattern(x, y) +> void set_attack_explosion_pattern(x, y) - currently y is not used and x means: 1 - reduced explosion pattern (3 effects are spawned instead of 7), 0 - full pattern -> void set_attack_explosion_art(x, y) +> void set_attack_explosion_art(x, y) - y not used and x is a misc frame ID (last 3 bytes, without object type) to use for the next explosion. - -> void set_attack_explosion_radius(x) + +> void set_attack_explosion_radius(x) - changes radius at which explosion will hit secondary targets for the next attack (from the experiments it is limited to something around 8 by the engine) -> void set_attack_is_explosion_fire +> void set_attack_is_explosion_fire - if you call this right before using a weapon with fire damage type, it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still recieve fire damage. @@ -219,20 +219,20 @@ Some utility/math functions are available: - takes a string and a seperator, searches the string for all instances of the seperator, and returns a temp array filled with the pieces of the string split at each instance. If you give an empty string as the seperator, the string is split into individual characters. - you can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0)) -> string substr(string, start, length) +> string substr(string, start, length) - cuts a substring from a string starting at "start" up to "length" characters. If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st"). If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te") -> int strlen(char* string) +> int strlen(char* string) - returns string length -> string sprintf(char* format, any value) -- formats given value using standart syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value. +> string sprintf(char* format, any value) +- formats given value using standart syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value. - can be used to get character by ASCII code ("%c") -> int typeof(any value) +> int typeof(any value) - returns type of the given value: VALTYPE_INT, VALTYPE_FLOAT or VALTYPE_STR. -> int charcode(char* string) +> int charcode(char* string) - returns ASCII code for the first character in given string > ^ operator (exponentiation) @@ -276,7 +276,7 @@ Some utility/math functions are available: > string message_str_game(int fileId, int messageId) - works exactly the same as message_str, except you get messages from files in "text/english/game" folder -- use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file +- use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file > int sneak_success - returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise