You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👼Script: 🧹 Fixed return codes of script-manip funcs.
Changes:
* added + registered `enum ScriptRetCode` - used by all script manipulation funcs (add/get/delete | funcs/variables)
* added func `scriptVariableExists()` to go with `scriptFunctionExists()`
* added internal helper `validateScriptModule`- used by all script manipulation funcs (add/get/delete | funcs/variables)
Following is analysis of former state (most but not all funcs returned 0 on success)
~ executeString() [script: not exported] - used to return 0 on success, 1 on internal error and negative number otherwise.
~ addFunction() [script: `game.addScriptFunction()`] - used to return 0 on success, 1 on internal error and negative number otherwise.
~ functionExists() [script: `game.scriptFunctionExists()`] - used to return function ID (always >0) on success, negative number on error.
~ deleteFunction() [script: `game.deleteScriptFunction()`] - used to return function ID (always >0) on success, negative number on error.
~ addVariable() [script: `game.addScriptVariable()` ] - used to return 0 on success, 1 on internal error and negative number otherwise.
~ variableExists() [script: `game.scriptVariableExists()`] - newly added, returns 0 on success and negative number otherwise.
~ deleteVariable() [script: `game.deleteScriptVariable()` ] - used to return 0 on success, 1 on internal error and negative number otherwise.
~ getVariable() [script: `game.getScriptVariable()` ] - recently added, returns 0 on success and negative number otherwise.
Copy file name to clipboardexpand all lines: doc/angelscript/Script2Game/globals.h
+45
Original file line number
Diff line number
Diff line change
@@ -666,6 +666,51 @@ enum MsgType
666
666
MSG_EDI_CREATE_PROJECT_REQUESTED, //!< Creates a subdir under 'projects/', pre-populates it and adds to modcache. Params: 'name' (string), 'ext' (string, optional), 'source_entry' (CacheEntryClass@)
667
667
};
668
668
669
+
/// Binding of `RoR::ScriptRetCode`; Common return codes for script manipulation funcs (add/get/delete | funcs/variables)
670
+
enum ScriptRetCode
671
+
{
672
+
673
+
SCRIPTRETCODE_SUCCESS = AngelScript::asSUCCESS, //!< Generic success - 0 by common convention.
staticconst ScriptUnitID_t SCRIPTUNITID_DEFAULT = -2; //!< The script defined in .terrn2 [Scripts], or 'default.as' ~ classic behavior.
42
43
43
44
typedefint PointidID_t; //!< index to `PointColDetector::hit_pointid_list`, use `RoR::POINTIDID_INVALID` as empty value.
44
45
staticconst PointidID_t POINTIDID_INVALID = -1;
@@ -74,6 +75,8 @@ namespace RoR
74
75
typedefint CommandkeyID_t; //!< Index into `Actor::ar_commandkeys` (BEWARE: indexed 1-MAX_COMMANDKEYS, 0 is invalid value, negative subscript of any size is acceptable, see `class CmdKeyArray` ).
0 commit comments