From e725445ce9a3670e0ab556224c701aad6c12a6b9 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sun, 3 Oct 2021 09:43:54 +0800 Subject: [PATCH] Added the description of set_scr_name function --- artifacts/scripting/sfall function notes.md | 8 ++++++++ sfall/Modules/Scripting/Handlers/Metarule.cpp | 2 +- sfall/Modules/Scripting/Handlers/Misc.cpp | 2 +- sfall/Modules/Scripting/Handlers/Misc.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/artifacts/scripting/sfall function notes.md b/artifacts/scripting/sfall function notes.md index 937246b6..9ffc11ad 100644 --- a/artifacts/scripting/sfall function notes.md +++ b/artifacts/scripting/sfall function notes.md @@ -1040,6 +1040,14 @@ sfall_funcX metarule functions - `gvarNumber`: the number of the global variable controlling the quest - `thresholdValue`: the value of the global variable at which the quest is counted as a failure +---- +#### set_scr_name +`void sfall_func1("set_scr_name", string name)` +- Overrides the name of the script object that was set from **scrname.msg** +- The changed name will be reset each time the player leaves the map or reloads the game +- Passing an empty string ("") to the `name` argument or omitting it will allow the game to get the name for the object from pro_*.msg files +- __NOTE:__ this function is intended for use in normal game scripts + **** _See other documentation files (arrays.md, hookscripts.md) for related functions reference._ diff --git a/sfall/Modules/Scripting/Handlers/Metarule.cpp b/sfall/Modules/Scripting/Handlers/Metarule.cpp index 4d8a04d0..c4371764 100644 --- a/sfall/Modules/Scripting/Handlers/Metarule.cpp +++ b/sfall/Modules/Scripting/Handlers/Metarule.cpp @@ -139,7 +139,7 @@ static const SfallMetarule metarules[] = { {"set_quest_failure_value", mf_set_quest_failure_value, 2, 2, -1, {ARG_INT, ARG_INT}}, {"set_rest_heal_time", mf_set_rest_heal_time, 1, 1, -1, {ARG_INT}}, {"set_rest_mode", mf_set_rest_mode, 1, 1, -1, {ARG_INT}}, - {"set_scr_name", mf_set_src_name, 0, 1, -1, {ARG_STRING}}, + {"set_scr_name", mf_set_scr_name, 0, 1, -1, {ARG_STRING}}, {"set_selectable_perk_npc", mf_set_selectable_perk_npc, 5, 5, -1, {ARG_OBJECT, ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}}, {"set_terrain_name", mf_set_terrain_name, 3, 3, -1, {ARG_INT, ARG_INT, ARG_STRING}}, {"set_town_title", mf_set_town_title, 2, 2, -1, {ARG_INT, ARG_STRING}}, diff --git a/sfall/Modules/Scripting/Handlers/Misc.cpp b/sfall/Modules/Scripting/Handlers/Misc.cpp index 7873343f..95b5bfc7 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.cpp +++ b/sfall/Modules/Scripting/Handlers/Misc.cpp @@ -503,7 +503,7 @@ void mf_set_quest_failure_value(OpcodeContext& ctx) { QuestList::AddQuestFailureValue(ctx.arg(0).rawValue(), ctx.arg(1).rawValue()); } -void mf_set_src_name(OpcodeContext& ctx) { +void mf_set_scr_name(OpcodeContext& ctx) { long sid = fo::func::scr_find_sid_from_program(ctx.program()); if (sid == -1) return; diff --git a/sfall/Modules/Scripting/Handlers/Misc.h b/sfall/Modules/Scripting/Handlers/Misc.h index 4287a317..15d7764d 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.h +++ b/sfall/Modules/Scripting/Handlers/Misc.h @@ -104,7 +104,7 @@ void mf_get_ini_section(OpcodeContext&); void mf_set_quest_failure_value(OpcodeContext&); -void mf_set_src_name(OpcodeContext&); +void mf_set_scr_name(OpcodeContext&); } }