This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| 4rpl:commands:registerscript [2021/02/15 23:27] – created virgilw | 4rpl:commands:registerscript [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ~~NOTOC~~ | ~~NOTOC~~ | ||
| - | < | + | < |
| + | <= [[4rpl: | ||
| :!: Available in version 1.3 and later. | :!: Available in version 1.3 and later. | ||
| Line 7: | Line 8: | ||
| ===== Description ===== | ===== Description ===== | ||
| - | Registers the current script instance with a name. This name can be used with [[GetRegisteredScriptVar]]. If the same name is used as another script instance, this call will deregister the other script instance and replace it with the new one. A script on a unit in a unique instance. Each global script instance is also unique. Note that registering a script is NOT persistent. It will not be saved in a save game file. You must reregister a script. | + | Registers the current script instance with a name. This name can be used with [[GetRegisteredScriptVar]]. If the same name is used as another script instance, this call will deregister the other script instance and replace it with the new one. A script on a unit is a unique instance. Each global script instance is also unique. |
| + | |||
| + | :!: Note that registering a script is NOT persistent. It will not be saved in a save game file. You must reregister a script. | ||
| ===== Examples ===== | ===== Examples ===== | ||
| Line 13: | Line 16: | ||
| RegisterScript(" | RegisterScript(" | ||
| </ | </ | ||
| + | |||
| + | === See Also === | ||
| + | [[DeregisterScript]] | ||
| + | |||
| + | === Discussion === | ||
| + | This was added to CW4 as an attempt to give a similar API to what was in CW3. Messaging is likely the better option in most cases. | ||
| + | |||
| + | This works a lot like messaging. | ||
| + | |||
| + | It makes most sense in a scenario where there is a single global script. | ||
| < | < | ||