Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: goopscoop on Sat 14/02/2015 19:55:32

Title: Buffer exceeded in randomization script (solved)
Post by: goopscoop on Sat 14/02/2015 19:55:32
I've been pouring over this code for an hour and can't figure out why it's not working. When I attempt to launch the game, the error reads: "Error (line 36): buffer exceeded: You probably have a missing bracket on the previous line."

Here's the code: ()

Code (ags) Select

function room_RepExec()
{
  int i;
  if(IsTimerExpired(1)) {
    i = Random(5);
    if (i == 0) cKeymaster.SayBackground("Psst. I think you dropped something."); // <-- line 36
    else if (i == 1) cKeymaster.SayBackground("Hey you, could ya help me out here?");
    else if (i == 2) cKeymaster.SayBackground("I'm lost, could you give me directions?");
    else if (i == 3) cKeymaster.SayBackground("I'm looking for my cat, Snuggles. Could you help me look?");
    else if (i == 4) cKeymaster.SayBackground("Don't be a jerk.");
    else cKeymaster.SayBackground("You've lost that lovin' feelin'. Let's look for it together.");
    SetTimer(1, 400);
    }
}
Title: Re: Buffer exceeded in randomization script
Post by: Snarky on Sat 14/02/2015 20:12:15
Hmmm, odd. The "buffer exceeded" must be the queue of background messages, (NOPE!) but the code looks correct in only adding a message to the queue every ten seconds. Have you tried SayBackground() outside of this script just to confirm that works? Does the module require you to set some parameter (like the queue size?) before you can use it?
Title: Re: Buffer exceeded in randomization script
Post by: goopscoop on Sat 14/02/2015 20:31:40
This is really strange. I removed the script entirely and the error returned on a different line. :confused: I've already gone through the entire room line by line and can't find an issue. Here's the new message: Error (Line 42): buffer exceeded: you probably have a missing bracket on the previous line.

Here's where the error is appearing now:

Code (ags) Select

function room_LeaveTop()
{
  player.ChangeRoom(3, 35, 194);
}

//objects & hotspots

function hHotspot1_Look()
{
  player.Say("Everything's charred inside."); // < -- error is appearing here now...
}
Title: Re: Buffer exceeded in randomization script
Post by: Snarky on Sat 14/02/2015 20:36:20
Could you post the whole script? There's probably a typo somewhere.
Title: Re: Buffer exceeded in randomization script
Post by: goopscoop on Sat 14/02/2015 22:35:51
Oh gosh, I found the typo. I feel like an idiot after spending so much time going over the code. About 10 lines up I forgot a parenthesis. I guess I just needed fresh eyes to look it over again.

Anyway, thanks for offering to help. I really appreciate it.:smiley: