Parse error in GlobalInt code

Started by Anarcho, Fri 21/01/2005 00:46:58

Previous topic - Next topic

Anarcho

I'm getting a parse error on this long scrip here.  It's at the 2nd "else" in line 37.  I think I definitely don't have the brackets right.  This is my first experience trying to do a long GlobalInt code.  I'm obviously not doing it right.

CODE:

#sectionstart hotspot7_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot7_a() {
  // script for hotspot7: Interact hotspot

  if (GetGlobalInt(79) == 0) { // if player hasn't gotten stack of coupons yet (GlobalInts are initially 0)
    DisplaySpeech(EGO, "I've killed almost everyone I know.  There's no one left to call.");
  }
  else {
    if (GetGlobalInt(79) == 1) // if player has gotten stack of coupons and looked at them
 
    DisplaySpeech(EGO, "Hello.  I would like to make an order for delivery.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "Oh, uh...hey, what's our address?");
    DisplaySpeech(COOP, "132 Lamplighter Drive.");
    DisplaySpeech(EGO, "132 Lamplighter Drive.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "Yes, it's the asylum,");
    DisplaySpeech(EGO, "No, this is not a joke.  Now take my order or face my wrath!");
    DisplaySpeech(EGO, "Ok.  I would like to order 763 Megawich Sandwiches.");
    DisplaySpeech(EGO, "If you hang up on me, I will come down there and cut you!");
    DisplaySpeech(EGO, "I'm serious. I have 763 coupons that entitle me to free...");
    DisplaySpeech(EGO, "No, it doesn't say one coupon per customer.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "Well you should have thought about that before you printed out the coupons.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "So will you deliver my sandwiches or not?  Yes?  Good.  And they better get here in ten minutes.");
    DisplaySpeech(EGO, "What?  No!  All right.  Fine!  15 minutes.");
    DisplaySpeech(COOP, "Having a pizza party?");
    DisplaySpeech(EGO, "Not exactly.");
   
    SetGlobalInt(79,0);
    }
   
  else { //
    if (GetGlobalInt(79) == 2) { // Talked to Steve about failed delivery of food
 
 
    DisplaySpeech(EGO, "I need to use the phone again.");
    DisplaySpeech(COOP, "Ok.");
    DisplaySpeech(EGO, "Yes, hello.  I placed an order for sandwiches, and I think you tried to deliver them but...");
    DisplaySpeech(EGO, "Yeah, he is a jerk.  I don't know what his problem is.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "Well I didn't know about the "no delivery" policy.");
    DisplaySpeech(EGO, "...");
    DisplaySpeech(EGO, "Yes, I still want the sandwiches.  I'll just have to figure out some other place for you to deliver them.");
    DisplaySpeech(EGO, "Ok, yes. I'll call back when I have it figured out.");
   
    SetGlobalInt(79,3);
    }
   
   
  else { //
    if (GetGlobalInt(79) == 3) { // Figuring out how to deliver food
 
    DisplaySpeech(EGO, "I still don't know how to get the sandwich deliveries into the building.");
    DisplaySpeech(EGO, "I'll call them back once I have it figured out.");
    }
       
   
  else { //
    if (GetGlobalInt(79) == 4) { // Calling back MegaWich with solution
 
    DisplaySpeech(EGO, "Hello, yes, it's me again.  I have it figured out.");
    DisplaySpeech(EGO, "Come to the south side of the building.  There's an open window.  You can deliver the sandwiches there.");
   
    SetGlobalInt(79,0);
   
         }
       }
     }
   }
}


Goot

#1
Quoteif (GetGlobalInt(79) == 1) // if player has gotten stack of coupons and looked at them
There should be a bracket after ==1).

Also, I think you might not be using "else if" right. You can do:
if(GetGlobalInt(x)==x){
script here;
}
else if(GetGlobalInt(x)==x){
script here;
}
else{
script here;
}

SMF spam blocked by CleanTalk