From e7e286013fc257ced5363fc88bf160ac504c8729 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 6 Jul 2017 21:01:35 +0800 Subject: [PATCH] Replaced hs_*.int scripts in example mods with normal global scripts with register_hook. --- .../example_mods/StealCheat/gl_stealcheat.int | Bin 0 -> 372 bytes .../{hs_steal.ssl => gl_stealcheat.ssl} | 24 ++++++++++-------- .../example_mods/StealCheat/hs_steal.int | Bin 358 -> 0 bytes .../TakeAllHotkey/gl_takeallkey.int | Bin 0 -> 300 bytes .../TakeAllHotkey/gl_takeallkey.ssl | 20 +++++++++++++++ .../TakeAllHotkey/hs_keypress.int | Bin 286 -> 0 bytes .../TakeAllHotkey/hs_keypress.ssl | 16 ------------ .../example_mods/TakeAllHotkey/readme.txt | 4 +-- 8 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 artifacts/example_mods/StealCheat/gl_stealcheat.int rename artifacts/example_mods/StealCheat/{hs_steal.ssl => gl_stealcheat.ssl} (54%) delete mode 100644 artifacts/example_mods/StealCheat/hs_steal.int create mode 100644 artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int create mode 100644 artifacts/example_mods/TakeAllHotkey/gl_takeallkey.ssl delete mode 100644 artifacts/example_mods/TakeAllHotkey/hs_keypress.int delete mode 100644 artifacts/example_mods/TakeAllHotkey/hs_keypress.ssl diff --git a/artifacts/example_mods/StealCheat/gl_stealcheat.int b/artifacts/example_mods/StealCheat/gl_stealcheat.int new file mode 100644 index 0000000000000000000000000000000000000000..e4e7afde7d59cc63a0ea495a18b523c6cbde4b06 GIT binary patch literal 372 zcmZo*I>5-lz#!DX3#MBdSQ-Qxq#6_&q#6_(q#BeOq#BePR2ozp)EF2Tm>3us*ced3 zG$>aBO2a6axDwLd;(%IFfkDZ11G*g3hgJn}Tlx@_oq$!|b2bjmwVAS{&%wlNZZIEoxYS3)pX^;Wa FG61**P}Kkc literal 0 HcmV?d00001 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 630168e11b054803f04a6a3b9cbe02d5e8f20a2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 358 zcmZo*I>5-lz#!DX3#MBdSQ-Qxq#6_&q#6_(q#BeOq#BePR2ozp)EF2Tm>3us*ced3 zG$>aBO2a6axDZ11G*g3hgJn}Tlx@_oq$!|b2bjmwVAS{&%wlNZZIEoxYS3)pX^;WaG5{-@PLBWp diff --git a/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int b/artifacts/example_mods/TakeAllHotkey/gl_takeallkey.int new file mode 100644 index 0000000000000000000000000000000000000000..6e585781c17c754eb5383241ccd0307cde6d7f32 GIT binary patch literal 300 zcmZo*I>5-lz#!DX3#MBdSQ-Qxq#6_&q#6_(q#BeOq#BePR2ozp)EF2Tm>3us*ced3 zG$>aBO2a6axDa6= VjL*=(+aTGX)u7qH(;x$;WdIevKDht@ literal 0 HcmV?d00001 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 bb78a752800e9df95c7870349fff47084101bdb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 286 zcmZo*I>5-lz#!DX3#MBdSQ-Qxq#6_&q#6_(q#BeOq#BePR2ozp)EF2Tm>3us*ced3 zG$>aBO2a6axDU