IMPORTANT: template game fix

Joel If you're basing your game off the updated template game, there is a bug in it which causes you to run out of memory if you use the tp command (thanks go to Andrew_Baker for pointing this out).

Open logic.000 and find the code that reads:

if (new_room) { // First interpreter cycle in a new room
// Note: Everything other than logic 0 is discarded
// from memory when new.room is executed
load.logics(90); // Load game specific functions logic into memory
clear.lines(24,24,0); // clear bottom line of screen (remove ego's coords if shown)
animate.obj(ego);
load.view.v(ego_view_no);
set.view.v(ego, ego_view_no);
observe.objs(ego);
old_clock_seconds = 255; // make sure clock gets updated this cycle
// on this cycle (if turned on)
}


Then change it to this:

if (new_room) { // First interpreter cycle in a new room
// Note: Everything other than logic 0 is discarded
// from memory when new.room is executed
load.logics(90); // Load game specific functions logic into memory
if (debug_active)
{
load.logics(99); // load debug logic into memory
}
clear.lines(24,24,0); // clear bottom line of screen (remove ego's coords if shown)
animate.obj(ego);
load.view.v(ego_view_no);
set.view.v(ego, ego_view_no);
observe.objs(ego);
old_clock_seconds = 255; // make sure clock gets updated this cycle
// on this cycle (if turned on)
}


As far as I can tell, this fixes the problem.

This only needs to be done if you are using the UPDATED template game. If you are using the template game that ships with AGI Studio 1.31, then you should not have to do this.
Joel Something else that leaks memory, and this one occurs in both the updated template game AND the AGI Studio 1.31 template game...if you type "tp" and then just press enter or you enter 0 for your destination. This problem isn't quite as severe, since it's something that's done less commonly, but a possible fix is to go into the debug logic (99) and change the "tp" handler so that it looks like this:


if (said("tp")) {
get.num("new room: ", v255);

if (v255 == 0)
{
print("Can't tp to room 0.");
}
else
{
new.room.v(v255);
}
}
AGI1122 I will go ahead and update the template game and give it to Nailhead for AGI Studio and put it up on my site.