
BEGIN ~SGPEDLER~

IF ~Global("MetPeddler","GLOBAL",0)~ THEN BEGIN 0
 SAY @0
   IF~~ THEN REPLY @1 DO ~SetGlobal("MetPeddler","GLOBAL",1)~ GOTO 1
   IF ~~ THEN REPLY @2  DO ~SetGlobal("MetPeddler","GLOBAL",1)~ GOTO 4
END

IF ~~ THEN BEGIN 1 // from: 0.0
  SAY @3 
   IF ~~ THEN REPLY @4  DO ~StartStore("SGPEDD1",LastTalkedToBy)
   SetGlobal("FinishPeddler","GLOBAL",1)
   StartDialog("SGPEDLER",Myself)~ EXIT
  IF ~~ THEN REPLY @5  GOTO 2
END

IF ~~ THEN BEGIN 2 // from: 1.3
  SAY @6 
  IF ~~ THEN DO ~EscapeArea()~ EXIT
END

IF ~~ THEN BEGIN 4 // from: 0.2
  SAY @7 
  IF ~~ THEN DO ~EscapeArea()~ EXIT
END

IF ~Global("MetPeddler","GLOBAL",1)
   Global("FinishPeddler","GLOBAL",0)~ THEN BEGIN 5 // from:
  SAY @8 
  IF ~~ THEN REPLY @9  GOTO 6
END
 
 IF ~~ THEN BEGIN 6 // from: 5.0
   SAY @10 
   IF ~Global("PeddlerStore","GLOBAL",1)~ THEN REPLY @11  DO ~StartStore("SGPEDD1",LastTalkedToBy)
 SetGlobal("FinishPeddler","GLOBAL",1)
 StartDialog("SGPEDLER",Myself)~ EXIT
   IF ~Global("PeddlerStore","GLOBAL",2)~ THEN REPLY @11  DO ~StartStore("SGPEDD2",LastTalkedToBy)
 SetGlobal("FinishPeddler","GLOBAL",1)
 StartDialog("SGPEDLER",Myself)~ EXIT
   IF ~Global("PeddlerStore","GLOBAL",3)~ THEN REPLY @11  DO ~StartStore("SGPEDD3",LastTalkedToBy)
 SetGlobal("FinishPeddler","GLOBAL",1)
 StartDialog("SGPEDLER",Myself)~ EXIT
   IF ~~ THEN REPLY @12  DO ~SetGlobal("PeddlerStore","GLOBAL",0)
 EscapeArea()~ EXIT
END
 
IF ~Global("FinishPeddler","GLOBAL",1)~ THEN BEGIN 7 // Departure
   SAY @13 
   IF ~~ THEN DO ~SetGlobal("FinishPeddler","GLOBAL",0)
 EscapeArea()~ EXIT
END