Difference between revisions of "AGIWiki/Memory and Script"

Jump to navigation Jump to search
m
Text replacement - "<source lang=" to "<syntaxhighlight lang="
m (corrected syntax -> source)
m (Text replacement - "<source lang=" to "<syntaxhighlight lang=")
Line 256: Line 256:
However, script blocking is useful for small bits of code that don't allow the player to save or restore in between:
However, script blocking is useful for small bits of code that don't allow the player to save or restore in between:


<source lang="cpp">
<syntaxhighlight lang="cpp">
#define script_blocked f7
#define script_blocked f7
   
   
Line 276: Line 276:


The script works like this (you wouldn't use this in a game):
The script works like this (you wouldn't use this in a game):
<source lang="cpp">
<syntaxhighlight lang="cpp">
  load.view(10); // script contains view 10
  load.view(10); // script contains view 10
  push.script();
  push.script();
Line 283: Line 283:
</source>
</source>
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):
<source lang="cpp">
<syntaxhighlight lang="cpp">
  if (new_room)
  if (new_room)
  {
  {
Line 303: Line 303:


In the room logic (will be needed in all rooms):
In the room logic (will be needed in all rooms):
<source lang="cpp">
<syntaxhighlight lang="cpp">
  if (new_room)
  if (new_room)
  {
  {
Line 319: Line 319:
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.


<source lang="cpp">
<syntaxhighlight lang="cpp">
#include "defines.txt"
#include "defines.txt"
   
   
TrustedUser
2,147

edits

Navigation menu