Memory errors and other questions

PhilN I'm working on an AGI game arcade sequence and keep running into the "out of memory" error. I'm assuming the size of my views are the culprit. However, I need all of them.

I tried unloading views from memory after erasing the objects, but it said something to the effect of it could not unload the view when the memory was erased. Does this make any sense?

Does it matter if I load 1 view with 2 loops or 2 views with 1 loop each?

Do any of you have tips and tricks to maximizing the ability of memory resources?

Also, when I use the move command sometimes the objects simply vanish rather than move to the assigned location. I experimented with this bug and noticed that they would move if I changed the destination to be to the right of the current position (increment x value), but the minute I changed it back to the left of the current position (decrement x value) the object would simply disappear from the screen. Frustrated, I finally gave up and used a looping command instead. Have any of you experienced this before and know what could be causing it?

Lastly, I have code to display and move an object working properly in some scenes. However, every now and then when I add another loop to the view, and change the code to display the object as the second loop instead of the first, the object will still display the first loop. Nowhere else in the code am I assigning loop numbers to this object, so in theory it should display the second loop, yet it shows the first. I had to separate them into 2 views in order to get things working again. Have any of you experienced this before and do you know why this is happening?

Andrew_Baker Uh, that's a lot of questions, so I'll start off with one I know.

In the case of objects that disappear when turning left, do they have a second, blank loop? If so then I think it's this blank loop that displays when animated objects move to the left (It's something like 1-right 2- left 3-up 4-down).

In the case of set.loops, check the same. You may be setting it to a loop, but then moving it in a dierection, which would cause the loop to automatically change. There is a command to stop the object from changing loops that must be used right after setting the loop you wish the ojbect to use.
sonneveld Sorry I took a while to reply. I'm lazy.

re: memory

It's a bit old but it's got a bit of info on memory 'n scripts. (somebody remind me to update it one day hey?)

Two things to remember:

1) Memory is stack based so you gotta unload stuff in the reverse order you loaded it.
2) Anything you load/unload, it'll be added to something called a script which is read during the save game procedures (to know which resources are loaded in what order)

If you want to be able to unloaded memeory resources, make sure those particular ones are loaded LAST. Also, you'll need to "disable" scripts or the script will fill up pretty quickly. The script docs have example code on how to do that.


re: moving objects that disappear.

I'm assuming you're using move.obj.v() ? There's a bug in the AGI Studio compiler where it thinks the step size isn't a variable but a constant number. so if you step the step size to 3, the interpreter will use the number stored in variable 3.


re: loops.

AGI lets you automatically set the loop depending on the direction of movement for an animated object. However, for most v2 interpreters and later v3, it only honours this if there's 4 or LESS loops in the view. Early v3 and v2.936 (?) don't honour this, and is why you get comments about strange moonwalking in Kings Quest 4 running under Sarien.

I hope this helps and doesn't put u off.

- Nick
PhilN Hey Thanks a lot for responding!

Your answers made a lot of sense. Wow, you sure know a lot about this stuff. This will really help.

re:Move -- I did use "move.obj.v" at first, but I was aware of the "variable bug" for speed. It still wasn't working properly so I used to "move.obj" instead to troubleshoot and it still gave me the same problem -- the object would simply disappear rather than move left (however, it would move right just fine). Unable to figure this one out, I used a looping "" command instead.
PhilN It looks like what's happening is that when I "move.obj.v" or "move.obj" in order to move an object left, it automatically reverts to the same cel but on loop0. Is there a way I can prevent this from automatically happening?
Andrew_Baker Uh, it's supposed to automatically revert to that loop. It's a built-in shorthand, so you don't have to write code to make the animated object face the proper direction. Check AGI Studio's help file. Cris Cromer outlined all of the functions in AGI and documented them very well. I don't remember the specific commands, but you can lock an object into one loop if you want to.