BEGIN Kido

IF ~NumTimesTalkedTo(0)~ THEN BEGIN FirstMeeting
  SAY @0 
  IF ~~ THEN REPLY @1 GOTO Disagree
  IF ~~ THEN REPLY @2 GOTO Agree
  IF ~!InParty("Keldorn")~ THEN REPLY @3 GOTO Greet
  IF ~InParty("Keldorn")~ THEN REPLY @3 EXTERN KELDORJ KelnlKi
  IF ~~ THEN REPLY @4 GOTO GoAway
END

IF ~~ THEN BEGIN Disagree
  SAY @5
  IF ~~ THEN REPLY @6 GOTO Agree 
  IF ~!InParty("Keldorn")~ THEN REPLY @7 GOTO Greet
  IF ~InParty("Keldorn")~ THEN REPLY @7 EXTERN KELDORJ KelnlKi
  IF ~~ THEN REPLY @8 GOTO GoAway
END

IF ~~ THEN BEGIN Agree
  SAY @9
  IF ~~ THEN REPLY @10 GOTO Greet
  IF ~!InParty("Keldorn")~ THEN REPLY @11 GOTO Greet
  IF ~InParty("Keldorn")~ THEN REPLY @11 EXTERN KELDORJ KelnlKi
  IF ~~ THEN REPLY @12 GOTO Disappointed
END

IF ~~ THEN BEGIN Disappointed
  SAY @13
  IF ~!InParty("Keldorn")~ THEN REPLY @14 GOTO Greet
  IF ~InParty("Keldorn")~ THEN REPLY @14 EXTERN KELDORJ KelnlKi
  IF ~~ THEN REPLY @15 GOTO GoAway
END

IF ~~ THEN BEGIN Greet
  SAY @16
  IF ~~ THEN REPLY @17 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
  IF ~~ THEN REPLY @18 GOTO Takearisk
  IF ~~ THEN REPLY @19 GOTO AbruptEnd
END

IF ~~ THEN BEGIN Takearisk 
  SAY @20
  IF ~~ THEN REPLY @21 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
  IF ~~ THEN REPLY @22 GOTO AbruptEnd
END

IF ~~ THEN BEGIN GoAway
  SAY @23
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN AbruptEnd
  SAY @24
  IF ~~ THEN EXIT
END

IF ~NumTimesTalkedToGT(0)~ THEN BEGIN liftspirit
  SAY @25 
  IF ~~ THEN REPLY @26 GOTO Nah
  IF ~~ THEN REPLY @27 GOTO Askaway 
  IF ~~ THEN REPLY @28 GOTO Leave
END

IF ~~ THEN BEGIN Nah
  SAY @29
  IF ~~ THEN REPLY @30 GOTO Nodebate
  IF ~CheckStatGT(PLAYER1,12,CHR)~ THEN REPLY @31 GOTO Pojoin
  IF ~~ THEN REPLY @32 GOTO Askaway
END

IF ~~ THEN BEGIN Pojoin
  SAY @33
  IF ~~ THEN REPLY @34 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
  IF ~~ THEN REPLY @35 GOTO Turndown
END

IF ~~ THEN BEGIN Askaway
  SAY @36
  IF ~~ THEN REPLY @37 GOTO WaJoin
  IF ~~ THEN REPLY @38 GOTO Loveto
  IF ~~ THEN REPLY @39 GOTO AbruptEnd
END

IF ~~ THEN BEGIN WaJoin
  SAY @40 
  IF ~~ THEN REPLY @41 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
  IF ~~ THEN REPLY @42 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
  IF ~~ THEN REPLY @43 GOTO AbruptEnd
END

IF ~~ THEN BEGIN Loveto
  SAY @44 
  IF ~~ THEN REPLY @45 DO ~SetGlobal("KidoJoined","LOCALS",1)
JoinParty()~ EXIT
END

IF ~~ THEN BEGIN Leave
  SAY @46
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Nodebate
  SAY @47
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Turndown
  SAY @48
  IF ~~ THEN EXIT
END

APPEND KELDORJ
IF ~Global("KelnlKid","GLOBAL",0)
  See("Player1")
  !StateCheck("Player1",STATE_SLEEPING)~ THEN KelnlKi
 SAY @49
  IF ~~ THEN DO ~SetGlobal("KelnlKid","GLOBAL",1)~ EXTERN KIDO Greet
END
END