| Next revision | Previous revision | ||
|
hpl3:community:scripting:custom_user_modules [2017/01/22 08:14] abion47 created |
hpl3:community:scripting:custom_user_modules [2017/06/12 14:14] (current) abion47 [Getting Started] |
||
|---|---|---|---|
| Line 93: | Line 93: | ||
| }</code> | }</code> | ||
| - | Next, you need to add your module to your mod's "Modules.cfg" file. That file is an XML file that lists every module loaded when the game starts. (If your mod doesn't have a "Modules.xml" file, you can copy the one from SOMA's config folder to use as a starting point.) | + | Next, you need to add your module to your mod's "Modules.cfg" file. That file is an XML file that lists every module loaded when the game starts. (If your mod doesn't have a "Modules.cfg" file, you can copy the one from SOMA's config folder to use as a starting point.) |
| There are several attributes that need to be set for your module's entry. An entry looks like this: | There are several attributes that need to be set for your module's entry. An entry looks like this: | ||
| Line 232: | Line 232: | ||
| { | { | ||
| cScript_SetGlobalArgInt(0, alSomeInt); | cScript_SetGlobalArgInt(0, alSomeInt); | ||
| - | cScript_SetGlobalArgString(1, asSomeString); | + | cScript_SetGlobalArgString(1, asSomeString); |
| - | cScript_RunGlobalFunc("SomeHandler", "", "_Global_DoSomeWork"); | + | cScript_RunGlobalFunc("SomeHandler", "", "_Global_DoSomeWork"); |
| - | + | ||
| - | bool abResult = cScript_GetGlobalResultBool(); | + | bool abResult = cScript_GetGlobalResultBool(); |
| - | + | ||
| - | // Do some nonsense with the result | + | // Do some nonsense with the result |
| }</code> | }</code> | ||
| Line 244: | Line 244: | ||
| { | { | ||
| int lSomeInt = cScript_GetGlobalArgInt(0); | int lSomeInt = cScript_GetGlobalArgInt(0); | ||
| - | string sSomeString = cScript_GetGlobalArgString(1); | + | string sSomeString = cScript_GetGlobalArgString(1); |
| - | + | ||
| - | // Do whatever module wizardry here... | + | // Do whatever module wizardry here... |
| - | + | ||
| - | cScript_SetGlobalReturnBool(true); | + | cScript_SetGlobalReturnBool(true); |
| }</code> | }</code> | ||
| Line 265: | Line 265: | ||
| { | { | ||
| cScript_SetGlobalArgInt(0, alSomeInt); | cScript_SetGlobalArgInt(0, alSomeInt); | ||
| - | cScript_SetGlobalArgString(1, asSomeString); | + | cScript_SetGlobalArgString(1, asSomeString); |
| - | cScript_RunGlobalFunc("SomeHandler", "", "_Global_DoSomeWork"); | + | cScript_RunGlobalFunc("SomeHandler", "", "_Global_DoSomeWork"); |
| - | + | ||
| - | return cScript_GetGlobalResultBool(); | + | return cScript_GetGlobalResultBool(); |
| }</code> | }</code> | ||
| Line 280: | Line 280: | ||
| { | { | ||
| bool abResult = SomeModule_DoSomeWork(alSomeInt, asSomeString); | bool abResult = SomeModule_DoSomeWork(alSomeInt, asSomeString); | ||
| - | + | | |
| - | // Do some nonsense with the result | + | // Do some nonsense with the result |
| }</code> | }</code> | ||