Beta contents

Prior to *Bookworm Adventures'* release, the game went through alpha, beta, and release candidate stages. On these stages, the game is constantly being changed for bugfixes or content additions/removals. On some occasions, there is a chance that the removed contents are shown on pre-release screenshots, videos, or even the internal game's data itself.

*Bookworm Adventures'* game data reveals some leftover beta contents in it, some of them even has working LUA-based scripts, albeit mostly compiled by a proprietary software. This page lists some beta contents of the game.

Due to the lack of media coverage and pre-release screenshots it's not possible to mention beta contents that were completely removed from the game's data.

See here for a tutorial on how to extract the main.pak

Note that all the luc (***LU***A ***C***ompiled) files are obfuscated, and are version 5.6. If you know how to decompile them, or if you have the tool to do it, feel free to share it here.

## cheat.luc

Self-explanatory. Probably used for debugging in the beta. It may be possible to use this script for cheating purposes, since it been found something related to cheating features such as add potion.

However, it been found some interesting strings that aren't found in the game. Probably some kind of developer notes.

**Spoiler warning**: The entire strings reveal the Bookworm Adventures' storyline.

### Book 1 Opening Cinematic

```
Book 1 Opening Cinematic ��

mData ��

images/cutscenes/intro.swf ��

mDesc �ý

If you have watched enough mystery cartoons you would have inferred right away that the first new character that is introduced (after Lex) would end up being the arch villian.

Definite cheese-factor, but don't forget we're also saving a princess here.
```

### Book 2 Opening Cinematic

```
Book 2 Intro Cinematic �

images/cutscenes/Book2Intro.swf ���

Codex had less interest in acquiring a 'weapon of awesome power' than he did in convincing Lex to release another book of monsters to further his scheme.

Astute players may have noticed the first hint of Codex's evil nature in his scowling demeanor in the final panel.
```

### Book 3 Opening Cinematic

```
Book 3 Intro Cinematic �

images/cutscenes/Book3Intro.swf ���

Unknown to the player, Dracula knew Codex's foul scheme and was ready when the twisted bird attempted to usurp his power.

To allay any suspicion that Codex was the antagonist, we had Codex use his wily guiles to come across as Dracula's victim by calling out to Lex for aid.
```

### Book 3 Conclusion Cinematic:

```
Book 3 Conclusion Cinematic ��

images/cutscenes/Book3End.swf �,�

Fans of the original Bookworm game may remember Lex as the Guardian of the Great Library.  Here we reveal that the entirety of Lex's adventure is how that came to be.

This also explains why Lex is much younger, shorter and more grub-like throughout his travels. Don't forget cuter. He's cuter too.
```

Additionally, we've found some strings related to Clips and Giggles.

### Oedipus Lex Main Theme

```
Oedipus Lex Main Theme ��   � �

This book draws inspiration from Homer's greats such as 'The Iliad' and 'The Odyssey', 'The 12 Labors of Hercules' and other assorted Greek myths. The 'Oedipus Lex' title came from a spirited brain-storming session and soundly won out over weaker ideas such as 'Mythical Monster Buffet'. �
```

### Arabian Knight Main Theme

```
Arabian Knight Main Theme �C   �)�

Originally named 'Arabian Nights', we apparently thought we were clever enough by spelling 'Night' as 'Knight'. This book draws inspiration from the stories of 'Ali Baba and the Forty Thieves', 'Aladdin', 'The Seven Voyages of Sinbad' and other assorted favorite tales from '1001 Arabian Nights'.
```

### Lexonomicon Main Theme

```
Lexonomicon Main Theme �€   �)�

This book draws inspiration from the darker side of fairy tales and gothic literature, but mostly focuses on classic western monster archetypes created by Bram Stoker, Mary Shelley and the like.  The title itself is a play on H.P. Lovecraft's fictional tome of evil knowledge, 'The Necronomicon'.
```

### Credits Theme

```
Credits Theme �N   �à

The funny thing about the credits theme is that it wasn't actually meant to be the credits music. We accidentally had the composer create an extra track for some game material that we cut and it wound up working out nicely.
```

## suckit.bin

Another inside joke title. However, unlike the other scripts, this one is not obfuscated. It seems to be written using LUA, just like the other scripts. The actual purpose of this script is unknown, but it appears to be an unfinished version of Book 2.

```
def Book2 = {}
def Book2_mt = { __index = Book2 }
setmetatable( Book2, { __index = Book } )

const MUSIC_ARABIAN_BATTLE = 42;
const MUSIC_ARABIAN_MAP = 67;
const MUSIC_ARABIAN_BOSS_FIGHT = 72;

function Book2:new(...)
	local newinst = Book2:Init();

    return newinst;
end

//	//////////////////////////////////////////////////////////////////////////
//				*********************NOTE***************************
//
//		The resource table for books is set up by the Book:CreateResourceTable
//	method, You should call that method when you have added all your chapters.
//	//////////////////////////////////////////////////////////////////////////

function Book2:Init()
	local t = Book:Init(2);
	setmetatable( t, Book2_mt );

	t.mBossFightMusicSongPos = MUSIC_ARABIAN_BOSS_FIGHT;
	t.mMapMusicSongPos = MUSIC_ARABIAN_MAP;
	t.mBattleMusicSongPos = MUSIC_ARABIAN_BATTLE;

	Book@t:AddCutScene("MaladinWave", "MysteriousAssassin", :gAppWidth - 180, 0, "INTRO", nil, nil, 1, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("MaladinLampWave", "Thief12_13_14", :gAppWidth - 180, 0, "INTRO", nil, nil, 2, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("Sinbad1", "SphinxPuzzle", :gAppWidth - 200, 0, "INTRO", nil, nil, 4, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("Sinbad2", "DreadPirateAlRobarts", :gAppWidth - 200, 0, "INTRO", nil, nil, 5, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("Sinbad3", "MamaRoc", :gAppWidth - 200, 0, "INTRO", nil, nil, 6, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("CrazyMurray", "CrazyMurray", :gAppWidth - 180, 0, "INTRO", nil, nil, 8, Book2.Anim1LoopCallback);
	Book@t:AddCutScene("Vizier", "TwistedVizier", :gAppWidth - 180, 10, "INTRO", nil, nil, 10, Book2.VizierPAMCallback);

	// For the iconified state
	t.mX = 210;
	t.mY = 101;
	t.mWidth = 352;
	t.mHeight = 96;
	t.mMiniMapIconImage = IMAGE_B2_MINIMAP_ICONS;

	t.mIconifiedText = "Arabian Knight";
	def t.mEndSWFTitle = "Arabian Knigh";
	t.mBookDescription = "Explore the dangerous desert.";
	t.mMapScreenHeader = "Book 2: Arabian Knight";
	t.mMapX, t.mMapY = 81, 0;
	def t.mMapBanner = nil;

	t.mChapterTreasureSuggestions[1] = "Bleed, Burning, Poison";
	t.mChapterTreasureSuggestions[2] = "Bleed, Stun, Tile Smash";
	t.mChapterTreasureSuggestions[3] = "Petrify, Plague Tile, Regenerate";
	t.mChapterTreasureSuggestions[4] = "Riddles, Riddles, Riddles";
	t.mChapterTreasureSuggestions[5] = "Bleed, Gem Steal, Regeneration";
	t.mChapterTreasureSuggestions[6] = "Bleed, Power Up, Tile Smash";
	t.mChapterTreasureSuggestions[7] = "A dose of mirage madness!";
	t.mChapterTreasureSuggestions[8] = "Bleed, Power Up, Stun";
	t.mChapterTreasureSuggestions[9] = "Armor, Curse, Tile Lock";
	t.mChapterTreasureSuggestions[10] = "Confusion, Petrify, Regeneration";

	// We'll set up image stuff in the load resources method later.

	t:AddChapter(1, 254, 119, "Chapter 1: Port of Alexandria", "\nLex begins his search for the magical weapon of awesome power in this populated and dangerous city port.");
	t:AddChapter(2, 158, 193, "Chapter 2: Lex Baba and the 14 Thieves", "\nPromised knowledge of the weapon's location, Lex fights Maladin's enemies deep in a cave vault. ");
	t:AddChapter(3, 165, 315, "Chapter 3: Tomb of the Ancients", "\nAbandoned by Maladin, Lex stumbles through a cursed Egyptian tomb.", false, 1);
	t:AddChapter(4, 277, 256, "Chapter 4: Riddle of the Sphinx", "\nMaking good with the Pharoah's ghost, Lex faces yet another barrier, the riddles of the Sphinx.");
	t:AddChapter(5, 390, 273, "Chapter 5: Thar be Pirates!", "\nLex sets sail aboard Sinbad's ship, only to be boarded by a crew of angry pirates!");

	t:AddChapter(6, 444, 334, "Chapter 6: Island of Immensity", "\nWashed ashore after the pirates destroy the ship, Lex must battle animals of unusual size in an attempt to find a way back to civilization.", false, 2);
	t:AddChapter(7, 568, 276, "Chapter 7: Mirage Mania", "\nDiscarded deep in the Arabian Desert, Lex goes mad, battling apparitions and mirages.");
	t:AddChapter(8, 496, 219, "Chapter 8: Crazy Murray's Bizarre Bazaar", "\nMaking his way across the desert, Lex comes upon a luxurious tent and a familiar face.", false, 3);
	t:AddChapter(9, 413, 108, "Chapter 9: Genies, Genies, Genies", "\nLex takes hold of the Genie Lamp and unwittingly lets loose an army of genies who do not bow to his will easily.");
	t:AddChapter(10, 539, 115, "Chapter 10: The Palace", "\nFinally besting the genies of the lamp, Lex is teleported to Scheherazade's Palace where its denizens suffer him one final round of grief before his questions are answered.", true);

	t:AddMiniGame(1, "WordMaster", 276, 206, "Moxie's Mini-game: WordMaster", "\nMoxie the Fox has an optional game for you! Guess her secret word in five tries or fewer in order to win an item to help you in your quest!", "DiamondTile", "RubyTile", "AmethystTile", "PurifyItem", "AttackItem");
	t:AddMiniGame(2, "LetterRip", 481, 244, "Moxie's Mini-game: LetterRip", "\nBuild as many words as you can from the letters of Moxie's word in order to acquire a useful prize!", "DiamondTile", "RubyTile", "AmethystTile", "PurifyItem", "AttackItem");
	t:AddMiniGame(3, "LinkNSpell", 580, 210, "Moxie's Mini-game: LinkNSpell", "\nSpell words and turn Moxie's tiles to gold to earn a reward both helpful and sparkly!", "DiamondTile", "RubyTile", "AmethystTile", "PurifyItem", "AttackItem");

	t:SetMiniGameText(1, GetTooltipText(WORD_MASTER_TT));
	t:SetMiniGameText(2, GetTooltipText(LETTER_RIP_TT));
	t:SetMiniGameText(3, GetTooltipText(LINK_N_SPELL_TT));

	t:ChapterConnect(1, 2);
	t:ChapterConnect(2, 3);
	t:ChapterConnect(3, 4);
	t:ChapterConnect(4, 5);
	t:ChapterConnect(5, 6);
	t:ChapterConnect(6, 7);
	t:ChapterConnect(7, 8);
	t:ChapterConnect(8, 9);
	t:ChapterConnect(9, 10);

	// CHAPTER 1

	t:AddEnemy(1, "Cutthroat", Book2.SetupStage, false);
	t:AddEnemy(1, "SnakeCharmer",	Book2.SetupStage, false);
	t:AddEnemy(1, "Bandit",		Book2.SetupStage, false);
	t:AddEnemy(1, "SwordSwallower",	Book2.SetupStage, false, false, true);
	t:AddEnemy(1, "Firebreather",		Book2.SetupStage, false);
	t:AddEnemy(1, "MysteriousAssassin",		Book2.SetupStage, true);
	t:SetTreasureSetupPtr(1, Book2.SetupStage);

	// CHAPTER 2

	t:AddEnemy(2, "Thief1",	Book2.SetupStage, false);
	t:AddEnemy(2, "Thief2_3",			Book2.SetupStage, false);
	t:AddEnemy(2, "Thief4_5",	Book2.SetupStage, false);
	t:AddEnemy(2, "Thief6_7_8",		Book2.SetupStage, false, false, true);
	t:AddEnemy(2, "Thief9_10_11", Book2.SetupStage, false);
	t:AddEnemy(2, "Thief12_13_14",		Book2.SetupStage, true);
	t:SetTreasureSetupPtr(2, Book2.SetupStage);

	// CHAPTER 3

	t:AddEnemy(3, "MonstrousScorpion",		Book2.SetupStage, false);
	t:AddEnemy(3, "UndeadHound",			Book2.SetupStage, false);
	t:AddEnemy(3, "MummifiedServant",		Book2.SetupStage, false, false, true);
	t:AddEnemy(3, "EmbalmedGuardian",	Book2.SetupStage, false);
	t:AddEnemy(3, "PharoahofOld",			Book2.SetupStage, true);
	t:SetTreasureSetupPtr(3, Book2.SetupStage);

	// CHAPTER 4

	t:AddEnemy(4, "SphinxPuzzle", Book2.SetupStage, true);
	t:SetTreasureSetupPtr(7, Book2.SetupStage);

	// CHAPTER 5

	t:AddEnemy(5, "BilgeDog",			Book2.SetupStage, false);
	t:AddEnemy(5, "Deckswabber",		Book2.SetupStage, false);
	t:AddEnemy(5, "Cannoneer",		Book2.SetupStage, false, false, true);
	t:AddEnemy(5, "Swashbuckler",		Book2.SetupStage, false);
	t:AddEnemy(5, "DreadPirateAlRobarts",		Book2.SetupStage, true);
	t:SetTreasureSetupPtr(5, Book2.SetupStage);

	// CHAPTER 6

	t:AddEnemy(6, "Elephant",		Book2.SetupStage, false);
	t:AddEnemy(6, "EnormousSerpent",			Book2.SetupStage, false);
	t:AddEnemy(6, "RocHatchling",		Book2.SetupStage, false, false, true);
	t:AddEnemy(6, "BullElephant",		Book2.SetupStage, false);
	t:AddEnemy(6, "MamaRoc",		Book2.SetupStage, true);
	t:SetTreasureSetupPtr(6, Book2.SetupStage);

	// CHAPTER 7

	t:AddEnemy(7, "MirageTrojan", Book2.SetupStage, false);
	t:AddEnemy(7, "MirageSkeleton", Book2.SetupStage, false);
	t:AddEnemy(7, "MirageNymph",	Book2.SetupStage, false, false, true);
	t:AddEnemy(7, "MirageGoat",	Book2.SetupStage, false);
	t:AddEnemy(7, "MirageLex",	Book2.SetupStage, true);
	t:SetTreasureSetupPtr(4, Book2.SetupStage);

	// CHAPTER 8

	t:AddEnemy(8, "FlyingSnake",	 Book2.SetupStage, false);
	t:AddEnemy(8, "FlyingWolf", Book2.SetupStage, false);
	t:AddEnemy(8, "FlyingPig",  Book2.SetupStage, false, false, true);
	t:AddEnemy(8, "FlyingArmor",	Book2.SetupStage, false);
	t:AddEnemy(8, "CrazyMurray",		 Book2.SetupStage, true);
	t:SetTreasureSetupPtr(8, Book2.SetupStage);

	// CHAPTER 9

	t:AddEnemy(9, "Afreet", Book2.SetupStage, false);
	t:AddEnemy(9, "FireSpirit",	Book2.SetupStage, false);
	t:AddEnemy(9, "Djinn",			Book2.SetupStage, false, false, true);
	t:AddEnemy(9, "AirSpirit",			Book2.SetupStage, false);
	t:AddEnemy(9, "Shaitan",			Book2.SetupStage, true);
	t:SetTreasureSetupPtr(9, Book2.SetupStage);

	// CHAPTER 10

	t:AddEnemy(10, "Hypnotist",		Book2.SetupStage, false);
	t:AddEnemy(10, "Summoner",		Book2.SetupStage, false);
	t:AddEnemy(10, "Elementalist",			Book2.SetupStage, false, false, true);
	t:AddEnemy(10, "Necromancer",			Book2.SetupStage, false);
	t:AddEnemy(10, "TwistedVizier",		Book2.SetupStage, true);
	t:SetTreasureSetupPtr(10, Book2.SetupStage);

	// You have to remember to set up where the tutorial/dialogs appear

	// after initial tiles are dropped in, this is the list of chapters w/ text
	//CHAPTER BEGIN
	t:AddInitialTileDialog(1);
	t:AddInitialTileDialog(2);
	t:AddInitialTileDialog(3);
	t:AddInitialTileDialog(4);
	t:AddInitialTileDialog(5);
	t:AddInitialTileDialog(7);
	t:AddInitialTileDialog(8);
	t:AddInitialTileDialog(9);

	// pan complete dialogs
	//PRE BOSS
	//t:AddPanCompleteDialog(1, nil, 2);
	//t:AddPanCompleteDialog(2, nil, 2);
	//t:AddPanCompleteDialog(4, nil, 2);
	//t:AddPanCompleteDialog(6, nil, 2);
	//t:AddPanCompleteDialog(9, nil, 2);

	// there are dialogs when you beat every boss monster in every chapter
	//VICTORY
	t:AddVictoryCompleteDialog(1, nil, 2);
	t:AddVictoryCompleteDialog(2, nil, 2);
	t:AddVictoryCompleteDialog(4, nil, 2);
	t:AddVictoryCompleteDialog(5, nil, 2);
	t:AddVictoryCompleteDialog(6, nil, 2);
	t:AddVictoryCompleteDialog(7, nil, 2);
	t:AddVictoryCompleteDialog(8, nil, 2);
	t:AddVictoryCompleteDialog(9, nil, 2);
	t:AddVictoryCompleteDialog(10, nil, 2);

	return t;
end

//  //////////////////////////////////////////////////////////////////////////
//						ON VICTORY COMPLETE
//
//	Called AFTER the user dismisses the treasure award sequence thing on the
//	altar stage.
//
//	Returns false to indicate that there is no special after-altar-sequence
//	cutscene going on.
//  //////////////////////////////////////////////////////////////////////////
function Book2:OnVictoryComplete(stage)

	local chap_num = self:GetSelectedChapter().mChapterNumber;

	if !Tutorial.NeedsStageTutorial(chap_num, stage) then
		return;
	end

	if (self:EnemyType(1, stage) == 2) && (chap_num == 1) then

		PlayCutScene("MaladinWave", false);
		return true;

	elseif (self:EnemyType(2, stage) == 2) && (chap_num == 2) then

		PlayCutScene("MaladinLampWave", false);
		return true;

	elseif (self:EnemyType(4, stage) == 2) && (chap_num == 4) then

		PlayCutScene("Sinbad1", false);
		return true;

	elseif (self:EnemyType(5, stage) == 2) && (chap_num == 5) then

		PlayCutScene("Sinbad2", false);
		return true;

	elseif (self:EnemyType(6, stage) == 2) && (chap_num == 6) then

		PlayCutScene("Sinbad3", false);
		return true;

	elseif (self:EnemyType(7, stage) == 2) && (chap_num == 7) then

		common.CPanelNew(common.CPANEL_LEX, -1, "So woozy... What is that in the distance, a tent!?  I'm saved!");
		// Let the battle engine know when this is done, so that it can return the player to the chapter selection screen
		convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
		convpanel.Activate(false);

	elseif (self:EnemyType(8, stage) == 2) && (chap_num == 8) then

		PlayCutScene("CrazyMurray", false);
		return true;

	elseif (self:EnemyType(9, stage) == 2) && (chap_num == 9) then

		common.CPanelNew(common.CPANEL_LEX, -1, "All those genies and no wishes granted? Maladin swindled me again!");
		common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "The great knight had learned a lesson of trickeries and deceit, and that there was no way to simply wish his troubles away.");
		common.LAST_PANEL_ALIGN_DIR = 1;
		common.CPanelAddPage(common.CPANEL_LEX, "That voice again! Always describing in detail my travels. I *really* wish I knew whose voice that was.");
		common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "And at last, the lamp honored his wish, teleporting him to a great palace.");

		// Let the battle engine know when this is done, so that it can return the player to the chapter selection screen
		convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
		convpanel.Activate(false);

	elseif (self:EnemyType(10, stage) == 2) && (chap_num == 10) then

		PlayCutScene("Vizier", false);
		return true;

	end

end

//  //////////////////////////////////////////////////////////////////////////////-
//						OnPanComplete
//
//	Called by the battle engine when panning is complete in case the book wants to
//	trigger a story panel.
//  //////////////////////////////////////////////////////////////////////////////-
function Book2:OnPanComplete(stage)
	local chap_num = self:GetSelectedChapter().mChapterNumber;

	if !Tutorial.NeedsStageTutorial(chap_num, stage) then
		return;
	end

	// No dialog currently...

end

//  //////////////////////////////////////////////////////////////////////////////-
//	Called after a book has completed and its cutscene is done and the user
//	is returned to the new map screen for the new book.
//  //////////////////////////////////////////////////////////////////////////////-
function Book2:OnNewBookStarted()
{
	if (profile.KeyExists("SeenBook2IntroDialog") && profile.Get("SeenBook2IntroDialog"))
		return;

	common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "I will tell you a story.",
								"One day a young knight came from a distant land seeking answers.");
	common.LAST_PANEL_ALIGN_DIR = 1;
	common.CPanelAddPage(common.CPANEL_LEX, "What? Who said that? I seek answers!");
	common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "His first steps would lead him through the great city of Alexandria and into the world of brigands, thieves and those of untrustworthy character.");
	common.LAST_PANEL_ALIGN_DIR = 1;
	common.CPanelAddPage(common.CPANEL_LEX, "Really? Hrm. Well I guess that's as good a place to start as any.");
	convpanel.SetInactiveCallback("Book2.BookIntroComplete");
	convpanel.Activate();
}

function Book2.BookIntroComplete()
{
	profile.Set("SeenBook2IntroDialog", true);
}

//  //////////////////////////////////////////////////////////////////////////////-
//						ChapterCompleted
//
//	Called when back at the chapter selection screen after completing the chapter.
//  //////////////////////////////////////////////////////////////////////////////-
function Book2:ChapterCompleted(chap_num, lex_won, from_options)

	if from_options then return; end

	Book@self:ChapterCompleted(chap_num, lex_won, from_options);

	if (:gBookManager:GetChapterNum(chap_num).mIsMiniGame)
	{
	//	if (!convpanel.Active())
	//		:gCApp:PlaySample(:SOUND_LEX_WARPIN);

		return;
	}

	if (:gBookManager:GetChapterNum(chap_num).mIsMiniGame)
		return;

	if !lex_won then
		if (!profile.KeyExists("HasDiedBefore") || !profile.Get("HasDiedBefore")) then
			profile.Set("HasDiedBefore", true);
			common.CPanelNew(common.CPANEL_LEX_WORRY, -1, "Dying is only a minor set back. While you use up any potions, you keep any experience you have gained. Click on Enter! to try again!");
		else
			local text = {	"Wha? I was cheated!  Put me back in coach!",
							"I'm down but not defeated! Lemme' at 'em!",
							"Dang! That was a close one! I'll get 'em this time!",
							"Bah! How did I lose? Gotta try again!",
							"Yipes! I can do better than that! I must get back in there and fight!"
						};

			local idx = sexy.NextRand() % *text;
			print("Index "..idx.." chosen for text");
			common.CPanelNew(common.CPANEL_LEX_WORRY, -1, text[idx]);
		end

		// Enable any minigames?
		if (profile.KeyExists("EnabledMiniGames"))
		{
			local any_closed, num = mAnyMGClosed, mNumMGClosed;
			mAnyMGClosed = false;
			mNumMGClosed = 0;

			if (num > 0)
			{
				if (any_closed)
					common.CPanelAddPage(common.CPANEL_MOXIE, "Hey! You look like you might need some more help!", "Here, I've reopened my mini-game hut so you can earn some more potions and gems before trying again!");
				else
					common.CPanelAddPage(common.CPANEL_MOXIE, "Hey there! Seems like you could use some help!", "Try visiting my mini-game hut on this map to earn some more potions and gems before trying again!");
			}
		}

		convpanel.SetInactiveCallback("Book.PlayWarpInSound");
		convpanel.Activate();
		return;
	end
	if chap_num == 1 then

		return;

	elseif chap_num == 2 then
		common.CPanelNew(common.CPANEL_MALADIN, 1, "Here we are, the Tomb of the Ancients. After you!");
		//										"With it you can take an extra heart of damage in battle!");
		//common.CPanelAddPage(common.CPANEL_LEX, "Oh! I like being damaged!");
		//common.CPanelAddPage(common.CPANEL_CASS, "No, little Lex, damage is bad for you.");
		//common.CPanelAddPage(common.CPANEL_LEX, "Oh yeah, that's right, I like cabbage, not damage.");

	elseif chap_num == 3 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "Exiting the mouth of the tomb, a mysterious wind took the knight over the hot dunes to the place where a still figure waited.");
		//convpanel.SetInactiveCallback("Book2.DoMiniGameDialog");
		//common.CPanelAddPage(common.CPANEL_MOXIE, "Hello again! Click on my mini-game hut to win some prizes to aid you in your quest!");
		//common.CPanelAddPage(common.CPANEL_LEX, "Maybe so, but I am fraught with total coolness!");
		//common.CPanelAddPage(common.CPANEL_CASS, "Yes, you have done well so far, but you musn't take the land of the dead so lightly.",
		//										"You may only take 3 treasures into each chapter, so choose wisely!");

	elseif chap_num == 4 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "Sinbad and the young knight took to sea, where they were soon beset by pirates.");
		//										"Here they are, in all their glory!\n\n\n");
		//common.CPanelAddPage(common.CPANEL_LEX, "Oooh sparkly.");
		//common.CPanelAddPage(common.CPANEL_HEPH, "From henceforth- spelling words of exceptional length will forge you a gem tile!",
		//										"These gem tiles will drastically increase your damage potential, as well as unleash a powerful effect!");
		//common.CPanelAddPage(common.CPANEL_LEX, "I like sparklies.");

	elseif chap_num == 5 then

		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "Washed ashore the travellers were, to a strange island where the very ground trembled.");
		//common.CPanelAddPage(common.CPANEL_LEX, "What the-? You’re not Cassandra!");
		//common.CPanelAddPage(common.CPANEL_MOXIE, "No, but I am a friend. Come by my mini-game hut if you wish, and win a few prizes to help defeat the Hydra!");
		//common.CPanelAddPage(common.CPANEL_LEX, "Oooh! Prizes!");

	elseif chap_num == 6 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "Forty nights the Papa Roc flew with Lex grasped in its talons, to the deepest desert.",
												"There it dropped the young knight and, enveloped in mirage, he saw things most strange.");
		//convpanel.SetInactiveCallback("Book2.DoMiniGameDialog");
		//common.CPanelAddPage(common.CPANEL_MOXIE, "It's me again! Come by my hut for another mini-game to prepare for your next adventure!");

		//common.CPanelAddPage(common.CPANEL_LEX, "Just north of me? That's great! So am I almost there?");
		//common.CPanelAddPage(common.CPANEL_CASS, "Yes! Just head on through the Nemean Forest and the River Evenus, and its legions of defenders and you'll be here!");
		//common.CPanelAddPage(common.CPANEL_LEX, "Oh yeah- sure. That sounds like a breeze!");

	elseif chap_num == 7 then
		common.CPanelNew(common.CPANEL_CODEX, 1, "How goes the search, Lex? Have you found the weapon I spoke of?");
		common.CPanelAddPage(common.CPANEL_LEX, "I fought a goat and a dancing skeleton and I even fought myself, I think. Does that sound crazed? Am I crazed?");
		common.CPanelAddPage(common.CPANEL_CODEX, "Despite your indirect path Lex, you seem to be heading in the right direction.  Fight on, and trust no one!");

	elseif chap_num == 8 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "And so the knight foolishly believed he could rub the lamp and wish his way to the weapon of great power.");
		common.LAST_PANEL_ALIGN_DIR = 1;
		common.CPanelAddPage(common.CPANEL_LEX, "And now to rub the lamp and wish my way to the weapon of great power!");
		common.LAST_PANEL_ALIGN_DIR = 1;
		common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "A new variety of danger would soon be his to face.");
		//convpanel.SetInactiveCallback("Book2.DoMiniGameDialog");
		//common.CPanelAddPage(common.CPANEL_LEX, "Something tells me they weren't always statues...");

	elseif chap_num == 9 then
		common.CPanelNew(common.CPANEL_LEX, -1, "Whoa, where am I? Looks like a suitably spooky palace!  I'm coming Cassandra!");
		//common.CPanelAddPage(common.CPANEL_LEX, "And now to rub the lamp and wish my way to the weapon of great power!");
		//common.CPanelAddPage(common.CPANEL_CASS, "A new variety of danger would soon be his to face.");
		//common.CPanelAddPage(common.CPANEL_LEX, "Something tells me they weren't always statues...");

	else
		return;
	end

	convpanel.Activate();
end

//  //////////////////////////////////////////////////////////////////////////
//						InitialTilesDone
//
//	Called when the initial placement of the tiles is complete. However, defer
//	if lex is still in his intro state.
//  //////////////////////////////////////////////////////////////////////////
function Book2:InitialTilesDone()

	if (:gBattleEngine.mStageNum > 1)
		return false;

	local lChapter = self:GetSelectedChapter().mChapterNumber;

	//These only trigger for the first stage, so regardless if we're continuing on a later stage,
	//just check stage 1, since if continuing, you'd have already passed the stage and thus wouldn't
	//need the tutorial and thus the call below would cause you to return
	if !Tutorial.NeedsStageTutorial(lChapter, 0) then
		return false;
	end

	if lChapter == 1 then

		common.CPanelNew(common.CPANEL_LEX, -1, "Now, I must find the great weapon Codex spoke of, and quickity-split!");

	elseif lChapter == 2 then

		common.CPanelNew(common.CPANEL_MALADIN, 1, "We are here, my friend. OPEN CAVE!",
												"There, the passage is open. Now--you defeat the 14 thieves and in the meantime, I will secure the treasure!");
		common.CPanelAddPage(common.CPANEL_LEX, "Treasure?  Oh! You must mean Cassandra. I treasure her, too!");
		common.CPanelAddPage(common.CPANEL_MALADIN, "Oh! Uh--why yes!  But of course that is what I mean! ");
		//common.CPanelAddPage(common.CPANEL_LEX, "Smithing!");
		//										"There you will see your first treasure, the Bow of Artemis.",
		//										"Treasures have effects that improve your fighting power.");

	elseif lChapter == 3 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "And so it was that the young knight entered the cursed tomb alone, fooled by Maladin's devious schemes.");
		common.LAST_PANEL_ALIGN_DIR = 1;
		common.CPanelAddPage(common.CPANEL_LEX, "That story telling voice again! I'm not alone, Maladin is right behind me.",
												"Right, Maladin?",
												"Uh... hello?");
		common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "But Maladin had already closed the door, leaving Lex trapped with thousand-year-old beings, roused from their slumber.");
		//										"Somewhere on this isle, the Sorceress Circe compels them to do her bidding!",
		//										"Find her and challenge her directly!");

	elseif lChapter == 4 then
		common.CPanelNewNoImage(Color(69, 25, 0), Color(154, 85, 0), "Before him was the Sphinx's challenge of riddles.",
												"To each riddle he had to find the answers quickly in succession, lest he fail and be consumed by the sands of the desert.");
		common.LAST_PANEL_ALIGN_DIR = 1;
		common.CPanelAddPage(common.CPANEL_LEX, "Wait, there'll be dessert? Like chocolate fudge brownie tiles?");
		common.CPanelAddPageNoImage(Color(69, 25, 0), Color(154, 85, 0), "The brave knight jested, but no one laughed. The Sphinx calmly uttered its first riddle.");
		//										"Somewhere on this isle, the Sorceress Circe compels them to do her bidding!",
		//										"Find her and challenge her directly!");

	elseif lChapter == 5 then

		common.CPanelNew(common.CPANEL_SINBAD, 1, "Welcome aboard my ship! Wait--who are all these people with swords and cannons and eye patches?");
		common.CPanelAddpage(common.CPANEL_LEX, "YAARRR! THAR BE PIRATES!");
		common.CPanelAddpage(common.CPANEL_SINBAD, "Oh no, not again.");
		//common.CPanelAddPage(common.CPANEL_LEX, "Hephaestus himself?  *Gasp* The god of smiting!");
		//common.CPanelAddPage(common.CPANEL_CASS, "Smithing.");
		//common.CPanelAddPage(common.CPANEL_LEX, "Smithing!");

/*
	elseif lChapter == 6 then

		common.CPanelNew(common.CPANEL_HEPH, 1, "Ho ho! Puny comedian!  I have provided for you an amethyst gem tile to begin with.");
		common.CPanelAddPage(common.CPANEL_HEPH, "Use this tile in any word to give your foe a walloping!",
													"Each tile has a unique effect in addition to increasing the word's power.",
													"Now be off heroic worm! Use my gift for good!");
*/

	elseif lChapter == 7 then

		common.CPanelNew(common.CPANEL_LEX, -1, "Everything purple... everything so hazy...");
		//common.CPanelAddPage(common.CPANEL_HEPH, "Use this tile in any word to give your foe a walloping!",
		//											"Each tile has a unique effect in addition to increasing the word's power.",
		//											"Now be off heroic worm! Use my gift for good!");

	elseif lChapter == 8 then

		common.CPanelNew(common.CPANEL_MURRAY, 1, "Hello customer, and welcome to Crazy Murray's exotic flying goods emporium. Feel free to browse.");
		common.CPanelAddPage(common.CPANEL_LEX, "Wait a second! You're not Crazy Murray, you're Maladin! You ditched me back in that... that ditch!");
		common.CPanelAddPage(common.CPANEL_MURRAY, "Ah yes! I knew I recognized you. Seize him, my flying followers! Eject this green menace!");

	elseif lChapter == 9 then
		common.CPanelNew(common.CPANEL_LEX, -1, "Whoa, I'm IN the lamp? And what is this power of his? 'Armored'?  This can't be good.");
		//										"and I'm not going to become another statue, no way!");
	else
		return false;
	end

	convpanel.SetGenericCompletionCallback("gBattleEngine:IntroDialogComplete");
	convpanel.Activate();

	return true;
end

///////////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////////
function Book2.SetupStage(arena_ptr, offset, stage_num)
{
	local chap_num = :gBookManager:GetSelectedChapter().mChapterNumber;
	local img;

	if (chap_num == 1)
		img = :IMAGE_B2A_DOCKSKY;
	else if (chap_num == 2)
		img = :IMAGE_B2A_BLACK3;
	else if (chap_num == 3)
		img = :IMAGE_B2A_BLACK2;
	else if (chap_num == 4)
		img = :IMAGE_B2A_PYRA_SKY;
	else if (chap_num == 5)
		img = :IMAGE_B2A_BLUE_SEA;
	else if (chap_num == 6)
		img = :IMAGE_B2A_BLUE_SEA2;
	else if (chap_num == 7)
		img = :IMAGE_B2A_MIRAGE;
	else if (chap_num == 8)
		img = :IMAGE_B2A_SKY8;
	else if (chap_num == 9)
		img = :IMAGE_B2A_SKY9;
	else if (chap_num == 10)
		img = :IMAGE_B2A_SUNSET;

	arena_ptr:AddObject(CreateArenaAnim(img, 0, 0, false), offset, nil, 0, nil);
}

function Book2.DoMiniGameDialog()
{
	:gCApp:DoGenericDialog("NEW MINI-GAME",
		"You've unlocked a new mini-game! Click on the purple tent to play and win prizes!", "", nil);
}

function Book2.Anim1LoopCallback(id, command, parameter, anim)
{
	if (command == "STOPPED")
	{
		anim.mDone = true;
		local sel_book = :gBookManager.mSelectedBook;

		if (anim.mPlayingFrame == "INTRO")
			anim:Play("ANIM1LOOP");
		else if (anim.mPlayingFrame == "ANIM1LOOP")
		{
			anim:Play("ANIM1LOOP");
			sel_book:CutSceneLoopComplete(1);
		}

		anim.mMessageMap[command] = anim.mPlayingFrame;
	}

}

function Book2.VizierPAMCallback(id, command, parameter, anim)
{
	if (command == "STOPPED")
	{
		anim.mDone = true;
		local sel_book = :gBookManager.mSelectedBook;

		if (anim.mPlayingFrame == "INTRO")
			anim:Play("ANIM1");
		else if (anim.mPlayingFrame == "ANIM1")
		{
			anim:Play("ANIM1LOOP");
			sel_book:VizierCutsceneTrigger(1);
		}
		else if (anim.mPlayingFrame == "ANIM1LOOP")
			anim:Play("ANIM1LOOP");
		else if (anim.mPlayingFrame == "ANIM2")
		{
			anim:Play("ANIM2LOOP");
			sel_book:VizierCutsceneTrigger(2);
		}
		else if (anim.mPlayingFrame == "ANIM2LOOP")
			anim:Play("ANIM2LOOP");
		else if (anim.mPlayingFrame == "ANIM3")
		{
			anim:Play("ANIM3LOOP");
			sel_book:VizierCutsceneTrigger(3);
		}
		else if (anim.mPlayingFrame == "ANIM3LOOP")
			anim:Play("ANIM3LOOP");

		anim.mMessageMap[command] = anim.mPlayingFrame;
	}
}

function Book2:VizierCutsceneTrigger(state)
{
	if (state == 1)
	{
		common.CPanelNew(common.CPANEL_VIZIER, 1, "Vile impetuous slug! You have only stoked my temper! Prepare for oblivion!");
		convpanel.SetInactiveCallback("Book2.SetupVizierScene2");
		convpanel.Activate(false);
	}
	else if (state == 2)
	{
		common.CPanelNew(common.CPANEL_SCHE2, 1, "STOP! You will not harm him. He has labored too long, and his quest is indeed honorable. Let his wounds be healed.");
		common.CPanelAddPage(common.CPANEL_VIZIER, "Gahhh! As you wish, Queen Scheherezade.");
		common.CPanelAddPage(common.CPANEL_SCHE2, "Brave knight, I know whom you seek, but she is not here. Your road is yet long. But listen well. There are stories within stories, wheels within wheels.");
		common.CPanelAddPage(common.CPANEL_LEX, "Could you be less specific?");
		common.CPanelAddPage(common.CPANEL_SCHE2, "You have had some experience with trickery and lies in your time here.  Your dark and sinister enemy is also shrouded in a cloak of such lies.");
		convpanel.SetInactiveCallback("Book2.SetupVizierScene3");
		convpanel.Activate(false);
	}
	else if (state == 3)
	{
		common.CPanelNew(common.CPANEL_SCHE2, -1, "Now, take the artifact. It is the great Scimitar of Justice which you seek. With it, perseverance and wisdom, you cannot fail.");
		common.CPanelAddPage(common.CPANEL_LEX, "Woohoo!");
		convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
		convpanel.Activate(false);
	}
}

function Book2.SetupVizierScene2()
{
	local sel_book = :gBookManager.mSelectedBook;
	sel_book.mCurrentCutScene.mPAM:play("ANIM2");
}

function Book2.SetupVizierScene3()
{
	local sel_book = :gBookManager.mSelectedBook;
	sel_book.mCurrentCutScene.mPAM:play("ANIM3");
}

function Book2:CutSceneLoopComplete(loop_num)
{
	mCutSceneLoopCount++;
	local chapnum = :gBookManager:GetSelectedChapter().mChapterNumber;
	local lLex = :gBattleEngine.mPlayerPtr;

	if (loop_num == 1)
	{
		if ((mCutSceneLoopCount == 2) && (chapnum == 1))
		{
			common.CPanelNew(common.CPANEL_MALADIN, 1, "Greetings, friend! I have witnessed your troubles. You seek Cassandra, yes?");
			common.CPanelAddPage(common.CPANEL_LEX, "Yes! Yes I do! Do you know anything?");
			common.CPanelAddPage(common.CPANEL_MALADIN, "Maladin knows many things. A band of evil thieves has taken her captive! Only I know the password to allow passage into their hideout!",
														"Come with me!");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
		else if ((mCutSceneLoopCount == 2) && (chapnum == 2))
		{
			common.CPanelNew(common.CPANEL_MALADIN, 1, "AHH! Giant green worm! You lived! I mean, uh--good to see you!");
			common.CPanelAddPage(common.CPANEL_LEX, "Goose gravy, Maladin! You should see how many thieves I just fought! They had numbered hats and everything!",
													"Nice lamp you've got there! So--did you find Cassandra?");
			common.CPanelAddPage(common.CPANEL_MALADIN, "Oh, right--her. They've hidden her in an ancient tomb not far from here. I'll show you!");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
		else if ((mCutSceneLoopCount == 2) && (chapnum == 4))
		{
			common.CPanelNew(common.CPANEL_SINBAD, 1, "Well done, worm hero! I am Sinbad! I was watching your brave deeds! Will you join my crew?");
			common.CPanelAddPage(common.CPANEL_LEX, "Well actually, I'm looking for this treasure, and this girl and there are all these monsters and-");
			common.CPanelAddPage(common.CPANEL_SINBAD, "You know? That sounds like a yes to adventure!  All aboard!");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
		else if ((mCutSceneLoopCount == 2) && (chapnum == 5))
		{
			common.CPanelNew(common.CPANEL_SINBAD, 1, "The pirates are defeated, but the ship is out of control and sinking! Why does this always happen?!");
			common.CPanelAddPage(common.CPANEL_LEX, "What??? It does? Why did I set sail with you in the first place?");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
		else if ((mCutSceneLoopCount == 2) && (chapnum == 6))
		{
			common.CPanelNew(common.CPANEL_SINBAD, 1, "Oh no, the Papa Roc has awakened! He's circling back around this way!");
			common.CPanelAddPage(common.CPANEL_LEX, "Yahhhh! He's swooping down to grab us with his talons!");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
		else if ((mCutSceneLoopCount == 2) && (chapnum == 8))
		{
			common.CPanelNew(common.CPANEL_MURRAY, 1, "Don't hurt me! Have mercy! Take all the flying merchandise you want! ");
			common.CPanelAddPage(common.CPANEL_LEX, "Oooh, flying birds. But no! Not this time! I'm taking that magic lamp!");
			common.CPanelAddPage(common.CPANEL_MURRAY, "The lamp? Trust me, you don't want that.");
			common.CPanelAddPage(common.CPANEL_LEX, "Hah! Trust you? Trust Mr. Tricky McTricksterman? No way! The lamp is mine!");
			convpanel.SetInactiveCallback("BattleEngine.TreasureDialogDone");
			convpanel.Activate(false);
		}
	}
}
```

## Early treasure names

In the beta version of the game, a lot of treasures have different names. They can be seen if you hex edit your save file. They can also be seen in the game's main.pak > scripts > treasures. Below is the list.

### Bookworm Adventures

 Arch of Xyzzy
 Boots of Theseus
 Medusa Bust
 Genie Lamp
 Robe of the Unseen
 Grim's Timepiece
 Immortal Wrapping
 Quadrumvir Signet

### Bookworm Adventures Volume 2

 Master's Zodiac
 Escape Button
 SemiFlange
 Magic Pen Cap

### Gallery

The treasure names shown from the main.pak data.The treasure names shown via hex editing a savegame.The treasure names shown from the main.pak data (BWA2)The treasure names shown via hex editing a savegame (BWA2)
### Trivia

#### Bookworm Adventures

* Medusa Bust's internal name is Gorgon Head, probably because it looks like a head and it belongs to a Gorgon.
* Grim's Timepiece internal name, Fates Coin/Fate's Coin, suggests that it looked like a coin in the beta. It also suggests that you were supposed to beat "Fate" instead of Grim in the beta.

#### Bookworm Adventures Volume 2

* Master's Zodiac internal name suggests that you were supposed to beat a farmer (Old MacDonald?) in the beta.
* Escape Button's internal name suggests that it was a tinfoil hat in the beta.
* Magic Pen Cap's internal name suggests that it was an unpetrified wood (probably a regular wood) in the beta.