SCENE 205	;conference room scene
#include proxbeta.txt
END

SCENE	206
	MUSIC Star_Wars_Duel_Of_The_Fates
	THEME 0
	ACTOR 1, "Demonica", Demonica, 1, 5, 90
	1: Hah! You think you and your measly party can defeat me!
	1: Pitiful fools!
	1: Prepare to die!
	MOVE 1, -200, -200, 1
	LOCK 1
	#include Determine.txt
	END
@fight0
	FIGHT2 255
	IF WON @iwon
	END
@fight1
	FIGHT2 255, -#<slot1>
	IF WON @iwon
	END
@fight2
	FIGHT2 255, -#<slot1>, -#<slot2>
	IF WON @iwon
	END
@fight3
	FIGHT2 255, -#<slot1>, -#<slot2>, -#<slot3>
	IF WON @iwon
	END
@fight4
	FIGHT2 255, -#<slot1>, -#<slot2>, -#<slot3>, -#<slot4>
	IF WON @iwon
	END
@fight5
	FIGHT2 255, -#<slot1>, -#<slot2>, -#<slot3>, -#<slot4>, -#<slot5>
	IF WON @iwon
	END

@iwon
	MOVE 1, 5, 90
	SEL 1
	POSE 3,3,3
	1: NOOOOOOoooo!
	1: I shall return!
	1: Someone shall, one day, summon me back.
	1: You haven't destroyed me!
	MOVE 1, 1000, 1000, 1
	GIVE T303
END
;----------------------------------------------------------------------------------------------------------------------------

SCENE 207	check1, CUT
	ACTOR 1, "Tour Guide", tele, 7, 5, 90
	MUSIC #silence
	BKGND water2
	THEME 5
	WEATHER 0
	FX 5
	1: Welcome to the Tour of Demonica.
	1: This tour will explain some of the questions you might have.
	1: If you want to exit the tour, you can do so at any time by pressing exit.
	1: The Tour will begin now...
	BKGND campsite
	THEME 4
	FX 0
	ACTOR 2, "Scene Toolbar",	Tour,	1,22,61
	ACTOR 3, "Scene Toolbar",	Tour,	3,-1000,-1000
	ACTOR 4, "Scene Toolbar",	Tour,	2,-1000,-1000
	ACTOR 5, "Scene Toolbar",	Tour,	4,-1000,-1000
	1: This is the camp scene.
	1: See the toolbar in the upper left?
	1: It consists of four buttons.
	1: They each do something different.
	1: When you are camped, try it out.
	1: I will show you how to use it.
	1: I will show each step for a few seconds before moving on.
	1: Follow the RED CURSOR as you watch the instructions.
	1: First, move the cursor to a button.  In this case, we'll use the green button.
	MOVE 2, -1000, -1000, 1
	MOVE 3, 22, 61, 1
	WAIT 7.0
	1: Next, RIGHT-Click the button.
	MOVE 3, -1000, -1000, 1
	MOVE 4, 22, 61, 1
	WAIT 7.0
	1: Third, select the item you want from the menu.
	MOVE 4, -1000, -1000, 1
	MOVE 5, 22, 61, 1
	WAIT 7.0
	MOVE 5, -1000, -1000, 1
	BKGND water1
	THEME 5
	FX 5
	1: Now, some frequenly asked questions.
	1: One of the most commonly asked questions is, "What does IC mean?"
	1: IC stands for Iron Coins.
	1: Iron Coins are used as currency in Flamelord's Second Earth series because iron is rarer than gold where the worlds take place.
	1: Another commonly aske questions is, "Why is there a demo for another world here?"
	1: The answer is quite simple.  The demo is there because that gives you a preview of the next world in the series.
	1: That is all for the Frequently Asked Questions section.
	WAIT 3.0
	BKGND check1
	THEME 0
	FX 0
	WEATHER 0
	1: "Special Thanks" Time!
	1: Thanks to Silver for the art in the files tele.bmp, proxbeta.bmp and several monster skins.
	1: Thanks to Pippin Took for the World Map that I didn't end up using.
	1: Thanks to Silver for some scene scripts, most of which normal players will never see.
	1: And many thanks to anyone who I have forgotten to mention in either place which has credits.
	WAIT 4.0
	BKGND islandmap
	1: A little help to speed your progress along:
	WAIT 2.0
	ACTOR 6, "Arrow", tele, 4, 75, 45
	1: To get off of the first island, you must purchase Frog Boots from this shop.
	1: They cost 500 IC, and can be worn at any level.
	WAIT 4.0
	MOVE 6, -1000, -1000, 1
	BKGND check1
	1: Well, the tour has reached its end.
	1: I hope you have enjoyed it.
	1: As a special treat, you shall recieve some training if you so desire.
	1: Right-click a button (you get to practice clicking buttons!) to choose whether or not to fight.
	IF T2 @skiptrainer
	ACTOR 7, "Fight", proxbeta, 3, 40, 50
@skiptrainer
	ACTOR 8, "Don't Fight", proxbeta, 2, 60, 50
END
@eventActorClick7
	GIVE T2
	FIGHT 250
GOTO LINK 0,0,0
END
@eventActorClick8
	IF T2 @skiptoken
	GIVE T3
@skiptoken
GOTO LINK 0,0,0
END

SCENE 208 ;unused
END

SCENE 209 cloudyVeldt, CUT
	ACTOR 1, "Tesla Coil",	techstuff1, 2, 78, 69
	ACTOR 2, "Tesla Coil",	techstuff1, 2, 52, 94
	ACTOR 3, "Tesla Coil",	techstuff1, 2, 35, 63
	ACTOR 4, "Tesla Coil",	techstuff1, 2, 11, 78
	SET equippedboots, "%E20"
	COMPARE equippedboots, "701"
	IF= @grounded
	SET mptotake, "#<num.hostMaxMP>"
	DIV mptotake, "3"
	ADD mptotake, "1"
	IF DEAD @end
	ACTOR 5, "Host",	mirror, 1, 100,85
	MOVE 5, 77, 85
	5: Here I go!
	MOVE 5, 63, 73
	WAIT 2.5
	SOUND Teslabuildup
	SEL 1
	POSE 3, 3, 3
	SEL 2
	POSE 3, 3, 3
	WAIT 0.5
	SEL 1
	POSE 4, 4, 4
	SEL 2
	POSE 4, 4, 4
	WAIT 0.5
	SEL 1
	POSE 2, 2, 2
	SEL 2
	POSE 2, 2, 2
	SOUND Tesladischarge
	ACTOR 6, "Lightning bolt", techstuff2, 2, 56, 67 
	ACTOR 7, "Lightning bolt", techstuff2, 3, 68, 63
	SEL 5
	POSE 3, 3, 3
	WAIT 0.1
	POSE 1, 1, 1
	WAIT 0.1
	POSE 3, 3, 3
	WAIT 0.1
	POSE 1, 1, 1
	TAKE H500
	TAKE M#<mptotake>
	MUL mptotake, "2"
	MOVE 6, 1000, 1000, 1
	MOVE 7, 1000, 1000, 1
	IF DEAD @diedaftershock
	5: Ouch! That hurt!!
	MOVE 5, 33, 73
	5: Uh-oh, another one!
	MOVE 5, 21, 65
	WAIT 1.7
	SOUND Teslabuildup
	SEL 3
	POSE 3, 3, 3
	SEL 4
	POSE 3, 3, 3
	WAIT 0.5
	SEL 3
	POSE 4, 4, 4
	SEL 4
	POSE 4, 4, 4
	WAIT 0.5
	SEL 3
	POSE 2, 2, 2
	SEL 4
	POSE 2, 2, 2
	SOUND Tesladischarge
	ACTOR 8, "Lightning bolt", techstuff2, 2, 14, 51 
	ACTOR 9, "Lightning bolt", techstuff2, 3, 25, 57
	SEL 5
	POSE 3, 3, 3
	WAIT 0.1
	POSE 1, 1, 1
	WAIT 0.1
	POSE 3, 3, 3
	WAIT 0.1
	POSE 1, 1, 1
	TAKE H1000
	TAKE M#<mptotake>
	MOVE 8, 1000, 1000, 1
	MOVE 9, 1000, 1000, 1
	IF DEAD @diedaftershock
	5: Ouch! That hurt!!
	MOVE 5, 17, 54
	5: Well, at least I made it through!
	WAIT 1.0
	GOTO LINK 16, 0
	END
@diedaftershock
	5: AAAAAaaaaah!!!!
	5: Not like this!
	5: Noooooooooooo...
	MOVE 5, 1000, 1000, 1
@end
END
@grounded
	IF DEAD @end
	ACTOR 5, "Host",	mirror, 1, 100,85
	MOVE 5, 77, 85
	5: Here I go!
	MOVE 5, 63, 73
	WAIT 2.5
	SOUND Teslabuildup
	SEL 1
	POSE 3, 3, 3
	SEL 2
	POSE 3, 3, 3
	WAIT 0.5
	SEL 1
	POSE 4, 4, 4
	SEL 2
	POSE 4, 4, 4
	WAIT 0.5
	SEL 1
	POSE 2, 2, 2
	SEL 2
	POSE 2, 2, 2
	MOVE 5, 33, 73
	MOVE 5, 21, 65
	WAIT 1.7
	SOUND Teslabuildup
	SEL 3
	POSE 3, 3, 3
	SEL 4
	POSE 3, 3, 3
	WAIT 0.5
	SEL 3
	POSE 4, 4, 4
	SEL 4
	POSE 4, 4, 4
	WAIT 0.5
	SEL 3
	POSE 2, 2, 2
	SEL 4
	POSE 2, 2, 2
	MOVE 5, 17, 54
	5: Well, that was easy!
	WAIT 1.0
	GOTO LINK 16, 0
	END
END

SCENE 210 hangar ;aerobase scene - CoR
END

SCENE 211 bgLibrary
	THEME 0
	WEATHER 0
	FX 0
	MUSIC fur_elise
	ACTOR 1, "Historian",	21, 5, 90
	1: Hello, %1.
	IF T5 @offertoteachtesseract
	IF T6 @teachme
	IF T7 @end
	IF T8 @offertoteachtesseract
	1: I am the Historian.
	1: Long ago, a mysterious object landed in the Realm of Chaos.
	1: This object is what we call the Citadel of Roses.
	1: It is nearly impossible to enter without dying.
	1: It is rumored that inside the Citadel are machines that can fly.
	1: I don't know if it is true, but it would be a remarkable thing to see one.
	1: Anyway, you are probably wondering how teleports work.
	1: What's that?
	1: You weren't?!?!?
	1: But EVERYONE wants to know how a teleport works!
	1: Fine!
	1: I'll tell you anyway.
	1: The energy from the teleport spell cast on the teleportation device creates a tesseract whenever something solid contacts it.
	1: The solid object is protected from any harm the tesseract might do by the energy that comes with it.
	1: I am one of the few people who can tesseract without the teleport spells.
	1: Would you like to see?
	ASK 60
	IF YES @tesseract
	1: Okay.
	1: You don't have to see me tesseract.
	1: Goodbye.
	END
@tesseract
	1: Pick a location.
	WAIT 3.0
	MENU	"Gondae Castle=@setgondae","Demonica Well=@setdwell"
	END
@setgondae
	SET mapnumbertesseract, 3
	GOTO @tesseractnow
	END
@setdwell
	SET mapnumbertesseract, 0
	GOTO @tesseractnow
	END
@tesseractnow
	BKGND glimpse
	WAIT 0.1
	BKGND bgLibrary
	WAIT 1.0
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.9
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.8
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.7
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.6
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.5
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.4
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.3
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.2
	BKGND glimpse
`	WAIT 0.1
	BKGND bgLibrary
	WAIT 0.1
	BKGND glimpse
`	WAIT 0.1
	GIVE T5
	GOTO LINK #<mapnumbertesseract>,0,0
	END
@offertoteachtesseract
	1: Do you have 500,000 IC?
	1: For that much I will take a student.
	1: So, do you have it?
	ASK 60
	IF NO @end
	IF -G500000 @end
	TAKE G500000
	GIVE T6
@teachme
	1: I shall teach you the ways.
	1: You must concentrate on MOTION first.
	1: The fastest thing you can think of.
	1: Then, concentrate also on the LOCATION.
	1: If done successfully, it will drain the power of your mind a little, but you will be uninjured AND where you want to be.
	SET points, 0
	COMPARE num.hostWIS, 175
	IF= @add1
	IF> @add1
@nextthingy
	COMPARE num.hostMaxMP, 2000
	IF= @add2
	IF> @add2
@nextthingyagain
	COMPARE points, 3
	IF= @learnedit
	TAKE T6
	GIVE T8
	N: You did not successfully learn how to tesseract.
	END
@add1
	ADD points, 1
	GOTO @nextthingy
	END
@add2
	ADD points, 2
	GOTO @nextthingyagain
	END
@learnedit
	GIVE T7
	N: You successfully learned how to tesseract.
END

;SCENE 214
;	IF T504 @end
;	ACTOR 1, "Father", mirror, 1, 5, 90
;	1: Greetings.
;	ASK 60
;	IF QHello @chat1
;	IF QHi @chat1
;	END
;@chat1
;	1: How are you?
;	ASK 60
;	IF Qfine @good
;	IF Qgood @good
;	IF Qbad @bad
;	IF Qnot^good @bad
;	IF Qvery^bad @horrible
;	IF Qhorrible @horrible
;	IF Qterrible @horrible
;	IF Qok @ok
;	IF Qokay @ok
;	IF Qokey-dokey @ok
;	N: That status is not recognized.
;	GOTO @ok
;	END
;@good
;	1: Ah, so you are doing well.
;	GOTO @chat2
;	END
;@ok
;	1: You are doing okay?
;	1: I am also.
;	GOTO @chat2
;	END
;@bad
;	1: Things not going so well, huh?
;	GOTO @chat2
;	END
;@horrible
;	1: Ooh, that bad?
;	1: I'm sorry.
;	GOTO @chat2
;	END
;@chat2
;
;	ASK 60
;	IF YES @yes
;	IF NO @no
;	1: I'll take that as a "no".
;	END
;	@no
;	1: Come back when you do.
;	GOTO EXIT
;	END
;@yes
;	IF G400000 @hire
;	1: Sorry, %2, but you don't have enough cash.
;	END
;@hire
;	TAKE G400000
;	HOST_GIVE T504
;	1: The deal is done!
;	1: Let's go, %2!
;@end
;END
;
;
;SCENE 219
;	IF T509 @end
;	ACTOR 1, "Alaenia", Alaenia, 1, 5, 90
;	1: Hi, %2.
;	1: I am the only member of the Lost Tribe who is female.
;	1: You may hire me for nine hundred thousand Iron Coins.
;	1: Shall I join your party?
;	ASK 60
;	IF YES @yes
;	1: Well, goodbye then.
;	END
;@yes
;	IF G900000 @hire
;	1: Sorry, but you don't have enough Iron Coins.
;	END
;@hire
;	TAKE G900000
;	HOST_GIVE T509
;	1: Alright, that takes care of business.
;	1: Let's go!
;@end
;END

SCENE 220
	IF T510 @end
	ACTOR 1, "Daenon", Daenon, 1, 15, 90
	1: Hello, %2.
	1: I am Daenon, leader of what is known as the Lost Tribe.
	IF -T302 @notgoodenough
	1: I need your help.
	1: The king who sits on the throne of the Three Races in Gondae Castle is not the real king.
	1: He is Kaelon, the bastard son of the sorceress Aechra.
	1: She helped him usurp the throne from my father, Daebun.
	1: I need your assistance in regaining my rightful throne.
	1: First, I need the people's support.
	1: I can only do that by slaying Demonica.
	H: Daenon, I also seek to destroy Demonica!
	1: We can join together in our quest then?
	ASK 60
	IF YES @jointogether
	END
@notgoodenough
	1: I am in need of help, but we do not share goals.
	1: Please return when you are more heroic.
END
@jointogether
	1: Good, you will not regret this decision.
	GIVE T505
	ACTOR 2, "Alaenia", Alaenia, 1, -10, 90
	MOVE 2, 10, 90, 2
	2: You aren't leaving without me!
	GIVE T504
	1: I wasn't planning to; we would have come to your dwelling immediately, Alaenia.
	2: Oh, I'm sorry.
	1: It's alright.
	1: Anyway, let's go, %1!
	H: Alright, let's go!
	GOTO EXIT
	END
END

;divider---------------------------------------------------------------------------------------------------------------------

SCENE 221
	ACTOR 1, "Blacksmith", mirror, 1, 5, 90
	IF T23 @end
	COMPARE yeardone, #<num.timeYear>
	IF< @donebyyear
	COMPARE monthdone, #<num.timeMonth>
	IF< @donebymonth
	COMPARE daydone, #<num.timeDay>
	IF< @done
	IF= @checkhourminutes
	IF T22 @pleasewait
	IF T21 @enough
	IF T20 @askforore
	1: Bring me 100 Iron Ore chunks and I will make you a sword.
	GIVE T20
@askforore
	1: Do you have the Iron Ore?
	ASK 60
	IF YES @yes
	1: Goodbye, then.
	END
@yes
	SET amounttaken, 0
@takeanother
	IF I62 @continuetake
	GOTO @notenough
	END
@continuetake
	TAKE I62
	ADD amounttaken, 1
	WAIT 0.1
	COMPARE amounttaken, 100
	IF= @enough
	IF< @takeanother
	IF> @error
	END
@error
	N: A fatal error has occured.
	TAKE H9500
	TAKE M9500
	GIVE T4000
	GOTO LINK 99,0,1
	END
@notenough
	1: Sorry, you don't have enough.
	1: Let me give back the ore I took already.
@giveanother
	GIVE I62
	SUB amounttaken, 1
	WAIT 0.1
	COMPARE amounttaken, 0
	IF= @donegiving
	IF> @giveanother
	END
@donegiving
	1: Thank you for your patience.
	1: Return when you have more ore.
	END
@enough
	1: It appears that you have enough ore.
@makesword
	1: I will make your sword for you now.
	SET yeardone, #<num.timeYear>
	SET monthdone, #<num.timeMonth>
	SET daydone, #<num.timeDay>
	SET hourdone, #<num.timeHour>
	SET minutedone, #<num.timeMinute>
	ADD minutedone, 30
@checkagain
	COMPARE minutedone, 59
	IF> @modminutes
	COMPARE hourdone, 23
	IF> @modhour
	COMPARE daydone, 31
	IF> @modday
	COMPARE monthdone, 12
	IF> @modmonth
	GOTO @halfhour
	END
@modminutes
	MOD minutedone, 59
	ADD hourdone, 1
	GOTO @checkagain
	END
@modhour
	MOD hourdone, 23
	ADD daydone, 1
	GOTO @checkagain
	END
@modday
	MOD daydone, 31
	ADD monthdone, 1
	GOTO @checkagain
	END
@modmonth
	MOD monthdone, 12
	ADD yeardone, 1
	GOTO @checkagain
	END
@halfhour
	SET bob, #<yeardone>
	MUL bob, 7
	SET jim, #<monthdone>
	MUL jim, 9
	1: Come back in half an hour for your new sword.
@end
	END
@pleasewait
	1: Please wait, it isn't finished yet.
	END
@checkhourminutes
	COMPARE hourdone, #<num.timeHour>
	IF> @done
	IF= @checkminutes
	END
@checkminutes
	COMPARE minutedone, #<num.timeMinute>
	IF> @done
	IF= @done
	GOTO @pleasewait
	END
@donebyyear
	DIV bob, 7
	COMPARE #<bob>, #<yeardone>
	IF= @done
	GOTO @error
	END
@donebymonth
	DIV jim, 9
	COMPARE #<jim>, #<monthdone>
	IF= @done
	GOTO @error
	END
@done
	1: Here is your new sword.
	GIVE T23
	GIVE I182
END

SCENE 222
	IF V8 @skiplevel
	N: You will fight till level 8.
	N: Apply stat points as you choose.
	WAIT 4.0
@restart
	IF V8 @skiplevel
	FLAGS 0
	FIGHT 250
	WAIT 5.0
	GOTO @restart
@skiplevel
	IF -T817 @skipspellgive
	N: Please wait, giving spells.
	GIVE S225
	GIVE S226
	GIVE S227
	GIVE S228
	GIVE S229
	GIVE S230
	GIVE S231
	GIVE S232
	GIVE S233
	GIVE S234
	GIVE S235
	GIVE S236
	GIVE S237
	GIVE S238
	GIVE S239
	GIVE S240
	GIVE S241
	GIVE S242
	GIVE S243
	GIVE S244
	GIVE S245
	TAKE T817
@skipspellgive
	N: Healing.
	GIVE L10000
	GIVE M10000
	N: Scene complete.
END

;----------------------------------------------------------------------------------------------------------------------------

SCENE 223, white, CUT
	SET nummortar, "0"
	SET numcrucible, "0"
	SET numselected, "0"
	SET numjug, "0"
	ACTOR 0,	"Exit",			potionframes,	0, 90, 90
	IF I72 @drawmortar
	ACTOR 16,	"Nothing",		potionframes,	3, 15, 35
@backdrawmortar
	IF I73 @drawcrucible
	ACTOR 17,	"Nothing",		potionframes,	3, 15, 55
@backdrawcrucible

@redraw
	ACTOR 3,	"null",			null,		0, -100, -100
	ACTOR 4,	"null",			null,		0, -100, -100
	ACTOR 5,	"null",			null,		0, -100, -100
	ACTOR 6,	"null",			null,		0, -100, -100
	ACTOR 7,	"null",			null,		0, -100, -100
	ACTOR 8,	"null",			null,		0, -100, -100
	ACTOR 9,	"null",			null,		0, -100, -100
	ACTOR 10,	"null",			null,		0, -100, -100
	ACTOR 11,	"null",			null,		0, -100, -100
	ACTOR 12,	"null",			null,		0, -100, -100
	ACTOR 13,	"null",			null,		0, -100, -100
	ACTOR 14,	"null",			null,		0, -100, -100
	ACTOR 15,	"null",			null,		0, -100, -100
	ACTOR 18,	"null",			null,		0, -100, -100
	ACTOR 19,	"null",			null,		0, -100, -100
	ACTOR 20,	"null",			null,		0, -100, -100
	ACTOR 21,	"null",			null,		0, -100, -100
	ACTOR 22,	"null",			null,		0, -100, -100
	ACTOR 23,	"null",			null,		0, -100, -100
	ACTOR 24,	"null",			null,		0, -100, -100
	ACTOR 25,	"null",			null,		0, -100, -100
	ACTOR 26,	"null",			null,		0, -100, -100
	ACTOR 27,	"null",			null,		0, -100, -100
	ACTOR 28,	"null",			null,		0, -100, -100
	ACTOR 29,	"null",			null,		0, -100, -100
	ACTOR 30,	"null",			null,		0, -100, -100
	ACTOR 31,	"Burn/Grind",		potionframes2,	11, 25, 43
	WAIT 0.1
	IF I60 @drawgreenherb
	ACTOR 18,	"No Green Herbs",	potionframes,	1, 40, 20
@backdrawgreenherb
	IF I61 @drawpurpleherb
	ACTOR 19,	"No Purple Herbs",	potionframes,	1, 50, 20
@backdrawpurpleherb
	IF I63 @drawredherb
	ACTOR 20,	"No Red Herbs",		potionframes,	1, 60, 20
@backdrawredherb
	IF I64 @drawsulphur
	ACTOR 21,	"No Sulphur",		potionframes,	1, 40, 40
@backdrawsulphur
	IF I66 @drawblueherb
	ACTOR 22,	"No Blue Herbs",	potionframes,	1, 70, 20
@backdrawblueherb
	IF I67 @drawlead
	ACTOR 23,	"No Lead",		potionframes,	1, 50, 40
@backdrawlead
	IF I74 @drawjug
	ACTOR 24,	"No Jugs",		potionframes,	2, 50, 65
@backdrawjug
	IF I75 @drawmix
	ACTOR 25,	"No Mixes",		potionframes,	2, 70, 40
@backdrawmix
	IF I76 @drawroot
	ACTOR 26,	"No Bitter Roots",	potionframes,	1, 60, 40
@backdrawroot
	IF I68 @drawredpotion
	ACTOR 27,	"No Red Potions",	potionframes2,	1, 85, 15
@backdrawredpotion
	IF I69 @drawbluepotion
	ACTOR 28,	"No Blue Potions",	potionframes2,	1, 85, 30
@backdrawbluepotion
	IF I70 @drawgreenpotion
	ACTOR 29,	"No Green Potions",	potionframes2,	1, 85, 45
@backdrawgreenpotion
	IF I71 @drawpurplepotion
	ACTOR 30,	"No Purple Potions",	potionframes2,	1, 85, 60
@backdrawpurplepotion
END
@drawmortar
	ACTOR 1,	"Mortar and Pestle",	potionframes,	19, 15, 35
GOTO @backdrawmortar
END
@drawcrucible
	ACTOR 2,	"Crucible",		potionframes,	21, 15, 55
GOTO @backdrawcrucible
END
@drawgreenherb
	ACTOR 3,	"Green Herb",		potionframes,	15, 40, 20
GOTO @backdrawgreenherb
END
@drawpurpleherb
	ACTOR 4,	"Purple Herb",		potionframes,	13, 50, 20
GOTO @backdrawpurpleherb
END
@drawredherb
	ACTOR 5,	"Red Herb",		potionframes,	23, 60, 20
GOTO @backdrawredherb
END
@drawsulphur
	ACTOR 6,	"Sulphur",		potionframes,	7, 40, 40
GOTO @backdrawsulphur
END
@drawblueherb
	ACTOR 7,	"Blue Herb",		potionframes,	11, 70, 20
GOTO @backdrawblueherb
END
@drawlead
	ACTOR 8,	"Lead",			potionframes,	5, 50, 40
GOTO @backdrawlead
END
@drawjug
	ACTOR 9,	"Jug of Water",		potionframes,	17, 50, 65
GOTO @backdrawjug
END
@drawmix
	ACTOR 10,	"Ingredient Mixes",	potionframes,	9, 70, 40
GOTO @backdrawmix
END
@drawroot
	ACTOR 11,	"Bitter Root",		potionframes,	25, 60, 40
GOTO @backdrawroot
END
@drawredpotion
	ACTOR 12,	"Red Potion",		potionframes2,	3, 85, 15
GOTO @backdrawredpotion
END
@drawbluepotion
	ACTOR 13,	"Blue Potion",		potionframes2,	5, 85, 30
GOTO @backdrawbluepotion
END
@drawgreenpotion
	ACTOR 14,	"Green Potion",		potionframes2,	7, 85, 45
GOTO @backdrawgreenpotion
END
@drawpurplepotion
	ACTOR 15,	"Purple Potion",	potionframes2,	9, 85, 60
GOTO @backdrawpurplepotion
END

@eventActorClick0
	COMPARE #<numselected>, "0"
	IF= @goaway
	SET actornum, "#<returnsel>"
	SEL #<returnsel>
	POSE #<returnpose>,#<returnpose>,#<returnpose>
	COMPARE #<actornum>, "1"
	IF= @clearmortar
	COMPARE #<actornum>, "2"
	IF= @clearcrucible
	COMPARE #<actornum>, "9"
	IF= @clearjug
	END
@clearmortar
	SET nummortar, "0"
	SET itemsmortar, "0"
	N: Mortar and Pestle Emptied.
	END
@clearcrucible
	SET numcrucible, "0"
	SET itemscrucible, "0"
	N: Crucible Emptied.
	END
@clearjug
	SET numjug, "0"
	SET injug, "0"
	SET oldjug, "0"
	N: Jug Emptied.
	END
@goaway
	GOTO SCENE 1
	END
@eventActorClick1
	SEL #<returnsel>
	POSE #<returnpose>,#<returnpose>,#<returnpose>
	COMPARE #<numselected>, "1"
	IF< @mortarpickup
	COMPARE #<nummortar>, "0"
	IF= @firstmortardrop
	SET itemsmortarold, "#<itemsmortar>"
	SET itemsmortar, "#<itemsmortarold>#<itemselected>"
	ADD nummortar, #<numselected>
	SET numselected, "0"
	SET itemselected, "0"
	GOTO @redraw
	END
@firstmortardrop
	SET itemsmortar, "#<itemselected>"
	SET nummortar, "#<numselected>"
	SET numselected, "0"
	SET itemselected, "0"
	GOTO @redraw
	END
@mortarpickup
	COMPARE #<nummortar>, "0"
	IF= @isnothing
	SET returnsel, "1"
	SET returnpose, "19"
	SEL 1
	POSE 20,20,20
	SET itemselected, "#<itemsmortar>"
	SET numselected, "#<nummortar>"
	SET itemsmortar, "0"
	SET nummortar, "0"
	END
@eventActorClick2
	SEL #<returnsel>
	POSE #<returnpose>,#<returnpose>,#<returnpose>
	COMPARE #<numselected>, "1"
	IF< @cruciblepickup
	COMPARE #<numcrucible>, "0"
	IF= @firstcrucibledrop
	SET itemscrucibleold, "#<itemscrucible>"
	SET itemscrucible, "#<itemscrucibleold>#<itemselected>"
	ADD numcrucible, #<numitems>
	SET numselected, "0"
	SET itemselected, "0"
	GOTO @redraw
	END
@firstcrucibledrop
	SET itemscrucible, "#<itemselected>"
	SET numcrucible, "#<numselected>"
	SET numselected, "0"
	SET itemselected, "0"
	GOTO @redraw
	END
@cruciblepickup
	COMPARE #<numcrucible>, "0"
	IF= @isnothing
	SET returnsel, "2"
	SET returnpose, "21"
	SEL 2
	POSE 22,22,22
	SET itemselected, "#<itemscrucible>"
	SET numselected, "#<numcrucible>"
	SET itemscrucible, "0"
	SET numcrucible, "0"
	END
@eventActorClick3
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 3
	SET returnsel, 3
	SET returnpose, "15"
	POSE 16,16,16
	SET numselected, "1"
	SET itemselected, "060"
	TAKE I60
	END
@eventActorClick4
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 4
	SET returnsel, 4
	SET returnpose, "13"
	POSE 14,14,14
	SET numselected, "1"
	SET itemselected, "061"
	TAKE I61
	END
@eventActorClick5
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 5
	SET returnsel, 5
	SET returnpose, "23"
	POSE 24,24,24
	SET numselected, "1"
	SET itemselected, "063"
	TAKE I63
	END
@eventActorClick6
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 6
	SET returnsel, 6
	SET returnpose, "7"
	POSE 8,8,8
	SET numselected, "1"
	SET itemselected, "064"
	TAKE I64
	END
@eventActorClick7
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 7
	SET returnsel, 7
	SET returnpose, "11"
	POSE 12,12,12
	SET numselected, "1"
	SET itemselected, "066"
	TAKE I66
	END
@eventActorClick8
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 8
	SET returnsel, 8
	SET returnpose, "5"
	POSE 6,6,6
	SET numselected, "1"
	SET itemselected, "067"
	TAKE I67
	END
@eventActorClick9
	COMPARE #<numselected>, "1"
	IF< @nothingselected
	SEL #<returnsel>
	POSE #<returnpose>,#<returnpose>,#<returnpose>
	COMPARE #<numjug>, "0"
	IF= @firstinjug
	SET oldjug, "#<injug>"
	SET injug, "#<oldjug>#<itemselected>"
	ADD numjug, "#<numselected>"
	SET itemselected, "0"
	SET numselected, "0"
	#include potioncombos.qst
	END
@firstinjug
	SET injug, "#<itemselected>"
	SET numjug, #<numselected>"
	SET itemselected, "0"
	SET numselected, "0"
	#include potioncombos.qst
	END
@nothingselected
	COMPARE #<numjug>, "0"
	IF= @isnothing
	SET returnsel, "9"
	SET returnpose, "17"
	SEL 9
	POSE 18,18,18
	SET itemselected, "#<injug>"
	SET numselected, "#<numjug>"
	SET injug, "0"
	SET numjug, "0"
	END
@eventActorClick10
	MENU "Blah=@isnothing"
	END
@eventActorClick11
	COMPARE #<numselected>, "1"
	IF= @illegalpickup
	IF> @illegalpickup
	SEL 11
	SET returnsel, 11
	SET returnpose, "25"
	POSE 26,26,26
	SET numselected, "1"
	SET itemselected, "076"
	TAKE I76
	END
@eventActorClick12
@eventActorClick13
@eventActorClick14
@eventActorClick15
	ENd
@eventActorClick16
@eventActorClick17
@eventActorClick18
@eventActorClick19
@eventActorClick20
@eventActorClick21
@eventActorClick22
@eventActorClick23
@eventActorClick24
@eventActorClick25
@eventActorClick26
@eventActorClick27
@eventActorClick28
@eventActorClick29
@eventActorClick30
	N: Sorry, that is not available right now.
	END
@eventActorClick31					;grinding first!  1=ground 2=burned 3=ground-burned 4=burned-ground
	N: Grinding and Burning now!
	COMPARE #<nummortar>, "0"
	IF= @burntime2
	SET togrind, "#<itemsmortar>"
	SET_LEN numgrind, "#<togrind>"
	DIV numgrind, "3"
	SET numdone, "0"
	SET offset1, "0"
@loopgrind
	SET_SUBSTR grind, #<offset1>, 3, #<togrind>
	SET_SUBSTR digit, 0, 1, #<grind>
	COMPARE #<offset1>, "0"
	IF= @skipbefore1g
	SET_SUBSTR before, 0, #<offset1>, #<togrind>
@skipbefore1g
		SET offset2, "#<offset1>"
		ADD offset2, "3"
		SET_LEN eatgrind, #<togrind>
		SUB eatgrind, "#<offset2>"
	SET_SUBSTR after, #<offset2>, #<eatgrind>, #<togrind>
	SET_SUBSTR item, 1, 2, #<grind>
	COMPARE #<digit>, "2"
	IF= @addgroundage
	COMPARE #<digit>, "0"
	IF= @grind
@backgrind
	ADD numdone, "1"
	ADD offset1, "3"
	COMPARE #<numdone>, #<numgrind>
	IF= @burntime
	GOTO @loopgrind
	END
@addgroundage
	SET digit, 4
	COMPARE #<offset1>, "0"
	IF= @skipbefore2g
	SET togrind, "#<before>#<digit>#<item>#<after>"
	GOTO @backgrind
@skipbefore2g
	SET togrind, "#<digit>#<item>#<after>"
	GOTO @backgrind
	END
@grind

	SET digit, 1
	COMPARE #<offset1>, "0"
	IF= @skipbefore3g
	SET togrind, "#<before>#<digit>#<item>#<after>"
	GOTO @backgrind
@skipbefore3g
	SET togrind, "#<digit>#<item>#<after>"
	GOTO @backgrind
	END

@burntime
	SET itemsmortar, "#<togrind>"
@burntime2
	COMPARE #<numcrucible>, "0"
	IF= @endtime2
	SET toburn, "#<itemscrucible>"
	SET_LEN numburn, "#<toburn>"
	DIV numburn, "3"
	SET numdone, "0"
	SET offset1, "0"
@loopburn
	SET_SUBSTR burn, #<offset1>, 3, #<toburn>
	SET_SUBSTR digit, 0, 1, #<burn>
	COMPARE #<offset1>, "0"
	IF= @skipbefore1b
	SET_SUBSTR before, 0, #<offset1>, #<toburn>
@skipbefore1b
		SET offset2, "#<offset1>"
		ADD offset2, "3"
		SET_LEN eatburn, #<toburn>
		SUB eatburn, "#<offset2>"
	SET_SUBSTR after, #<offset2>, #<eatburn>, #<toburn>
	SET_SUBSTR item, 1, 2, #<burn>
	COMPARE #<digit>, "1"
	IF= @addburnage
	COMPARE #<digit>, "0"
	IF= @burn
@backburn
	ADD numdone, "1"
	ADD offset1, "3"
	COMPARE #<numdone>, #<numburn>
	IF= @endtime
	GOTO @loopburn
	END
@addburnage
	SET digit, 3
	COMPARE #<offset1>, "0"
	IF= @skipbefore2b
	SET toburn, "#<before>#<digit>#<item>#<after>"
	GOTO @backburn
@skipbefore2b
	SET toburn, "#<digit>#<item>#<after>"
	GOTO @backburn
	END
@burn

	SET digit, 2
	COMPARE #<offset1>, "0"
	IF= @skipbefore3b
	SET toburn, "#<before>#<digit>#<item>#<after>"
	GOTO @backburn
@skipbefore3b
	SET toburn, "#<digit>#<item>#<after>"
	GOTO @backburn
	END
@endtime
	SET itemscrucible, "#<toburn>"
@endtime2
	END

END
@isnothing
	N: Nothing in container!
END

SCENE 224, white

	SET token, 0
	COMPARE #<token>, "0"
	IF= @continue
	GOTO @error
@continue
	ADD token, "1"
	COMPARE #<token>, "1"
	IF= @continue2
	GOTO @error
@continue2

;the following must be defined:
SET actorname, "Shopkeeper"
SET actorskin, mirror
SET total, "11"
SET items, "00600061006300641025006600670072007300740076"
SET costs, "00007500000750000007500000750002000000075000007500001000000150000005000000750"


	#include shopscene.qst
END
@error
GIVE T4000
N: Error Detected!
GOTO LINK 99,0,1
END

SCENE 225, shop
	ACTOR 1, "Master Assasin",	Mirror, 1, 5, 90
	1: Welcome, young apprentice.  Today, you shall learn how to create potions.
	1: There are seven ingredients for making potions.
	1: They are green, red, blue, and purple herbs, sulphur, lead, and the bitter roots of the gherae plant.
	1: You can aquire these materials in many ways.
	1: With them, you can create several potions and poisons.
	1: Others may bring you materials to have you create potions for their various needs.
	1: To help them, you must know how to create the potions!
	1: Over time, you will recieve recipes.  These will teach you specific methods for creating potions.
	1: Here is a basic one:  Grind two Red Herbs in the Mortar.  Place the ground herbs in the jug.
	1: That recipe will create a basic health potion.
	1: But, before you can create that, you must learn how to operate the potion-creating panel.
	1: When you open your potion kit by throwing it to yourself, a scene opens.
	1: It is white, with seventeen buttons.
	1: Each button has a function.  By right-clicking on them, you can access these functions.
	1: Right-Click an ingredient from the middle to select it, then right-click a place to put it.
	1: You can place objects in the Mortar and Pestle, the Crucible, or the Jug.
	1: If you place an object in the Mortar and Pestle, then right-click the Burn/Grind button, it will grind the object you placed in the Mortar.
	1: If you place an object in the Crucible, then right-click the Burn/Grind button, it will burn what you placed in the Crucible.
	1: You can place more than one thing in the Mortar or Crucible at a time, and you can have objects in both for burning/grinding.
	1: When you have prepared a potion mix, place it in the jug to mix it with water and complete the process.
	1: If you have prepared the mix in the correct way, a "You have made a potion" message will appear.
	1: Each time you move an ingredient, the screen will refresh to ensure that you do not use more than you have.
	1: If you create a green potion, and the green potion slot was empty, it will refresh when you make the potion, and it will appear.
	1: If you use up an ingredient, it will disappear from the panel, leaving behind an empty box.
	1: The Mortar and the Crucible can be used over and over again, but the jars and ingredients must be replenished.
	1: You can only carry 20 of a given ingredient or potion in your potion kit, and you may run out quickly when making a lot of potions.
	1: An object will light up when you have selected it.  After you select an object, you pick a location to send it or its contents to.
	1: It will un-highlight itself when you have moved the object(s).
	1: Now, here is a potion kit and some ingredients.  Try out the recipe I gave you earlier sometime!
	GIVE I1025
	GIVE I63.4
END

;----------------------------------------------------------------------------------------------------------------------------
SCENE 271, terminal, CUT ;Terminal
	IF -T4049 @setprefs
	SET null, ""
@afterfirsttime
	ACTOR 1, "Create Message",		tele,	16,	5,	85
	ACTOR 2, "View Stored Message",		tele,	15,	15,	85
	ACTOR 3, "Exit",			tele,	12,	42,	50
	ACTOR 4, "Actor Viewing Tool",		tele,	14,	65,	85
	ACTOR 5, "Cookie Tools",		tele,	10,	65,	25
;	ACTOR 6, "Troubleshooter",		tele,	13,	65,	55
	ACTOR 7, "Preferences",			tele,	7,	10,	25
	ACTOR 8, "Search Stored Messages",	tele,	6,	25,	85
	N: Terminal Ready.
END
@firsttime
	SET mslot1, "99"
	SET mslot1l, "0"
	SET mslot2, "99"
	SET mslot2l, "0"
	SET mslot3, "99"
	SET mslot3l, "0"
	SET mslot4, "99"
	SET mslot4l, "0"
	SET mslot5, "99"
	SET mslot5l, "0"
	SET mslot6, "99"
	SET mslot6l, "0"
	SET mslot7, "99"
	SET mslot7l, "0"
	SET mslot8, "99"
	SET mslot8l, "0"
	SET mslot9, "99"
	SET mslot9l, "0"
	N: Welcome to Terminal.
	N: Terminal will ask you a few questions before you can begin using it.
	N: If you don't know an answer, just type in the default that it tells you.
	WAIT 0.1
@eventActorClick7
	SET asktime, "240"
	N: How long to ask questions for, in seconds? (Default of 240)
	ASK #<asktime>
	SET asktime, "#<lastAsk>"
@redocolors
	N: Text color for on-screen text? (Default of White)
	N: Available options are Red, Orange, Yellow, Green, Blue, Violet, White, Black.
	ASK #<asktime>
	SET textcolor, "#<lastAsk>"
	N: Background color? (Default of Blue)
	N: Available options are Blue, Black, and White.
	ASK #<asktime>
	SET background, "#<lastAsk>"
	STRCMP #<textcolor>, #<background>
	IF= @notcompatible
	N: Ask time is #<asktime>.
	N: Text color is #<textcolor>.
	N: Background is #<background>.
	N: Is this OK?
	ASK #<asktime>
	IF -YES @setprefs
	IF T4049 @afterfirsttime
	GIVE T4049
	GOTO @afterfirsttime
	END
@notcompatible
	N: You seem to have chosen the same color for both background and text.
	N: Please reconsider this...
	GOTO @redocolors
END
@eventActorClick1
N: Confirm?
ASK #<asktime>
IF YES @gotoscene273
END
@gotoscene273
GOTO SCENE 273
END

@eventActorClick2
N: Confirm?
ASK #<asktime>
IF YES @gotoscene272
END

@gotoscene272
	GOTO SCENE 272
END

@eventActorClick3
N: Confirm?
ASK #<asktime>
IF YES @exit
END
@exit
GOTO EXIT
END

@eventActorClick4
N: Confirm?
ASK #<asktime>
IF YES @gotoscene275
END

@gotoscene275
	GOTO SCENE 275
END


@eventActorClick5
N: Confirm?
ASK #<asktime>
IF YES @gotoscene276
END

@gotoscene276
	GOTO SCENE 276
END

@eventActorClick6
N: Confirm?
ASK #<asktime>
IF YES @gotoscene277
END

@gotoscene277
	GOTO SCENE 277
END

@eventActorClick8
N: Confirm?
ASK #<asktime>
IF YES @gotoscene278
END

@gotoscene278
	GOTO SCENE 278
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 272, blue, CUT
@beginning
	BKGND #<background>
	N: Message decoder program loaded.
	N: Accessing Slots...
	N: Message in Slot 1 is #<mslot1l> letters long.
	N: Message in Slot 2 is #<mslot2l> letters long.
	N: Message in Slot 3 is #<mslot3l> letters long.
	N: Message in Slot 4 is #<mslot4l> letters long.
	N: Message in Slot 5 is #<mslot5l> letters long.
	N: Message in Slot 6 is #<mslot6l> letters long.
	N: Message in Slot 7 is #<mslot7l> letters long.
	N: Message in Slot 8 is #<mslot8l> letters long.
	N: Message in Slot 9 is #<mslot9l> letters long.
	N: Load which slot?
	N: Type a slot number or Message.
	ASK #<asktime>
	IF Q1 @load1
	IF Q2 @load2
	IF Q3 @load3
	IF Q4 @load4
	IF Q5 @load5
	IF Q6 @load6
	IF Q7 @load7
	IF Q8 @load8
	IF Q9 @load9
	IF QMessage @input
	N: Invalid Input.  Try again.
	GOTO @beginning
	END
@input
	N: Input string to read now.
	ASK #<asktime>
	SET message, "#<lastAsk>"
	SET_LEN letters, #<message>
	DIV letters, "2"
	SUB letters, "1"
	GOTO @reset
	END
@load1
	SET letters, "#<mslot1l>"
	SET message, "#<mslot1>"
	GOTO @reset
	END
@load2
	SET letters, "#<mslot2l>"
	SET message, "#<mslot2>"
	GOTO @reset
	END
@load3
	SET letters, "#<mslot3l>"
	SET message, "#<mslot3>"
	GOTO @reset
	END
@load4
	SET letters, "#<mslot4l>"
	SET message, "#<mslot4>"
	GOTO @reset
	END
@load5
	SET letters, "#<mslot5l>"
	SET message, "#<mslot5>"
	GOTO @reset
	END
@load6
	SET letters, "#<mslot6l>"
	SET message, "#<mslot6>"
	GOTO @reset
	END
@load7
	SET letters, "#<mslot7l>"
	SET message, "#<mslot7>"
	GOTO @reset
	END
@load8
	SET letters, "#<mslot8l>"
	SET message, "#<mslot8>"
	GOTO @reset
	END
@load9
	SET letters, "#<mslot9l>"
	SET message, "#<mslot9>"
	GOTO @reset
	END
@reset
	FX 0
	WEATHER 0
	SET letterID, "0"
	SET page, "1"
	SET offsetletter, "0"
	SET actorx, "15"
	SET actory, "15"
	SET actorID, "1"
@loop
	SET_SUBSTR letterID, #<offsetletter>, 2, #<message>
	COMPARE #<letterID>, "99"
	IF= @okbutton
	COMPARE #<letterID>, "98"
	IF= @skipactorcreate
	ACTOR #<actorID>, "letter", abc#<textcolor>, #<letterID>, #<actorx>, #<actory>
@skipactorecreate
	WAIT 0.1
	COMPARE #<actorID>, "30"
	IF= @nextpage
	ADD actorID, 1
	ADD actorx, 5
	COMPARE #<actorx>, 85
	IF= @adjusty
@backadjust
	ADD offsetletter, "2"
	GOTO @loop
@end
	END
@adjusty
	SET actorx, "15"
	ADD actory, "5"
	GOTO @backadjust
@nextpage
	SET_SUBSTR testletter, 64, 2, #<message>
	COMPARE #<testletter>, "99"
	IF= @okbutton
	ACTOR 31, "Next Page", abc#<textcolor>, 33, 85, 20
	END
@eventActorClick31
	ACTOR 1, "Previous Page", abc#<textcolor>, 31, 15, 15
	SET subactor, "2"
@subloop
	ACTOR #<subactor>, mirror, 1, -100, -100
	ADD subactor, "1"
	COMPARE #<subactor>, "32"
	IF= @breaksubloop
	GOTO @subloop
@breaksubloop
	ADD page, "1"
	SET actorx, "20"
	SET actory, "15"
	ADD letterID, "1"
	SET actorID, "2"
	ADD offsetletter, "2"
	GOTO @loop
	END
@eventActorClick1
	COMPARE #<page>, "1"
	IF> @pageback
	END
@pageback
	SUB page, "1"
	COMPARE #<page>, "1"
	IF= @ispage1now
	SET actorx, "20"
	SET actory, "15"
	SUB letterID, "49"
	SET actorID, "2"
	SUB offsetletter, "98"
	SET subactor2, "2"
@subloop2
	ACTOR #<subactor2>, mirror, 1, -100, -100
	ADD subactor2, "1"
	COMPARE #<subactor2>, "32"
	IF= @breaksubloop2
	GOTO @subloop2
@breaksubloop2
	GOTO @loop
	END
@ispage1now
	SET actorx, "15"
	SET actory, "15"
	SET letterID, "0"
	SET actorID, "1"
	SET offsetletter, "0"
	SET subactor3, "1"
@subloop3
	ACTOR #<subactor3>, mirror, 1, -100, -100
	ADD subactor3, "1"
	COMPARE #<subactor3>, "32"
	IF= @breaksubloop3
	GOTO @subloop3
@breaksubloop3
	GOTO @loop
	END
		
@okbutton
	N: Done	Displaying.
	ACTOR 0, "OK" abc#<textcolor>, 34, 50, 50
	END
@eventActorClick0
	N: Done	Displaying.
@returntomenu
	N: Exit to Menu/Save/Load?
@askagain
	N: Answer Exit, Save, or Load.
	ASK #<asktime>
	IF QExit @back
	IF QSave @save
	IF QLoad @clear
	N: Sorry, invalid option.
	N: Remember to capitalize.
GOTO @askagain

@save
	N: Message code is #<message>
	GOTO @storecurrent
	N: Thank you for using Message System.
END

@clear
	SET subactor4, "0"
@subloop4
	ACTOR #<subactor4>, mirror, 1, -100, -100
	ADD subactor4, "1"
	COMPARE #<subactor4>, "32"
	IF= @beginning
	GOTO @subloop4
	END

@back
	GOTO SCENE 271
END

@storecurrent
	N: Choose a slot to store message in.
	N: (1-9)
	ASK #<asktime>
	IF Q1 @slot1
	IF Q2 @slot2
	IF Q3 @slot3
	IF Q4 @slot4	
	IF Q5 @slot5
	IF Q6 @slot6
	IF Q7 @slot7
	IF Q8 @slot8
	IF Q9 @slot9
	N: Invalid slot number, please try again.
	GOTO @storecurrent
END

@slot1
	N: Reading Slot 1...
	COMPARE #<mslot1>, "0"
	IF= @write1
@confirmwrite1
	N: Slot 1 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write1
	SET mslot1l, "#<letters>"
	SET mslot1, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot2
	N: Reading Slot 2...
	COMPARE #<mslot2>, "0"
	IF= @write2
@confirmwrite2
	N: Slot 2 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write2
	SET mslot2l, "#<letters>"
	SET mslot2, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot3
	N: Reading Slot 3...
	COMPARE #<mslot3>, "0"
	IF= @write3
@confirmwrite3
	N: Slot 3 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write3
	SET mslot3l, "#<letters>"
	SET mslot3, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot4
	N: Reading Slot 4...
	COMPARE #<mslot4>, "0"
	IF= @write4
@confirmwrite4
	N: Slot 4 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write4
	SET mslot4l, "#<letters>"
	SET mslot4, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot5
	N: Reading Slot 5...
	COMPARE #<mslot5>, "0"
	IF= @write5
@confirmwrite5
	N: Slot 5 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write5
	SET mslot5l, "#<letters>"
	SET mslot5, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot6
	N: Reading Slot 6...
	COMPARE #<mslot6>, "0"
	IF= @write6
@confirmwrite6
	N: Slot 6 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write6
	SET mslot6l, "#<letters>"
	SET mslot6, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot7
	N: Reading Slot 7...
	COMPARE #<mslot7>, "0"
	IF= @write7
@confirmwrite7
	N: Slot 7 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write7
	SET mslot7l, "#<letters>"
	SET mslot7, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot8
	N: Reading Slot 8...
	COMPARE #<mslot8>, "0"
	IF= @write8
@confirmwrite8
	N: Slot 8 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write8
	SET mslot8l, "#<letters>"
	SET mslot8, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot9
	N: Reading Slot 9...
	COMPARE #<mslot9>, "0"
	IF= @write9
@confirmwrite9
	N: Slot 9 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write9
	SET mslot9l, "#<letters>"
	SET mslot9, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@error
	N: Error has occured.
	N: We apologize for the inconvenience.
	N: Please be patient while the script resets.
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting.
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting..
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting...
	GOTO @reset
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 273, blue, CUT
	BKGND #<background>
	N: Message encoder program loaded.
SET letters, "0"
SET oldtext, ""
SET oldtext1, ""
	ACTOR 1,	"A",		abc#<textcolor>,	1,	30,	85
	ACTOR 2,	"B",		abc#<textcolor>,	2,	53,	90
	ACTOR 3,	"C",		abc#<textcolor>,	3,	43,	90
	ACTOR 4,	"D",		abc#<textcolor>,	4,	40,	85
	ACTOR 5,	"E",		abc#<textcolor>,	5,	37,	80
	ACTOR 6,	"F",		abc#<textcolor>,	6,	45,	85
	ACTOR 7,	"G",		abc#<textcolor>,	7,	50,	85
	ACTOR 8,	"H",		abc#<textcolor>,	8,	55,	85
	ACTOR 9,	"I",		abc#<textcolor>,	9,	62,	80
	ACTOR 10,	"J",		abc#<textcolor>,	10,	60,	85
	ACTOR 11,	"K",		abc#<textcolor>,	11,	65,	85
	ACTOR 12,	"L",		abc#<textcolor>,	12,	70,	85
	ACTOR 13,	"M",		abc#<textcolor>,	13,	63,	90
	ACTOR 14,	"N",		abc#<textcolor>,	14,	58,	90
	ACTOR 15,	"O",		abc#<textcolor>,	15,	67,	80
	ACTOR 16,	"P",		abc#<textcolor>,	16,	72,	80
	ACTOR 17,	"Q",		abc#<textcolor>,	17,	27,	80
	ACTOR 18,	"R",		abc#<textcolor>,	18,	42,	80
	ACTOR 19,	"S",		abc#<textcolor>,	19,	35,	85
	ACTOR 20,	"T",		abc#<textcolor>,	20,	47,	80
	ACTOR 21,	"U",		abc#<textcolor>,	21,	57,	80
	ACTOR 22,	"V",		abc#<textcolor>,	22,	48,	90
	ACTOR 23,	"W",		abc#<textcolor>,	23,	32,	80
	ACTOR 24,	"X",		abc#<textcolor>,	24,	38,	90
	ACTOR 25,	"Y",		abc#<textcolor>,	25,	52,	80
	ACTOR 26,	"Z",		abc#<textcolor>,	26,	33,	90
	ACTOR 27,	".",		abc#<textcolor>,	27,	68,	90
	ACTOR 28,	"!",		abc#<textcolor>,	28,	73,	90
	ACTOR 29,	"Space",	abc#<textcolor>,	30,	77,	80
	ACTOR 30,	"Backspace",	abc#<textcolor>,	31,	80,	85
	ACTOR 31,	"View Text",	abc#<textcolor>,	32,	75,	85
	END
@eventActorClick1
	SET currentletter, "01"
	GOTO @addletter
	END
@eventActorClick2
	SET currentletter, "02"
	GOTO @addletter
	END
@eventActorClick3
	SET currentletter, "03"
	GOTO @addletter
	END
@eventActorClick4
	SET currentletter, "04"
	GOTO @addletter
	END
@eventActorClick5
	SET currentletter, "05"
	GOTO @addletter
	END
@eventActorClick6
	SET currentletter, "06"
	GOTO @addletter
	END
@eventActorClick7
	SET currentletter, "07"
	GOTO @addletter
	END
@eventActorClick8
	SET currentletter, "08"
	GOTO @addletter
	END
@eventActorClick9
	SET currentletter, "09"
	GOTO @addletter
	END
@eventActorClick10
	SET currentletter, "10"
	GOTO @addletter
	END
@eventActorClick11
	SET currentletter, "11"
	GOTO @addletter
	END
@eventActorClick12
	SET currentletter, "12"
	GOTO @addletter
	END
@eventActorClick13
	SET currentletter, "13"
	GOTO @addletter
	END
@eventActorClick14
	SET currentletter, "14"
	GOTO @addletter
	END
@eventActorClick15
	SET currentletter, "15"
	GOTO @addletter
	END
@eventActorClick16
	SET currentletter, "16"
	GOTO @addletter
	END
@eventActorClick17
	SET currentletter, "17"
	GOTO @addletter
	END
@eventActorClick18
	SET currentletter, "18"
	GOTO @addletter
	END
@eventActorClick19
	SET currentletter, "19"
	GOTO @addletter
	END
@eventActorClick20
	SET currentletter, "20"
	GOTO @addletter
	END
@eventActorClick21
	SET currentletter, "21"
	GOTO @addletter
	END
@eventActorClick22
	SET currentletter, "22"
	GOTO @addletter
	END
@eventActorClick23
	SET currentletter, "23"
	GOTO @addletter
	END
@eventActorClick24
	SET currentletter, "24"
	GOTO @addletter
	END
@eventActorClick25
	SET currentletter, "25"
	GOTO @addletter
	END
@eventActorClick26
	SET currentletter, "26"
	GOTO @addletter
	END
@eventActorClick27
	SET currentletter, "27"
	GOTO @addletter
	END
@eventActorClick28
	SET currentletter, "28"
	GOTO @addletter
	END
@eventActorClick29
	SET currentletter, "30"
	GOTO @addletter
	END
@eventActorClick30
	SET_LEN textlength, #<oldtext>
	SUB textlength, "2"
	SET midtext, "#<oldtext>"
	SET_SUBSTR midtext, 0, #<textlength> #<oldtext>
	SET oldtext, "#<midtext>"
	SET newtext, "#<oldtext>"
	END
@eventActorClick31
	SET newtext, "#<oldtext>98"
	SET oldtext, "#<newtext>"
	SET message, "#<oldtext>"
	GOTO SCENE 274
	END
@addletter
	COMPARE #<letters>, "0"
	IF= @isfirstletter
	IF> @continueletteradd
@isfirstletter
	SET oldtext, "#<currentletter>"
	ADD letters, "1"
	END
@continueletteradd
	SET newtext, "#<oldtext>#<currentletter>"
	SET oldtext, "#<newtext>"
	ADD letters, "1"
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 274, blue, CUT
	BKGND #<background>
@reset
	FX 0
	WEATHER 0
	SET letterID, "0"
	SET page, "1"
	SET offsetletter, "0"
	SET actorx, "15"
	SET actory, "15"
	SET actorID, "1"
@loop
	SET_SUBSTR letterID, #<offsetletter>, 2, #<message>
	COMPARE #<letterID>, "98"
	IF= @okbutton
	ACTOR #<actorID>, "letter", abc#<textcolor>, #<letterID>, #<actorx>, #<actory>
	WAIT 0.1
	COMPARE #<actorID>, "30"
	IF= @nextpage
	ADD actorID, 1
	ADD actorx, 5
	COMPARE #<actorx>, 85
	IF= @adjusty
@backadjust
	ADD offsetletter, "2"
	GOTO @loop
@end
	END
@adjusty
	SET actorx, "15"
	ADD actory, "5"
	GOTO @backadjust
@nextpage
	SET_SUBSTR testletter, 64, 2, #<message>
	COMPARE #<testletter>, "98"
	IF= @okbutton
	ACTOR 31, "Next Page", abc#<textcolor>, 33, 85, 20
	END
@eventActorClick31
	ACTOR 1, "Previous Page", abc#<textcolor>, 31, 15, 15
	SET subactor, "2"
@subloop
	ACTOR #<subactor>, mirror, 1, -100, -100
	ADD subactor, "1"
	COMPARE #<subactor>, "32"
	IF= @breaksubloop
	GOTO @subloop
@breaksubloop
	ADD page, "1"
	SET actorx, "20"
	SET actory, "15"
	SET letterID, "32"
	SET actorID, "2"
	ADD offsetletter, "2"
	GOTO @loop
	END
@eventActorClick1
	COMPARE #<page>, "1"
	IF> @pageback
	END
@pageback
	SUB page, "1"
	COMPARE #<page>, "1"
	IF= @ispage1now
	SET actorx, "20"
	SET actory, "15"
	SUB letterID, "57"
	SET actorID, "2"
	SUB offsetletter, "114"
	SET subactor2, "2"
@subloop2
	ACTOR #<subactor2>, mirror, 1, -100, -100
	ADD subactor2, "1"
	COMPARE #<subactor2>, "32"
	IF= @breaksubloop2
	GOTO @subloop2
@breaksubloop2
	GOTO @loop
	END
@ispage1now
	SET actorx, "15"
	SET actory, "15"
	SET letterID, "0"
	SET actorID, "1"
	SET offsetletter, "0"
	SET subactor3, "1"
@subloop3
	ACTOR #<subactor3>, mirror, 1, -100, -100
	ADD subactor3, "1"
	COMPARE #<subactor3>, "32"
	IF= @breaksubloop3
	GOTO @subloop3
@breaksubloop3
	GOTO @loop
	END

@okbutton
	N: Done	Displaying.
	ACTOR 0, "OK" abc#<textcolor>, 34, 50, 50
	END
@eventActorClick0
@returntomenu
	N: Finish Message/Back to Keyboard?
@askagain
	N: Answer Finish, Back, or Exit.
	ASK #<asktime>
	IF QFinish @finish
	IF QBack @back
	IF QExit @exit
	N: Sorry, invalid option.
	N: Remember to capitalize.
GOTO @askagain

@finish
	SET_LEN textlength, #<message>
	SUB textlength, "2"
	SET midtext, "#<message>"
	SET_SUBSTR midtext, 0, #<textlength> #<message>
	SET message, "#<midtext>"
	SET newtext, "#<message>"
	SET oldtext, "#<message>"
	SET newtext, "#<oldtext>99"
	SET message, "#<newtext>"
	N: Message code is #<message>
	N: Would you like to store this message?
	ASK #<asktime>
	IF YES @storecurrent
	N: Thank you for using Message System.
END

@back
	GOTO SCENE 273
END

@exit
	GOTO SCENE 271
END

@view

END

@storecurrent
	N: Choose a slot to store message in.
	N: (1-9)
	ASK #<asktime>
	IF Q1 @slot1
	IF Q2 @slot2
	IF Q3 @slot3
	IF Q4 @slot4	
	IF Q5 @slot5
	IF Q6 @slot6
	IF Q7 @slot7
	IF Q8 @slot8
	IF Q9 @slot9
	N: Invalid slot number, please try again.
	GOTO @storecurrent
END

@slot1
	N: Reading Slot 1...
	COMPARE #<mslot1>, "0"
	IF= @write1
@confirmwrite1
	N: Slot 1 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write1
	SET mslot1l, "#<letters>"
	SET mslot1, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot2
	N: Reading Slot 2...
	COMPARE #<mslot2>, "0"
	IF= @write2
@confirmwrite2
	N: Slot 2 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write2
	SET mslot2l, "#<letters>"
	SET mslot2, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot3
	N: Reading Slot 3...
	COMPARE #<mslot3>, "0"
	IF= @write3
@confirmwrite3
	N: Slot 3 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write3
	SET mslot3l, "#<letters>"
	SET mslot3, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot4
	N: Reading Slot 4...
	COMPARE #<mslot4>, "0"
	IF= @write4
@confirmwrite4
	N: Slot 4 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write4
	SET mslot4l, "#<letters>"
	SET mslot4, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot5
	N: Reading Slot 5...
	COMPARE #<mslot5>, "0"
	IF= @write5
@confirmwrite5
	N: Slot 5 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write5
	SET mslot5l, "#<letters>"
	SET mslot5, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot6
	N: Reading Slot 6...
	COMPARE #<mslot6>, "0"
	IF= @write6
@confirmwrite6
	N: Slot 6 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write6
	SET mslot6l, "#<letters>"
	SET mslot6, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot7
	N: Reading Slot 7...
	COMPARE #<mslot7>, "0"
	IF= @write7
@confirmwrite7
	N: Slot 7 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write7
	SET mslot7l, "#<letters>"
	SET mslot7, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot8
	N: Reading Slot 8...
	COMPARE #<mslot8>, "0"
	IF= @write8
@confirmwrite8
	N: Slot 8 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write8
	SET mslot8l, "#<letters>"
	SET mslot8, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@slot9
	N: Reading Slot 9...
	COMPARE #<mslot9>, "0"
	IF= @write9
@confirmwrite9
	N: Slot 9 contains a message.
	N: Overwrite?
	ASK #<asktime>
	IF -YES @storecurrent
@write9
	SET mslot9l, "#<letters>"
	SET mslot9, "#<message>"
	N: Write Successful.
	GOTO @returntomenu
END

@error
	N: Error has occured.
	N: We apologize for the inconvenience.
	N: Please be patient while the script resets.
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting.
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting..
	N: #<null>
	N: #<null>
	N: #<null>
	N: #<null>
	N: Reseting...
	GOTO @reset
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 275, blue, CUT
	BKGND #<background>
	ACTOR 0, "Menu Button", tele, 14, 90, 15
	N: Actor Viewing Tool Ready.
	END
@eventActorClick0
	MENU "Set Actor ID=@setID","Set Actor Name=@setname","Set Actor Skin=@setskin","Set Beginning Pose=@setfirstpose","Set Pose Values=@setpose","Set Actor X Coord=@setx","Set Actor Y Coord=@sety","Draw!=@drawcurrent","Move Actor=@move","Exit=@exit"
END
@setID
	N: Actor ID?
	N: (1-31)
	ASK #<asktime>
	SET actorID, "#<lastAsk>"
END
@setname
	N: Actor Name?
	ASK #<asktime>
	SET actorname, "#<lastAsk>"
END
@setskin
	N: Actor Skin?
	ASK #<asktime>
	SET actorskin, "#<lastAsk>"
END
@setfirstpose
	N: Initial Pose Value?
	ASK #<asktime>
	SET firstpose, "#<lastAsk>"
END
@setpose
	N: Pose Value one?
	ASK #<asktime>
	SET pose1, "#<lastAsk>"
	N: Pose Value two?
	ASK #<asktime>
	SET pose2, "#<lastAsk>"
	N: Pose Value three?
	ASK #<asktime>
	SET pose3, "#<lastAsk>"
	N: Pose now?
	ASK #<asktime>
	IF -YES @end
	SEL #<actorID>
	POSE #<pose1>,#<pose2>,#<pose3>
@end
END
@setx
	N: Actor X value?
	N: (1-100 for on the screen)
	ASK #<asktime>
	SET actorx, "#<lastAsk>"
END
@sety
	N: Actor Y value?
	N: (1-100 for on the screen)
	ASK #<asktime>
	SET actory, "#<lastAsk>"
END
@drawcurrent
	ACTOR #<actorID>, "#<actorname>", #<actorskin>, #<firstpose>, #<actorx>, #<actory>
END
@move
	N: Move to X?
	N: (1-100 for on the screen)
	ASK #<asktime>
	SET newactorx, "#<lastAsk>"
	N: Move to Y?
	N: (1-100 for on the screen)
	ASK #<asktime>
	SET newactory, "#<lastAsk>"
	N: Move mode?
	ASK #<asktime>
	SET movemode, "#<lastAsk>"
	N: (1 for teleport, 2-5 for 2-5X speed)
	MOVE #<actorID>, #<newactorx>, #<newactory>, #<movemode>
END
@exit
	GOTO SCENE 271
END
;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 276, blue, CUT
	BKGND #<background>
	SET label, "testSID"
		#include accessrights.qst
	END
@normal
@ban
	N: Sorry, you do not have the right to use this feature.
	END
@ismaster
@isbeta
@isdev
	ACTOR 0, "Menu Button", tele, 10, 90, 15
	N: Cookie Manipulation Tool ready.
	END
@eventActorClick0
	MENU "Set cookie=@setcookie","MUL Cookie=@mulcookie","ADD Cookie=@addcookie","DIV Cookie=@divcookie","SUB Cookie=@subcookie","MOD/MODULUS Cookie=@modcookie","View Cookie=@viewcookie","Exit=@exit"
END
@setcookie
	N: Cookie name to set?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	N: Value to set it?
	ASK #<asktime>
	SET cookievalue, "#<lastAsk>"
	SET #<cookiename>, "#<cookievalue>"
	N: Cookie Set.
END
@mulcookie
	N: Cookie to multiply?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	SET mul1, "*#<cookiename>"
	N: Second Number is cookie?
	ASK #<asktime>
	IF -NO @muliscookie
	N: Number to multiply by?
	ASK #<asktime>
	SET mulvalue, "#<lastAsk>"
	MUL mul1, "#<mulvalue>"
	N: Product is #<mul1>
END
@muliscookie
	N: Which cookie to multiply by?
	ASK #<asktime>
	SET cookiename2, "#<lastAsk>"
	SET mul2, "*#<cookiename2>"
	MUL mul1, "#<mul2>"
	N: Product is #<mul1>
END
@addcookie
	N: Cookie to add to?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	SET add1, "*#<cookiename>"
	N: Second Number is cookie?
	ASK #<asktime>
	IF -NO @addiscookie
	N: Number to add?
	ASK #<asktime>
	SET addvalue, "#<lastAsk>"
	ADD #<add1>, "#<addvalue>"
	N: Sum is #<add1>
END
@addiscookie
	N: Which cookie to add?
	ASK #<asktime>
	SET cookiename2, "#<lastAsk>"
	SET add2, "*#<cookiename2>"
	ADD #<add1>, "#<add2>"
	N: Sum is #<add1>
END
@divcookie
	N: Cookie to divide?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	SET div1, "*#<cookiename>"
	N: Second Number is cookie?
	ASK #<asktime>
	IF -NO @diviscookie
	N: Number to divide by?
	ASK #<asktime>
	SET divvalue, "#<lastAsk>"
	DIV #<div1>, "#<divvalue>"
	N: Quotient is #<div1>
END
@diviscookie
	N: Which cookie to divide by?
	ASK #<asktime>
	SET cookiename2, "#<lastAsk>"
	SET div2, "*#<cookiename2>"
	DIV #<div1>, "#<div2>"
	N: Quotient is #<div1>
END
@subcookie
	N: Cookie to subtract from?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	SET sub1, "*#<cookiename>"
	N: Second Number is cookie?
	ASK #<asktime>
	IF -NO @subiscookie
	N: Number to subtract?
	ASK #<asktime>
	SET subvalue, "#<lastAsk>"
	SUB #<sub1>, "#<subvalue>"
	N: Result is #<sub1>
END
@subiscookie
	N: Which cookie to subtract?
	ASK #<asktime>
	SET cookiename2, "#<lastAsk>"
	SET sub2, "*#<cookiename2>"
	SUB #<sub1>, "#<sub2>"
	N: Result is #<sub1>
END
@modcookie
	N: Cookie to divide?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	SET mod1, "*#<cookiename>"
	N: Second Number is cookie?
	ASK #<asktime>
	IF -NO @modiscookie
	N: Number to subtract?
	ASK #<asktime>
	SET modvalue, "#<lastAsk>"
	SUB #<mod1>, "#<modvalue>"
	N: Remainder is #<mod1>
END
@modiscookie
	N: Which cookie to divide by?
	ASK #<asktime>
	SET cookiename2, "#<lastAsk>"
	SET mod2, "*#<cookiename2>"
	SUB #<mod1>, "#<mod2>"
	N: Remainder is #<mod1>
END
@viewcookie
	N: Name of cookie to view?
	ASK #<asktime>
	SET cookiename, "#<lastAsk>"
	N: Value of cookie is *#<cookiename>.
END
@exit
	GOTO SCENE 271
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 277
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 278, blue, CUT
	BKGND #<background>
	N: Input Search Keyword Now.
SET letters, "0"
SET oldtext, ""
SET oldtext1, ""
	ACTOR 1,	"A",		abc#<textcolor>,	1,	30,	85
	ACTOR 2,	"B",		abc#<textcolor>,	2,	53,	90
	ACTOR 3,	"C",		abc#<textcolor>,	3,	43,	90
	ACTOR 4,	"D",		abc#<textcolor>,	4,	40,	85
	ACTOR 5,	"E",		abc#<textcolor>,	5,	37,	80
	ACTOR 6,	"F",		abc#<textcolor>,	6,	45,	85
	ACTOR 7,	"G",		abc#<textcolor>,	7,	50,	85
	ACTOR 8,	"H",		abc#<textcolor>,	8,	55,	85
	ACTOR 9,	"I",		abc#<textcolor>,	9,	62,	80
	ACTOR 10,	"J",		abc#<textcolor>,	10,	60,	85
	ACTOR 11,	"K",		abc#<textcolor>,	11,	65,	85
	ACTOR 12,	"L",		abc#<textcolor>,	12,	70,	85
	ACTOR 13,	"M",		abc#<textcolor>,	13,	63,	90
	ACTOR 14,	"N",		abc#<textcolor>,	14,	58,	90
	ACTOR 15,	"O",		abc#<textcolor>,	15,	67,	80
	ACTOR 16,	"P",		abc#<textcolor>,	16,	72,	80
	ACTOR 17,	"Q",		abc#<textcolor>,	17,	27,	80
	ACTOR 18,	"R",		abc#<textcolor>,	18,	42,	80
	ACTOR 19,	"S",		abc#<textcolor>,	19,	35,	85
	ACTOR 20,	"T",		abc#<textcolor>,	20,	47,	80
	ACTOR 21,	"U",		abc#<textcolor>,	21,	57,	80
	ACTOR 22,	"V",		abc#<textcolor>,	22,	48,	90
	ACTOR 23,	"W",		abc#<textcolor>,	23,	32,	80
	ACTOR 24,	"X",		abc#<textcolor>,	24,	38,	90
	ACTOR 25,	"Y",		abc#<textcolor>,	25,	52,	80
	ACTOR 26,	"Z",		abc#<textcolor>,	26,	33,	90
	ACTOR 27,	".",		abc#<textcolor>,	27,	68,	90
	ACTOR 28,	"!",		abc#<textcolor>,	28,	73,	90
	ACTOR 29,	"Space",	abc#<textcolor>,	30,	77,	80
	ACTOR 30,	"Backspace",	abc#<textcolor>,	31,	80,	85
	ACTOR 31,	"View Text",	abc#<textcolor>,	32,	75,	85
	END
@eventActorClick1
	SET currentletter, "01"
	GOTO @addletter
	END
@eventActorClick2
	SET currentletter, "02"
	GOTO @addletter
	END
@eventActorClick3
	SET currentletter, "03"
	GOTO @addletter
	END
@eventActorClick4
	SET currentletter, "04"
	GOTO @addletter
	END
@eventActorClick5
	SET currentletter, "05"
	GOTO @addletter
	END
@eventActorClick6
	SET currentletter, "06"
	GOTO @addletter
	END
@eventActorClick7
	SET currentletter, "07"
	GOTO @addletter
	END
@eventActorClick8
	SET currentletter, "08"
	GOTO @addletter
	END
@eventActorClick9
	SET currentletter, "09"
	GOTO @addletter
	END
@eventActorClick10
	SET currentletter, "10"
	GOTO @addletter
	END
@eventActorClick11
	SET currentletter, "11"
	GOTO @addletter
	END
@eventActorClick12
	SET currentletter, "12"
	GOTO @addletter
	END
@eventActorClick13
	SET currentletter, "13"
	GOTO @addletter
	END
@eventActorClick14
	SET currentletter, "14"
	GOTO @addletter
	END
@eventActorClick15
	SET currentletter, "15"
	GOTO @addletter
	END
@eventActorClick16
	SET currentletter, "16"
	GOTO @addletter
	END
@eventActorClick17
	SET currentletter, "17"
	GOTO @addletter
	END
@eventActorClick18
	SET currentletter, "18"
	GOTO @addletter
	END
@eventActorClick19
	SET currentletter, "19"
	GOTO @addletter
	END
@eventActorClick20
	SET currentletter, "20"
	GOTO @addletter
	END
@eventActorClick21
	SET currentletter, "21"
	GOTO @addletter
	END
@eventActorClick22
	SET currentletter, "22"
	GOTO @addletter
	END
@eventActorClick23
	SET currentletter, "23"
	GOTO @addletter
	END
@eventActorClick24
	SET currentletter, "24"
	GOTO @addletter
	END
@eventActorClick25
	SET currentletter, "25"
	GOTO @addletter
	END
@eventActorClick26
	SET currentletter, "26"
	GOTO @addletter
	END
@eventActorClick27
	SET currentletter, "27"
	GOTO @addletter
	END
@eventActorClick28
	SET currentletter, "28"
	GOTO @addletter
	END
@eventActorClick29
	SET currentletter, "30"
	GOTO @addletter
	END
@eventActorClick30
	SET_LEN textlength, #<oldtext>
	SUB textlength, "2"
	SET midtext, "#<oldtext>"
	SET_SUBSTR midtext, 0, #<textlength> #<oldtext>
	SET oldtext, "#<midtext>"
	SET newtext, "#<oldtext>"
	END
@eventActorClick31
	SET newtext, "#<oldtext>98"
	SET oldtext, "#<newtext>"
	SET message, "#<oldtext>"
	GOTO SCENE 279
	END
@addletter
	COMPARE #<letters>, "0"
	IF= @isfirstletter
	IF> @continueletteradd
@isfirstletter
	SET oldtext, "#<currentletter>"
	ADD letters, "1"
	END
@continueletteradd
	SET newtext, "#<oldtext>#<currentletter>"
	SET oldtext, "#<newtext>"
	ADD letters, "1"
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 279, blue, CUT
	BKGND #<background>
@reset
	FX 0
	WEATHER 0
	SET letterID, "0"
	SET page, "1"
	SET offsetletter, "0"
	SET actorx, "15"
	SET actory, "15"
	SET actorID, "1"
@loop
	SET_SUBSTR letterID, #<offsetletter>, 2, #<message>
	COMPARE #<letterID>, "98"
	IF= @okbutton
	ACTOR #<actorID>, "letter", abc#<textcolor>, #<letterID>, #<actorx>, #<actory>
	WAIT 0.1
	COMPARE #<actorID>, "30"
	IF= @nextpage
	ADD actorID, 1
	ADD actorx, 5
	COMPARE #<actorx>, 85
	IF= @adjusty
@backadjust
	ADD offsetletter, "2"
	GOTO @loop
@end
	END
@adjusty
	SET actorx, "15"
	ADD actory, "5"
	GOTO @backadjust
@nextpage
	SET_SUBSTR testletter, 64, 2, #<message>
	COMPARE #<testletter>, "98"
	IF= @okbutton
	ACTOR 31, "Next Page", abc#<textcolor>, 33, 85, 20
	END
@eventActorClick31
	ACTOR 1, "Previous Page", abc#<textcolor>, 31, 15, 15
	SET subactor, "2"
@subloop
	ACTOR #<subactor>, mirror, 1, -100, -100
	ADD subactor, "1"
	COMPARE #<subactor>, "32"
	IF= @breaksubloop
	GOTO @subloop
@breaksubloop
	ADD page, "1"
	SET actorx, "20"
	SET actory, "15"
	SET letterID, "32"
	SET actorID, "2"
	ADD offsetletter, "2"
	GOTO @loop
	END
@eventActorClick1
	COMPARE #<page>, "1"
	IF> @pageback
	END
@pageback
	SUB page, "1"
	COMPARE #<page>, "1"
	IF= @ispage1now
	SET actorx, "20"
	SET actory, "15"
	SUB letterID, "57"
	SET actorID, "2"
	SUB offsetletter, "114"
	SET subactor2, "2"
@subloop2
	ACTOR #<subactor2>, mirror, 1, -100, -100
	ADD subactor2, "1"
	COMPARE #<subactor2>, "32"
	IF= @breaksubloop2
	GOTO @subloop2
@breaksubloop2
	GOTO @loop
	END
@ispage1now
	SET actorx, "15"
	SET actory, "15"
	SET letterID, "0"
	SET actorID, "1"
	SET offsetletter, "0"
	SET subactor3, "1"
@subloop3
	ACTOR #<subactor3>, mirror, 1, -100, -100
	ADD subactor3, "1"
	COMPARE #<subactor3>, "32"
	IF= @breaksubloop3
	GOTO @subloop3
@breaksubloop3
	GOTO @loop
	END

@okbutton
	N: Done	Displaying.
	ACTOR 0, "OK" abc#<textcolor>, 34, 50, 50
	END
@eventActorClick0
@returntomenu
	N: Search now?/Back to Keyboard/Exit?
@askagain
	N: Answer Search, Back, or Exit.
	ASK #<asktime>
	IF QSearch @finish
	IF QBack @back
	IF QExit @exit
	N: Sorry, invalid option.
	N: Remember to capitalize.
GOTO @askagain

@finish
	SET_LEN textlength, #<message>
	SUB textlength, "2"
	SET midtext, "#<message>"
	SET_SUBSTR midtext, 0, #<textlength> #<message>
	SET message, "#<midtext>"
	SET newtext, "#<message>"
	SET searchitem, "#<newtext>"
	N: Search Beginning now.
	WAIT 0.1
	GOTO SCENE 280
END

@back
	GOTO SCENE 279
END

@exit
	GOTO SCENE 271
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>

SCENE 280, blue, CUT
	BKGND #<background>
	N: Search Beginning.
	SET results, "0"
	SET searchoffset, "0"
	SET slotnumber, "1"
	SET findstring, "mslot#<slotnumber>"
	SET currentstring, "*#<findstring>"
	SET_LEN searchlength, #<searchitem>
@loop
	WAIT 0.1
	SET_SUBSTR searchtest, #<searchoffset>, #<searchlength>, #<currentstring>
	COMPARE #<searchitem>, #<searchtest>
	IF= @foundresult
	SET findlast, #<searchoffset>
	SET sublength, #<searchlength>
	SUB sublength, "2"
	ADD findlast, "#<sublength>"
	SET_SUBSTR endtest, #<findlast>, 2, #<currentstring>
	COMPARE #<endtest>, "99"
	IF= @nextstring
	ADD searchoffset, "2"
	GOTO @loop
	END
@foundresult
	ADD results, "1"
	SET cookiename, "result#<results>"
	SET #<cookiename>, "#<slotnumber>"
	N: Slot #<slotnumber> contains a match.
	N: Keep Searching?
	ASK #<asktime>
	IF Qno @done
@nextstring
	ADD slotnumber, "1"
	COMPARE #<slotnumber>, "10"
	IF= @done
	SET searchoffset, 0
	SET findstring, "mslot#<slotnumber>"
	SET currentstring, "*#<findstring>"
	GOTO @loop
	END
@done
	COMPARE #<results>, "0"
	IF= @noresults
	SET resultcount, "1"
@subloop
	WAIT 0.1
	COMPARE #<resultcount>, #<results>
	IF> @end
	SET currentresult, "result#<resultcount>"
	N: Result #<resultcount> is in slot *#<currentresult>.
	ADD resultcount, "1"
	GOTO @subloop
	END
@end
	N: All Results stated.
	GOTO @actordraw
	END
@noresults
	N: No matches found.
	GOTO @actordraw
	END
@actordraw
	ACTOR 0, "OK" abc#<textcolor>, 34, 50, 50
	END
@eventActorClick0
@returntomenu
	N: View Stored Message/Exit?
@askagain
	N: Answer View or Exit.
	ASK #<asktime>
	IF QView @view
	IF QExit @exit
	N: Sorry, invalid option.
	N: Remember to capitalize.
GOTO @askagain
END

@view
	GOTO SCENE 272
END

@exit
	GOTO SCENE 271
END
END

;xxxxxxxx--------xxxxxxxx        <oxxxxx|==============> _.#*'*#._ <==============|xxxxxo>



;----------------------------------------------------------------------------------------------------------------------------

SCENE 294		aztec
	THEME	0
;	MUSIC	waltz2.mid
	ACTOR	1,	"Soul Brother", joshRoyalty, 5, 25, 90
	POSE	5, 5, 13
	SEL		1
	MOVE	1,	15, 80

	COMPARE #<num.mapNum>, 0
	IF< @continue
	IF> @continue

	IF T1, @continue
	' Greetings, new soul. You are about to embark upon an amazing voyage of discovery.
	' When sharing your journey with other souls, it is important that you obey the golden rule.
	' Do you agree to obey the golden rule? (type YES or NO)
	ASK 30
	IF -YES, @saidNo
	' Thank you, my child.  You shall never regret your decision.
	' Push the SHOP button when it appears.  You might find better equipment is available for you as your level increases.
	GIVE T1
	GOTO @continue
@saidNo
	' It is a sorry state that the world has fallen into.  You sadden me.
	' I cannot bring myself to give sustenance to such a renegade as you.
	' Begone!
	MOVE	1, -30, 80
	END

@continue

	IF ALIVE, @skip1
	' You seem to be dead, let me resurrect you.
	WAIT    2.0
	SOUND	"thunder1.wav"
	WAIT	1.0
@skip1
	MOVE	1,	10, 75
	GIVE	L1
	GIVE	H5000
	GIVE	M5000 
	IF I99,@skipTicket
	GIVE	I99				; give him a ticket home
@skipTicket
	; offer EVERYTHING under level 10
	IF T5 @offermore
	OFFER2	0,10
	' Blessings upon you, Soul.
	' You are always welcome here, to rest and recover... 
    IF T3, @skipQuest
COMPARE #<num.mapNum>, 0
	IF= @skipQuest		; only on main map (gateway, I hope)

	1: Say, %1, I wonder if you could aid me in a small quest...
	1: The date of the next meeting of the soul brotherhood has been changed.
    1: I don't think my brother in Monsterland Castle has been told.
	1: If you meet him in the Castle Well, please let him know.
	1: Thank you, my child!

@skipQuest
	IF V10, @skip2
	' Visit the town well in Monsterland Castle if you have need of training.
@skip2
END

@offermore
	OFFER2 11,22,0 0,10
IF V10, @skip3
	' Visit the town well in Monsterland Castle if you have need of training.
@skip3
END



;---------------------------------------------------
; we need a comment at the end, or bad things happen


