TrustedUser
2,147
edits
m (Text replacement - "<source lang=" to "<syntaxhighlight lang=") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 269: | Line 269: | ||
reset(script_blocked); | reset(script_blocked); | ||
} | } | ||
</ | </syntaxhighlight> | ||
==== Save Script Position ==== | ==== Save Script Position ==== | ||
Line 281: | Line 281: | ||
load.view(20); // script contains view 10, 20 | load.view(20); // script contains view 10, 20 | ||
pop.script(); // script contains view 10 | pop.script(); // script contains view 10 | ||
</ | </syntaxhighlight> | ||
To use in a real game, you need to initialise push.script first. This is similar to the first example in blocking script writing (but overkill): | To use in a real game, you need to initialise push.script first. This is similar to the first example in blocking script writing (but overkill): | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Line 299: | Line 299: | ||
pop.script(); // script doesn't contain either | pop.script(); // script doesn't contain either | ||
} | } | ||
</ | </syntaxhighlight> | ||
Here is my version of code to swap the ego's view and still letting the player save the game: | Here is my version of code to swap the ego's view and still letting the player save the game: | ||
Line 316: | Line 316: | ||
... | ... | ||
</ | </syntaxhighlight> | ||
Logic 70 - View switching logic. It can be given any number, just make sure it's the same in the calling logic. | Logic 70 - View switching logic. It can be given any number, just make sure it's the same in the calling logic. | ||
Line 367: | Line 367: | ||
return(); | return(); | ||
</ | </syntaxhighlight> | ||
This is a better solution, because the script will have the correct views loaded when a game is restored and the script size will no increase each time the game is saved. | This is a better solution, because the script will have the correct views loaded when a game is restored and the script size will no increase each time the game is saved. |