define HI 125   //    Y'ello
define WHOAMI 126  //     VOICE: Gleppheo, Do you know who this is?
define DAD 127   //    Oh shoot...
define DAD2 153   //    ...Dad, I swear don't trust channel 6!
define NAME 128  //     VOICE: My name is Nilanth...
define WHATISAY 129  //     ....if you want to live...
define WHATISAY2 154  //     ...you must do as I say.
define OK 130   //    Understood.
define CAVES 131  //     Voice: Beneath City Hall...
define CAVES2 155  //     ...there are some caves...
define SHIP 132   //    ...with an old ship of ours...
define SHIP2 156   //    ...in quarantine. Then...
define GETMANUAL 133  //     ...go to Rent-A-Book to get...
define GETMANUAL2 157  //     ...a copy of the manual...
define GETBATTERY 134  //     ...from there you must...
define GETBATTERY2 158  //     ...retrieve a car battery...
define POWER 135   //    ...to power the ship. You...
define POWER2 159   //    ...must then retrieve...
define GETSTICK 136   //    ...a replacement joystick. Good luck...
define END 137   //    ...and watch the doorstep.

// #$% = ^
define PHONE1 161
define PHONE2 162
define PHONE3 163
define PHONE4 164
define PHONE5 165

define GOTOSTORE 138   //    Hmmm I think I should head to the store.
define GOTORENT 139   //    Don't I need to be at Rent-A-Book?
define GOTOBATTERY 150  //     I should really get that battery.
define GOTOSTICK 151   //    Probably time to get that joystick.
define GOTOCITYHALL 140  //     I think it's time to head to City Hall.
define DONTGOTHERE 141  //     Nope, don't think I am headed that way yet.

define LIBRARYCARD 142  //     God I hope they don't ask for a Library Card.
define LIBRARYCARD2 160  //     God I hope they don't ask for a Library Card.

define READBOOK 143   //    ::Read Book::
define SOSIMPLE 144  //     Wow, all that time... it was so simple!
define BLOWCAR 145   //    Hmmm, I think I might need to blow it up.
define BADIDEA 146  //     Awe crap, maybe that was a bad idea!!!
define TAKEBATTERY 152   //    ::TAKE BATTERY::
define GOTBATTERY 147  //     At least I got the battery.
define TAKESTICK 148   //    ::TAKE JOYSTICK::
define GOTSTICK 149   //    Sorry to steal, but I do need this!



gamevar GOTBOOK 0 1
gamevar GOTBAT 0 1
gamevar GOTJOY 0 1
gamevar MESSAGE 0 1
gamevar PHONECOUNTER 0 2


define TEXTER 5466
define BOOKHIGHLIGHTER 5467
define JOYSTICK 5468
define CARBATTERY 5469
define EXPLODER 5470


action NONETEXTER 0 1 1 1 1
action NONETEXTER2 0 1 1 1 1
action NONETEXTER3 0 1 1 1 120
useractor notenemy TEXTER 0
ifaction 0 { cstat 32768 action NONETEXTER }
getactor[THISACTOR].hitag MHITAG
getplayer[THISACTOR].cursectnum TEMP
getactor[THISACTOR].sectnum TEMP2
ifvarvare TEMP TEMP2
{
 ifvare MHITAG 1
 {
  ifaction NONETEXTER { action NONETEXTER3 setvar PHONECOUNTER 0 }
  setvar TEMP 15
  lockplayer TEMP
  addvar PHONECOUNTER 1
  ifvarl PHONECOUNTER 6 { quote PHONE2 }
  else ifvarl PHONECOUNTER 9 { quote PHONE3 }
  else ifvarl PHONECOUNTER 15 { quote PHONE4 }
  else ifvarl PHONECOUNTER 19 { quote PHONE5 }
  else { quote PHONE2 }
  setvar TEMP 0
  setplayer[THISACTOR].curr_weapon TEMP

  ifactioncount 4 { soundonce PHONES001 quote HI }
  ifactioncount 6 { stopsound PHONES001 soundonce PHONES002 quote WHOAMI }
  ifactioncount 8 { stopsound PHONES002 stopsound PHONES001 soundonce PHONES003  quote DAD }
  ifactioncount 10 { quote DAD2 }
  ifactioncount 12 { stopsound PHONES003 stopsound PHONES002 stopsound PHONES001 soundonce PHONES004 quote NAME }
  ifactioncount 14 { quote WHATISAY }
  ifactioncount 16 { quote WHATISAY2 }
  ifactioncount 18 { stopsound PHONES004 stopsound PHONES003 stopsound PHONES002 stopsound PHONES001 soundonce PHONES005 quote OK }
  ifactioncount 20 { stopsound PHONES005 stopsound PHONES004 stopsound PHONES003 stopsound PHONES002 stopsound PHONES001 soundonce PHONES006 quote CAVES }
  ifactioncount 22 { quote CAVES2 }
  ifactioncount 24 { quote SHIP }
  ifactioncount 26 { quote SHIP2 }
  ifactioncount 28 { quote GETMANUAL }
  ifactioncount 30 { quote GETMANUAL2 }
  ifactioncount 32 { quote GETBATTERY }
  ifactioncount 34 { quote GETBATTERY2 }
  ifactioncount 36 { quote POWER }
  ifactioncount 38 { quote POWER2 }
  ifactioncount 40 { ifvarl PHONECOUNTER 11024 { ifvarg PHONECOUNTER 16 { setvar PHONECOUNTER 0 } } quote GETSTICK }
  ifactioncount 42 { quote END stopsound PHONES006 stopsound PHONES005 stopsound PHONES004 stopsound PHONES003 stopsound PHONES002 stopsound PHONES001 }
  else   ifactioncount 43 {
  stopsound PHONES006 stopsound PHONES005 stopsound PHONES004 stopsound PHONES003 stopsound PHONES002 stopsound PHONES001
    }
  ifactioncount 44
  {
  stopsound PHONES006
  stopsound PHONES005
  stopsound PHONES004
  stopsound PHONES003
  stopsound PHONES002
  stopsound PHONES001
  ifvarl PHONECOUNTER 3 { quote PHONE2 }
  else ifvarl PHONECOUNTER 6 { quote PHONE5 }
  else ifvarl PHONECOUNTER 12 { quote PHONE4 }
  else ifvarl PHONECOUNTER 16 { quote PHONE3 setvar PHONECOUNTER 11024 }
  else { quote PHONE2 }
  }

  ifactioncount 46 {
  setvar TEMP 6
  setplayer[THISACTOR].curr_weapon TEMP

   setvar MESSAGE 1 killit }
 }
 else ifvare MHITAG 2
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   ifvare MESSAGE 0 { quote GOTOSTORE }
   else ifvare GOTBOOK 0 { quote GOTORENT }
   else ifvare GOTBAT 0 { quote GOTOBATTERY }
   else ifvare GOTJOY 0 { quote GOTOSTICK }
   else { quote GOTOCITYHALL }
   action NONETEXTER
  }
  ifvare MESSAGE 1 { killit }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 3
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   ifvare MESSAGE 0 { quote GOTOSTORE }
   else ifvare GOTBOOK 0 { quote GOTORENT }
   else ifvare GOTBAT 0 { quote GOTOBATTERY }
   else ifvare GOTJOY 0 { quote GOTOSTICK }
   else { quote GOTOCITYHALL }
   action NONETEXTER
  }
  ifvare GOTBOOK 1 { killit }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 4
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   ifvare MESSAGE 0 { quote GOTOSTORE }
   else ifvare GOTBOOK 0 { quote GOTORENT }
   else ifvare GOTBAT 0 { quote GOTOBATTERY }
   else ifvare GOTJOY 0 { quote GOTOSTICK }
   else { quote GOTOCITYHALL }
   action NONETEXTER
  }
  ifvare GOTBAT 1 { killit }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 5
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   ifvare MESSAGE 0 { quote GOTOSTORE }
   else ifvare GOTBOOK 0 { quote GOTORENT }
   else ifvare GOTBAT 0 { quote GOTOBATTERY }
   else ifvare GOTJOY 0 { quote GOTOSTICK }
   else { quote GOTOCITYHALL }
   action NONETEXTER
  }
  ifvare GOTJOY 1 { killit }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 6
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   ifvare MESSAGE 0 { quote GOTOSTORE }
   else ifvare GOTBOOK 0 { quote GOTORENT }
   else ifvare GOTBAT 0 { quote GOTOBATTERY }
   else ifvare GOTJOY 0 { quote GOTOSTICK }
   else { quote GOTOCITYHALL }
   action NONETEXTER
  }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 7
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   quote DONTGOTHERE
   action NONETEXTER
  }
  getactor[THISACTOR].ang TEMP
  setplayer[THISACTOR].ang TEMP

 }
 else ifvare MHITAG 8
 {
    ifaction NONETEXTER { action NONETEXTER2 }
  ifactioncount 1
  {
   quote BLOWCAR
   action NONETEXTER
   killit
  }

 }

}
enda


useractor notenemy BOOKHIGHLIGHTER 0
ifaction 0 { cstat 32768 cstator 16 spritepal 12 action NONETEXTER }
ifspritepal 12
{
ifpdistl 1536 ifp pfacing
{
cstat 18
quote READBOOK
ifhitspace { palfrom 23 20 40 0 quote LIBRARYCARD spritepal 13 action NONETEXTER break }
}
else { cstat 32768 cstator 16 }
}
ifspritepal 13
{
cstat 18
ifactioncount 60 { setvar GOTBOOK 1 quote LIBRARYCARD2 spritepal 4 action NONETEXTER break }
}
ifspritepal 4
{
cstat 16
ifactioncount 120 { setvar GOTBOOK 1 spritepal 4 cstat 16 ifvare TEMP 0 { quote SOSIMPLE setvar TEMP 1 } }
}
enda

useractor notenemy CARBATTERY 0
ifaction 0 { sizeat 29 29 quote BADIDEA cstat 1 action NONETEXTER }
ifaction NONETEXTER
{
 ifspritepal 13
 {
  cstat 32768
  ifactioncount 10 { setvar GOTBAT 1 quote GOTBATTERY killit }
 }
 else ifpdistl 1024
 {
  spritepal 1
  quote TAKEBATTERY
  ifhitspace { palfrom 23 20 40 0 spritepal 13 action NONETEXTER break }
 }
 else
 {
  spritepal 0
 }

}

enda

useractor notenemy JOYSTICK 0
ifaction 0 { cstat 1 action NONETEXTER }
ifaction NONETEXTER
{
 ifspritepal 13
 {
  cstat 32768
  ifactioncount 10 { soundonce TALK002 setvar GOTJOY 1 quote GOTSTICK killit }
 }
 else ifpdistl 1024
 {
  spritepal 1
  quote TAKESTICK
  ifhitspace { palfrom 23 20 40 0 spritepal 13 action NONETEXTER break }
 }
 else
 {
  spritepal 0
 }

}

enda

useractor notenemy EXPLODER 1
ifaction 0 { cstat 32768 action NONETEXTER }
ifspritepal 3 { ifvare GOTJOY 0 { break } }
ifvare GOTBOOK 0 { break }
cstator 256
getactor[THISACTOR].hitag TEMP

ifvare TEMP2 1
{
ifaction NONETEXTER { action NONETEXTER2 }
ifaction NONETEXTER2 { ifactioncount 50 { spawn CARBATTERY killit } }
break
}

ifhitweapon
{
ifwasweapon SHRINKSPARK { hitradius 1548 100 100 100 100 spawn EXPLOSION2 ifvare TEMP 0 { killit } setvar TEMP2 1 }
else ifwasweapon RADIUSEXPLOSION { hitradius 1548 100 100 100 100 spawn EXPLOSION2 ifvare TEMP 0 { killit } setvar TEMP2 1 }
else { strength 1 }
}

enda

define PHONEACTOR 5471
useractor notenemy PHONEACTOR 0
ifaction 0 { action NONETEXTER }
soundonce PHONERING
ifpdistl 1024 { killit }
enda


define CIVIE 3850

action CIVNONE 0 1 5 1 1
action CIVCOWER 20 4 5 1 7
action CIVDYING 40 9 1 1 7
action CIVDEAD 48 1 1 1 1
action CIVHIT 40 1 1 1 1
useractor notenemy CIVIE 100
ifrnd 24 { move 0 faceplayerslow }
else ifrnd 4 { move 0 spin }
else ifrnd 24 { move 0 }
ifdead
{
cstat 0
 ifhitweapon
  {
    ifwasweapon RADIUSEXPLOSION
     { guts JIBS1 2 guts JIBS2 2 guts JIBS3 2 guts JIBS4 2 guts JIBS5 2 guts JIBS6 16 killit }
    else ifwasweapon RPG
     { guts JIBS1 2 guts JIBS2 2 guts JIBS3 2 guts JIBS4 2 guts JIBS5 2 guts JIBS6 16 killit }
  }
 ifaction CIVDEAD { }
 else ifaction CIVDYING { ifactioncount 9 { action CIVDEAD spawn BLOODPOOL } }
 else { soundonce CIVDIESOUND action CIVDYING }
break
}

cstat 257

ifpdistl 2448
{
ifaction CIVCOWER { } else { action CIVCOWER }
 ifrnd 64
 {
 ifrnd 4 { soundonce CIVSOUND1 }
 else ifrnd 4 { soundonce CIVSOUND2 }
 else ifrnd 4 { soundonce CIVSOUND3 }
 else ifrnd 4 { soundonce CIVSOUND4 }
 }
}
else { action CIVNONE }

ifhitweapon { soundonce CIVHITSOUND action CIVHIT guts JIBS6 2 }
enda

define ENDTHISGAME 166
define ENDER 5472

useractor notenemy ENDER 0
ifaction 0 { cstat 32768 action NONETEXTER }

ifaction NONETEXTER ifpdistl 1024 ifp pfacing
{
 quote ENDTHISGAME
 ifhitspace { endofgame 12 action NONETEXTER2 }
}
ifaction NONETEXTER2 { }
enda








