diff --git a/artifacts/example_mods/StealCheat/gl_stealcheat.int b/artifacts/example_mods/StealCheat/gl_stealcheat.int new file mode 100644 index 00000000..e4e7afde Binary files /dev/null and b/artifacts/example_mods/StealCheat/gl_stealcheat.int differ diff --git a/artifacts/example_mods/StealCheat/hs_steal.ssl b/artifacts/example_mods/StealCheat/gl_stealcheat.ssl similarity index 54% rename from artifacts/example_mods/StealCheat/hs_steal.ssl rename to artifacts/example_mods/StealCheat/gl_stealcheat.ssl index 26da8241..49c55930 100644 --- a/artifacts/example_mods/StealCheat/hs_steal.ssl +++ b/artifacts/example_mods/StealCheat/gl_stealcheat.ssl @@ -1,22 +1,24 @@ -procedure start; +procedure start; // adjust include paths if needed -#include "..\..\scripting_docs\headers\sfall.h" +#include "..\..\scripting_docs\headers\sfall.h" #define RESULT_SUCCESS (1) #define RESULT_FAIL (0) - -procedure start begin - if not init_hook then begin + +procedure start begin + if game_loaded then begin + register_hook(HOOK_STEAL); + end else begin variable thief := get_sfall_arg, target := get_sfall_arg, item := get_sfall_arg, action := get_sfall_arg, result := RESULT_SUCCESS; - - if (thief == dude_obj) then begin - display_msg(sprintf(mstr_skill(570 + result + action*2), obj_name(item))); - set_sfall_return(result); - end - end + + if (thief == dude_obj) then begin + display_msg(sprintf(mstr_skill(570 + result + action*2), obj_name(item))); + set_sfall_return(result); + end + end end diff --git a/artifacts/example_mods/StealCheat/hs_steal.int b/artifacts/example_mods/StealCheat/hs_steal.int deleted file mode 100644 index 630168e1..00000000 Binary files a/artifacts/example_mods/StealCheat/hs_steal.int and /dev/null differ diff --git a/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int b/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int new file mode 100644 index 00000000..6e585781 Binary files /dev/null and b/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int differ diff --git a/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.ssl b/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.ssl new file mode 100644 index 00000000..657ce5c0 --- /dev/null +++ b/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.ssl @@ -0,0 +1,20 @@ +procedure start; +// adjust include paths if needed +#include "..\..\scripting_docs\headers\sfall.h" +#include "..\..\scripting_docs\headers\dik.h" + +procedure start begin + if game_loaded then begin + register_hook(HOOK_KEYPRESS); + end else begin + variable + event := get_sfall_arg, + keyDX := get_sfall_arg; + + if (event == 1) and (keyDX == DIK_SEMICOLON) then begin + tap_key(DIK_CAPITAL); + tap_key(DIK_A); + tap_key(DIK_CAPITAL); + end + end +end diff --git a/artifacts/example_mods/TakeAllHotkey/hs_keypress.int b/artifacts/example_mods/TakeAllHotkey/hs_keypress.int deleted file mode 100644 index bb78a752..00000000 Binary files a/artifacts/example_mods/TakeAllHotkey/hs_keypress.int and /dev/null differ diff --git a/artifacts/example_mods/TakeAllHotkey/hs_keypress.ssl b/artifacts/example_mods/TakeAllHotkey/hs_keypress.ssl deleted file mode 100644 index c982a7ce..00000000 --- a/artifacts/example_mods/TakeAllHotkey/hs_keypress.ssl +++ /dev/null @@ -1,16 +0,0 @@ -procedure start; -#include ".\HEADERS\dik.h" - -procedure start begin - variable event, keyDX; - if not init_hook then begin - event := get_sfall_arg; - keyDX := get_sfall_arg; - - if ((event == 1) and (keyDX == DIK_SEMICOLON)) then begin - tap_key(DIK_CAPITAL); - tap_key(DIK_A); - tap_key(DIK_CAPITAL); - end - end -end diff --git a/artifacts/example_mods/TakeAllHotkey/readme.txt b/artifacts/example_mods/TakeAllHotkey/readme.txt index 02b89070..dedd0668 100644 --- a/artifacts/example_mods/TakeAllHotkey/readme.txt +++ b/artifacts/example_mods/TakeAllHotkey/readme.txt @@ -2,8 +2,8 @@ ---------------------------------------- - makes pressing the semicolon key send an uppercase A after a semicolon. -- the uppercase A (shift + A if Caps Lock is off) is the built-in hotkey for the TAKE ALL button on the loot screen. +- Note: the uppercase A (shift + A if Caps Lock is off) is the built-in hotkey for the TAKE ALL button on the loot screen. -To use, copy hs_keypress.int file to your scripts folder. +To use, copy *.int file to your scripts folder. This mod is a simple example of how you can use HOOK_KEYPRESS hooks.