Prepare Script Error?

Started by Global Lint, Mon 27/09/2010 18:40:08

Previous topic - Next topic

Global Lint

I found an error I'm not sure how to fix, because I don't know what it refers to.  While testing my game, upon entering room 10, the game crashes, and an AGS warning box pops up and says:

"An internal error has occurred... ACI version 3.12.1074...Error: prepare_script: error -18 (no such function found in script) trying to run '1'  (Room 10)"

I have no idea what this means...

// room script file
function on_call (int reason) {
  if (Parser.Said("look")) {
    Display("You're about a field away from Pidge's house. There's a phonebooth here. The path leads west to Tom Cusack's and east back to Pidge's house.");
  }
  else if (Parser.Said("[go] east")) {
    player.ChangeRoom(9);
  }
  else if (Parser.Said("look phone")) {
    Display("It's big and red.");
  }
  else if (Parser.Said("ask brigit phone")) {
    Display("'Are you going to make a call, Pidge?'");
  }
  else if (Parser.Said("talk brigit")) {
    Display("'We could go down to the stony field and pick hazel nuts,' Brigit says.[[Pidge shakes his head. 'They won't be ripe for a long time yet. It's only August, don't forget.'");
  }
  else if (Parser.Said("go [in] booth")) {
    object[0].Visible = false;
    object[2].Visible = true;
  }
  else if (Parser.Said("exit booth")) {
    object[2].Visible = false;
    object[0].Visible = true;
  }
  else if (Parser.Said("use phone")) {
    Display("What number should I dial?");
  }
  else if (Parser.Said("dial number")) {
    Display("What number should I dial?");
  }
  else if (Parser.Said("open door")) {
      object[0].Visible = false;
    object[2].Visible = true;
  }
  else if (Parser.Said("close door")) {
    Display("It's already closed");
  }
  else if (Parser.Said("HINT")) {
    Display("DIAL 7979");
  }

  else if (Parser.Said("dial 911")) {
    Display("There's no emergency!");
  }
 
    else if (Parser.Said("dial 7979")) {
          object[0].Visible = false;
    object[2].Visible = true;
      if (player.InventoryQuantity[iPhoneActv.ID] == 0) {
    Display("Pidge dialled the number of the second-hand bookshop.");
    Wait(25);
    Display("Ring...........Ring...........");
    Wait(25);
    Display("'Hallo!' the bookseller's gruff voice came down the line, sounding cross as ever.[['Hallo. Is that the bookseller?' he asked politely.[['It is!'");
        Wait(25);
    Display("'Could I speak to the assistant?' Pidge asked.[['What assistant?'[['The old one with the white moustache.'[['What? What nonsense is this?'[['Could I please speak to the old man with the white moustache-- the scholar?'");
    Wait(25);
Display("'What scholar? What are you talking about?'[['He was there yesterday. I saw him.'[['No one works for me as an assistant.'[['But he was there yesterday.'[['Must have been a customer. A scholar you say?'[['Yes.'[['What kind of scholar?'");
        Wait(25);
        Display("Pidge crossed his fingers.[['A Latin scholar,' he said hopefully.[['I'm a scholar of Latin myself.'[['Oh!' said Pidge. 'Could you translate something?'");
        Wait(25);
        Display("'I could.'[['Well, will you?'");
        Wait(25);
    Display("'You're a boy, aren't you?'[['Yes.'[['Don't they teach you Latin in school?'");
       Wait(25);
       Display("'Not yet. I'm not old enough.'[['Are you trying to fool me into doing your homework for you?'[['Honestly! It's the summer holidays. I haven't got any homework and I don't learn latin. Honestly!' Pidge said earnestly.");
      Wait(25);
      Display("'All right, so. Fire away!'");
      Wait(25);
      Display("'Right. Here it comes,' said Pidge. He opened up the old pages and read. 'O Serpens Vilissimus! Et hic signo et his verbis Te sic securo, in Saecula Saeculorum, Amen. Patricus.'");
      Wait(25);
      Display("'That's simple!' the bookseller said loftily. 'It means: ''O most vile serpent! By this sign and these words, thus I secure thee, forever and ever, Amen, Patrick.'' Or words to that effect. Ask me another one. Go on! I'm in the mood now.'");
     Wait(25);
     Display("'I haven't got any more to ask,' Pidge said politely. 'Thank you very much for your help.'");
      Wait(25);
      Display("'Your Latin pronunciation is atrocious-- don't know what the world's coming to,' said the bookseller.'");
    Wait(25);
    Display("'Is it?'[['Are you sure there isn't any more for me to do while I'm in the mood?'[['No.'[['That's it then!'");
       Wait(25);
       Display("'There was an old man serving in your shop,' Pidge said. 'You didn't see him because you ran outside to look at 'supersonic jets or similar rubbish.''");
        Wait(25);
        Display("'Don't be so cheeky!' the bookseller said and he hung up.");
    player.AddInventory(iPhoneActv);
    Wait(25);
        object[2].Visible = false;
    object[0].Visible = true;
      }
    else if (player.InventoryQuantity[iPhoneActv.ID] == 1) {
              object[2].Visible = false;
    object[0].Visible = true;
      Display("Better not. That bookseller sounded really cross.");
    }
    }
  //ELSE
    else { NoMatch(); }
}
 
 
function room_AfterFadeIn()
{
              object[2].Visible = false;
    object[0].Visible = true;
}
Spaz ate the dopefish.

Wyz

Since I could not find any errors in that piece of code I'm going to take a guess: Check the event tab of the properties pane. See if you accidentally entered an '1' for one of the events.
Life is like an adventure without the pixel hunts.

Global Lint

There was-- seems I put a '1' in the "Enters room after fade-in" tab on accident.

Thank you!  :D

But what are those empty tabs for?  What CAN you put in them?
Spaz ate the dopefish.

Calin Leafshade

They are called 'Events'

They are functions that can be triggered when something happens.

so if you click the ... button next to 'After Fade In' or whatever its called then it will create a new function in your room script which will be run everytime the player enters the room (after the room has faded in)

Global Lint

Right, I have that covered by now, but what's with being able to type something in the box next to the event button?  There's definitely not enough space to put code there.
Spaz ate the dopefish.

Calin Leafshade

no but you can put a function name in there.. and that function will get run on the event.

Wonkyth

Clicking on the "..." button next to the space should automatically insert the function name and create a function stub in the room script file.
"But with a ninja on your face, you live longer!"

SMF spam blocked by CleanTalk