How do I avoid script buffer overflows?

From OHRRPGCE-Wiki
Jump to: navigation, search
Obsolete.png
This article (or part thereof) is obsolete. It may have made sense in the past, but it does not make sense now. It is kept here only for historic curiosity and/or posterity.

A script buffer overflow can occur if you try to load a really astonisingly large script, or if lots of scripts pile up in the buffer. This was a common concern in the old dats of the DOS version of the OHRRPGCE, when memory was scarce, but it is not a relevant concern for scripts written with the current version

Script Too Large[edit]

There is a limit to script size. However, you can split up a large script into smaller chunks (so that each chunk is below the limit) in this fashion to make it fit:


#-------------------------------------------------

plotscript,main script,begin
  sub script A
  sub script B
  sub script C
end

#-------------------------------------------------

script,sub script A,begin
  # first part of the large script
  # ...
end

#-------------------------------------------------

script,sub script B,begin
  # second part of the large script
  # ...
end

#-------------------------------------------------

script,sub script C,begin
  # final part of the large script
  # ...
end

Don't link to the next part of the script directly from the last, because that way the last part would stay in memory, and you would be no better off.

Scripts Pile Up[edit]

Obsolete.png
This article (or part thereof) is obsolete. It may have made sense in the past, but it does not make sense now. It is kept here only for historic curiosity and/or posterity.

A script might not be running at the moment, but it could still be loaded and wasting space if it didn't finish running last time.

To tell if your scripts are piling up in the buffer, hit F10 while playtesting to access the script-debugging mode. The blue bar at the top of the screen shows the state of the buffer. By looking at the second number in each column, the id number of a script currently in the buffer, you can find out if your scripts are still loaded after you had expected them to finish.

Scripts are unloaded after they finish, so if this is the case, either a new script is executed before an old one can complete, or your scripts aren't completing as you want them to.

One reason your script might be piling up is because of a dangerously written on-keypress script

See Also[edit]