Script Buffer Overflow Error

From AGI Wiki
Jump to: navigation, search

A script buffer overflow error occurs when the script buffer has run out of room. The error message looks like the following:


"Script buffer overflow. Maximum size = v18 Press ESC to quit.", where "v18" is replaced with the value of v18 (see special variables).

Fortunately, there are ways to deal with a script buffer overflow. The simplest solution is to increase the script buffer size by issuing the script.size command at the beginning of logic 0 before doing anything that might add to the script buffer (the script.size command clears the script buffer, so bad things can happen if it isn't empty when script.size is called).

Simply increasing the script buffer size may not stop the error, though. If the problem is that your code is repeatedly loading and discarding resources or overlaying pictures, increasing the script buffer size may simply make it take longer for the overflow to occur. In this case, a better approach is to figure out why the script buffer overflow is occurring in the first place. The Memory and Script article can help you do this.