Author Topic: IMPORTANT: template game fix  (Read 2127 times)

0 Members and 1 Guest are viewing this topic.

Offline Joel

IMPORTANT: template game fix
« on: October 11, 2002, 11:40:37 AM »
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:
Code: [Select]
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:
Code: [Select]
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.



Offline Joel

Re:IMPORTANT: template game fix
« Reply #1 on: October 11, 2002, 06:48:45 PM »
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:

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

  if (v255 == 0)
  {
    print("Can't tp to room 0.");
  }
  else
  {
    new.room.v(v255);
  }
}

Offline Chris Cromer

Re:IMPORTANT: template game fix
« Reply #2 on: October 12, 2002, 04:23:38 AM »
I will go ahead and update the template game and give it to Nailhead for AGI Studio and put it up on my site.
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.052 seconds with 21 queries.