User File #17820044610355222

Upload All User Files

#17820044610355222 - Hydlide lua script

Hydlide.lua
1168 downloads
Uploaded 10/3/2014 12:18 PM by dunnius (see all 3)
-- Hydlide HUD written by Michael "dunnius" Dunn

-- P() is Jim's position.
-- T is the terrain timer, when it goes down through 0 a HP is lost, when it goes up through 256(0), an HP is gained.
-- Fairy 1 is the tree number starting with 1 at the top.
-- Key is the chest number starting with 1 at the top on the top screen.
-- Fairy 2 is the enemy numbered tree.
-- Levels start with 1 based even though it is 0 based in memory.
-- The offscreen counters show, for enemies 1-4 in that order, approximately how many non-lag frames before the enemy spawns.  It may stay at 1 if it did not spawn.
-- Screen is the number of the current area that Jim is in.

-- Jim's hit box is blue, the enemies are red.
-- The enemy # is to the left of the hitbox, and the HP is inside on the top.  The lower number indicates the number of steps the enemy will take before deciding on a new direction.
-- There is a red indicator outside the text that shows the enemies direction.
-- The red areas are areas in which Jim cannot walk.


local Is_J_Version = false -- J version uses slightly different memory addresses
local do_drawing = true
local DrawEnemyActionTimer = true

-- variables
local EnemyMemBaseValue = 0x06EC
local EnemyTypeOffset = 0
local EnemyXPosOffset = 1
local EnemyYPosOffset = 2
local EnemyUnknown1Offset = 3
local EnemyOffscreenTimerOffset = 4
local EnemyDirectionOffset = 5
local EnemyNextActionTimerOffset = 6
local EnemyAnimationTimerOffset = 7
local EnemyHPOffset = 8
local EnemyUnknown2Offset = 9

-- List of blocked regions for each area
local AreaBlockages = {}
AreaBlockages[0] = { {14,4,2,1}, {4,6,2,1}, {18,10,2,1}, {10,12,2,1}, {14,16,2,1}, {8,18,2,1}, 0}
AreaBlockages[1] = { {6,0,2,1}, {2,4,2,1}, {8,3,2,1}, {12,6,2,1}, {8,8,2,1}, {18,8,2,2}, {4,16,2,1}, {14,4,4,3}, {10,10,12,1}, {10,11,1,11}, {13,13,3,1}, {18,13,4,1}, {13,14,1,8}, 0} -- {16,13,2,1,pot=n},
AreaBlockages[2] = {{14,0,2,1}, {18,10,2,2}, {10,0,1,11}, {13,0,1,13}, {0,10,10,1}, {14,12,8,1}, {0,13,10,1}, {10,13,1,3}, {11,15,11,1}, 0}
AreaBlockages[3] = {{12,16,2,1}, {0,12,7,1}, {7,12,2,3}, {9,14,1,8}, {0,15,4,1}, {4,15,1,3}, {5,17,2,1}, {6,18,1,4}, {8,0,1,8}, {8,10,1,2}, {9,13,13,1}, {11,0,4,2}, {11,2,1,5}, {11,7,4,1}, {14,4,1,3}, {17,0,5,1}, {17,1,5,1}, {11,10,7,1}, {17,4,1,6},{18,4,4,1}, {20,7,2,4}, 0}
AreaBlockages[4] = {{12,16,2,1}, {6,17,2,1}, {15,0,1,14}, {0,13,15,1}, {0,0,4,2}, {3,2,1,5}, {0,4,3,1}, {0,8,1,3}, {0,7,7,1}, {6,4,1,3}, {7,4,3,1}, {9,7,1,3}, {3,10,1,3}, {6,10,7,1}, {12,8,1,2}, {12,7,3,1}, {6,0,4,2}, {12,0,1,4}, {12,4,3,1}, 0} -- {9,5,1,2,pot=n},
AreaBlockages[5] = {{10,3,2,1}, {16,4,2,1}, {11,6,2,1}, {15,7,2,1}, {9,9,2,1}, {5,10,2,1}, {17,12,2,1}, {0,13,2,1}, {7,15,2,1}, {13,18,2,1}, 0}
AreaBlockages[6] = {{10,0,1,6}, {6,6,5,1}, {6,7,1,15}, {13,0,1,9}, {9,9,5,1}, {9,10,1,12}, 0}
AreaBlockages[7] = {0} -- desert none
AreaBlockages[8] = {{10,2,2,2}, {18,3,2,1}, {10,18,2,1}, {20,8,2,1}, {18,10,2,1}, {18,14,2,1}, {20,18,2,1}, {6,0,1,7}, {6,7,8,1}, {14,7,1,15}, {9,0,1,4}, {9,4,8,1}, {17,4,1,18}, 0}
AreaBlockages[9] = {{20,13,2,1}, {2,6,2,1}, {12,6,2,1}, {0,8,2,1}, {6,8,2,1}, {2,10,2,1}, {10,10,2,1}, {6,12,2,1}, {14,12,2,1}, {4,14,2,1}, {12,14,2,1}, {8,16,2,1}, {16,16,2,1}, {0,18,2,1}, {12,18,2,1}, {4,20,2,2}, {10,20,2,2}, {16,20,2,2}, 0}
AreaBlockages[10] = {{14,2,2,1}, {2,4,2,2}, {6,12,2,1}, {0,6,13,1}, {13,6,1,2}, {13,8,9,1}, {0,9,10,1}, {10,9,1,2}, {10,11,22,1}, 0}
AreaBlockages[11] = {{17,9,2,1}, {12,10,4,3}, {6,12,2,1}, {14,20,2,2}, {6,0,1,8}, {0,8,7,1}, {0,11,8,1}, {8,11,1,11}, {9,0,1,6}, {9,6,2,1}, {11,6,1,16}, {20,12,2,2}, {18,14,2,1}, {18,15,1,3}, {16,18,2,1}, {16,19,1,3}, 0}
AreaBlockages[12] = {{0,12,1,2}, {1,12,3,1}, {4,10,1,2}, {5,10,6,1}, {11,10,1,2}, {12,12,6,1}, {14,13,2,1}, {18,10,1,2}, {19,10,3,1}, {21,15,1,2}, {20,17,2,1}, {19,18,1,4}, {3,18,1,4}, {4,17,2,1}, {5,16,1,1}, {6,15,1,1}, {9,15,1,1}, {10,16,1,1}, {10,17,2,1}, {12,18,1,1}, {12,19,2,1}, {14,20,1,2}, 0} -- {7,15,2,1,dragon=n}, 
AreaBlockages[13] = {{16,14,2,1}, {18,2,2,1}, {20,4,2,1}, {18,8,2,2}, {14,0,1,13}, {14,13,8,1}, {17,0,1,10}, {17,10,5,1}, {0,10,5,1}, {5,10,1,2}, {6,12,3,1}, {9,12,1,2}, {10,14,2,1}, {11,15,1,1}, {12,16,2,1},{13,17,1,5}, {0,17,2,1}, {1,15,1,2}, {4,15,1,2}, {4,17,2,1},{6,18,1,1},{6,19,2,1},{8,20,1,2}, 0} -- {2,15,2,1,pot=n},
AreaBlockages[14] = {{4,0,2,1}, {10,0,2,1}, {16,0,2,1}, {6,2,2,1}, {14,2,2,1}, {0,4,2,1}, {10,4,2,2}, {18,4,2,2}, {4,6,2,1}, {2,8,2,2}, {8,14,2,1}, {16,14,2,1}, {18,15,2,1}, {0,10,10,1}, {10,6,1,5}, {11,6,11,1}, {0,13,10,1}, {10,13,1,9}, {13,9,9,1}, {13,10,1,12}, 0}
AreaBlockages[15] = {{4,4,2,1}, {18,4,2,1}, {14,6,2,1}, {10,8,2,1}, {16,16,2,1}, 0}
AreaBlockages[16] = {{14,0,2,1}, {2,8,2,1}, {11,0,1,4}, {12,4,4,1}, {16,0,1,4}, {8,0,1,7}, {8,7,2,1}, {10,8,1,2}, {11,9,1,1}, {12,10,1,12}, {15,10,1,12}, {16,9,1,1}, {17,8,1,2}, {18,10,1,3}, {18,13,2,1}, {20,14,2,2}, 0}
AreaBlockages[17] = {{4,6,2,2}, {8,2,4,3}, {12,5,2,1}, {10,8,2,1}, {3,0,1,8}, {4,8,2,1}, {5,9,1,1}, {6,10,2,1}, {7,11,1,1}, {8,12,4,1}, {14,0,1,10}, {12,10,2,1}, {12,11,1,1}, {0,14,1,2}, {1,15,3,1}, {4,16,1,2}, {5,17,8,1}, {13,16,1,2}, {14,15,2,1}, {16,16,1,2}, {17,17,2,1}, {19,0,1,5}, {18,5,2,1}, {17,6,1,4}, {18,10,2,1}, {19,11,1,7}, 0} -- {10,6,2,2,burntree=y}, 
AreaBlockages[18] = {{8,0,1,3}, {8,3,2,1}, {10,4,1,3}, {10,7,2,1}, {8,8,5,1}, {8,9,1,13}, {13,0,1,4}, {14,4,2,1}, {15,5,1,1}, {16,6,2,1}, {17,7,1,1}, {18,8,4,1}, {11,11,11,1}, {11,12,1,10}, 0}
AreaBlockages[19] = {{10,0,1,8}, {0,8,11,1}, {13,0,1,11}, {0,11,14,1}, 0}
AreaBlockages[20] = {{16,6,2,1}, {11,15,2,1}, 0}
AreaBlockages[21] = {{8,18,2,1}, {6,20,2,2}, {12,0,1,13}, {12,13,10,1}, {15,0,1,10}, {15,10,7,1}, 0}
AreaBlockages[22] = {{10,6,2,1}, {14,20,2,2}, {0,10,13,1}, {13,10,1,2}, {13,12,9,1}, {0,13,10,1}, {10,13,1,9}, {13,15,9,1}, {13,16,1,6}, 0}
AreaBlockages[23] = {{8,0,1,4}, {2,4,7,1}, {2,5,1,7}, {0,12,3,1}, {11,0,1,7}, {5,7,7,1}, {5,8,1,7}, {0,15,6,1}, {14,6,8,1}, {14,7,1,5}, {8,12,7,1}, {8,13,1,9}, {20,7,2,3}, {17,9,1,3}, {17,12,5,1}, {11,15,11,1}, {11,16,1,3}, {14,18,4,1}, {14,19,1,3}, {11,21,3,1}, {20,18,2,3}, {17,21,5,1}, 0}
AreaBlockages[24] = {{0,6,15,1}, {15,6,1,16}, {12,7,1,3}, {0,7,1,2}, {0,9,10,1}, {9,10,1,2}, {9,12,4,1}, {0,15,1,1}, {12,15,3,1}, {0,12,7,1}, {3,13,1,5}, {0,18,4,1}, {0,19,1,2}, {0,21,4,1}, {6,13,1,2}, {6,15,3,1}, {9,15,1,6}, {10,18,2,1}, {12,18,1,4}, {6,18,1,3}, {6,21,4,1}, 0}
AreaBlockages[25] = {{0,0,22, 2}, {0,2,1,20}, {21,2,1,3}, {21,7,1,15}, {1,4,3,1}, {1,13,3,1}, {3,14,1,3}, {3,19,1,3}, {4,19,2,1}, {6,16,1,4}, {7,16,2,1}, {9,16,1,4}, {10,19,2,1}, {12,19,1,3}, {12,2,1,2}, {12,4,4,1}, {18,4,1,3}, {15,7,4,1}, {15,10,1,3}, {18,10,1,3}, {12,13,7,1}, {12,14,1,3}, {15,16,6,1}, {15,17,1,3}, {18,19,1,3}, {9,7,4,1}, {9,4,1,3}, {6,4,3,1}, {6,5,1,3}, {3,7,3,1}, {3,8,1,2}, {3,10,3,1}, {6,10,1,3}, {6,13,3,1}, {9,10,1,4}, {10,10,3,1}, 0}
AreaBlockages[26] = {{0,0,1,20}, {0,20,22,2}, {21,0,1,20}, {3,0,1,2}, {3,2,3,1}, {6,2,1,4}, {12,0,1,2}, {9,2,4,1}, {9,3,1,3}, {18,0,1,3}, {15,2,1,7}, {12,5,3,1}, {12,6,1,3}, {3,5,1,3}, {3,8,4,1}, {1,11,6,1}, {9,8,1,3}, {9,11,3,1}, {12,11,1,4}, {18,5,3,1}, {18,6,1,5}, {15,11,4,1}, {3,14,1,4}, {4,14,2,1}, {6,14,1,3}, {6,17,3,1}, {9,14,1,4}, {15,14,1,3}, {12,17,4,1}, {12,18,1,2}, {18,14,1,4}, 0}
AreaBlockages[27] = {{0,0,22,2}, {0,2,1,20}, {21,2,1,20}, {6,2,1,2}, {3,4,4,1}, {15,2,1,3}, {9,4,3,1}, {12,4,1,4}, {18,4,1,3}, {15,7,4,1}, {15,8,1,2}, {15,10,4,1}, {3,7,4,1}, {3,8,1,2}, {1,10,3,1}, {9,7,1,3}, {6,10,7,1}, {6,11,1,2}, {3,13,4,1}, {3,14,1,2}, {3,16,6,1}, {9,13,1,6}, {6,19,4,1}, {3,19,1,3}, {12,13,4,1}, {12,14,1,3}, {18,13,3,1}, {12,19,1,3}, {15,16,4,1}, {15,17,1,5}, {18,17,1,5}, 0}
AreaBlockages[28] = {{0,0,1,22}, {21,0,1,22}, {1,20,20,2}, {3,0,1,3}, {12,0,1,3}, {15,0,1,5}, {15,5,4,1}, {18,0,1,3}, {6,2,1,7}, {3,5,3,1}, {3,6,1,3}, {9,2,1,4}, {10,5,2,1}, {12,5,1,3}, {12,8,4,1}, {18,8,3,1}, {1,11,2,1}, {3,11,1,4}, {9,8,1,3}, {6,11,7,1}, {9,12,1,3}, {15,11,6,1}, {6,14,1,3}, {1,17,6,1}, {12,14,4,1}, {12,15,1,2}, {9,17,7,1}, {9,18,1,2}, {18,14,1,6}, 0}
AreaBlockages[29] = {{0,0,2,22}, {2,0,20,1}, {2,21,20,1}, {2,3,6,1}, {10,1,1,3}, {19,1,1,2}, {13,3,7,1}, {13,4,1,3}, {4,6,1,4}, {7,6,4,1}, {16,6,1,4}, {19,6,3,1}, {7,9,1,4}, {10,9,3,1}, {13,9,1,4}, {19,9,3,1}, {2,12,3,1}, {10,12,1,7}, {11,15,3,1}, {16,12,6,1}, {4,15,4,1}, {4,18,4,1}, {13,18,1,3}, {19,18,3,1}, {16,15,4,1}, {16,16,1,3}, 0}
AreaBlockages[30] = {{0,0,22,1}, {20,1,2,21}, {0,21,20,1}, {2,1,1,2}, {2,3,4,1}, {8,1,1,2}, {8,3,10,1}, {11,4,1,3}, {0,6,8,1}, {8,6,1,3}, {8,9,7,1}, {14,6,1,3}, {11,10,1,3}, {17,6,1,10}, {18,9,2,1}, {14,12,3,1}, {0,9,3,1}, {0,18,3,1}, {11,18,1,3}, {5,9,1,10},
{6,18,3,1}, {0,12,5,1}, {2,13,1,3}, {6,12,2,1}, {8,12,1,3}, {8,15,7,1}, {14,16,1,2}, {14,18,3,1}, {17,18,1,3}, 0}
AreaBlockages[31] = {{0,0,22,1}, {0,1,1,20}, {21,1,1,20}, {0,21,22,1}, {6,1,1,3}, {15,1,1,3}, {18,3,3,1}, {9,3,4,1}, {9,4,1,6}, {3,3,1,4}, {4,6,2,1}, {6,6,1,6}, {3,12,4,1}, {3,13,1,3}, {1,9,3,1}, {9,18,1,3}, {15,18,1,3}, {15,9,1,3}, {15,12,6,1}, {18,13,1,6}, {12,6,7,1}, {18,7,1,3}, {12,7,1,12}, {13,15,3,1}, {9,12,3,1}, {9,13,1,2}, {6,15,4,1}, {6,16,1,2}, {1,18,6,1}, 0}
AreaBlockages[32] = {{0,0,1,22}, {3,0,19,1}, {21,1,1,3}, {21,6,1,16}, {1,21,20,1}, {1,3,3,1}, {1,9,3,1}, {3,12,1,4}, {6,1,1,18}, {3,6,3,1}, {3,18,3,1}, {7,12,2,1}, {9,10,1,3}, {9,9,7,1}, {15,10,1,2}, {15,12,4,1}, {12,1,1,3}, {9,3,1,4}, {12,6,4,1}, {15,3,3,1}, {18,3,1,7}, {19,6,2,1}, {18, 15,3,1}, {12,18,1,3}, {12,12,1,3}, {9,15,7,1}, {9,16,1,3}, {15,16,1,2}, {15,18,4,1}, 0}
AreaBlockages[33] = {{0,0,22,1}, {0,1,1,3}, {21,1,1,19}, {19,20,3,2}, {0,6,1,14}, {0,20,3,2}, {9,6,1,1}, {15,13,1,1}, {5,15,1,1}, 0}
AreaBlockages[34] = {{0,0,3,2}, {19,0,3,2}, {0,2,1,20}, {21,2,1,20}, {1,21,20,1}, {1,2,3,1}, {18,2,3,1}, {10,12,2,1}, {4,7,14,1}, {4,8,1,10}, {17,8,1,10}, {7,10,1,7}, {14,10,1,7}, {8,16,6,1}, 0}


--functions


local function GetRNG()
	RNG_1 = memory.readbyte(0x002E)
	RNG_2 = memory.readbyte(0x002F)
	return RNG_1*256 + RNG_2
end


local function ToScreenXPos(GamePos)
	return GamePos * 8 + 8
end


local function ToScreenYPos(GamePos)
	return GamePos * 8 + 16
end


local function DrawEnemyDirection(Left, Top, Right, Bottom)
	if(EnemyDirection == 0)	then -- down
		gui.drawbox(Left, Bottom, Right, Bottom+2, {0,0,0,0xFF}, {0xFF,0,0,0xFF})	end
	if(EnemyDirection == 1)	then -- left
		gui.drawbox(Left, Top, Left - 2, Bottom, {0,0,0,0xFF}, {0xFF,0,0,0xFF})	end
	if(EnemyDirection == 2)	then -- up
		gui.drawbox(Left, Top, Right, Top-2, {0,0,0,0xFF}, {0xFF,0,0,0xFF})	end
	if(EnemyDirection == 3)	then -- right
		gui.drawbox(Right, Top, Right+2, Bottom, {0,0,0,0xFF}, {0xFF,0,0,0xFF})	end
end


local function DrawEnemyHitBox(Type, X, Y)
	XLength = 2
	YLength = 2

	if(Type == 0x07)	then -- slime
		YLength = 1	end
	if(Type == 0x08)	then -- kobold
		XLength = 1	end
	if(Type == 0x0A)	then -- eel
		XLength = 1	end
	if(Type == 0x0E)	then -- stirge
		YLength = 1	end
	if(Type == 0x0F) -- wasp
	then
		XLength = 1
		YLength = 1
	end
	if(Type == 0x11) -- firebal
	then
		XLength = 1
		YLength = 1
	end
	if(Type == 0x12)	then -- dragon
		XLength = 3	end
	if(Type == 0x13) -- varalys
	then
		XLength = 3
		YLength = 3
	end

	gui.drawbox(ToScreenXPos(X), ToScreenYPos(Y), ToScreenXPos(X+XLength), ToScreenYPos(Y+YLength), 0, {0xFF,0,0,0xFF})
end


local function DrawArea(CurrentArea)
	if(CurrentArea < 0) or (CurrentArea >= 35)	then
		return	end
	if(AreaBlockages[CurrentArea] == 0)	then
		return	end

	c=1
	CurrentBlock = AreaBlockages[CurrentArea][c]
	while(CurrentBlock ~= 0)
	do
		left = AreaBlockages[CurrentArea][c][1]
		top = AreaBlockages[CurrentArea][c][2]
		right = left + AreaBlockages[CurrentArea][c][3]
		bottom = top + AreaBlockages[CurrentArea][c][4]
		gui.drawbox(ToScreenXPos(left), ToScreenYPos(top), ToScreenXPos(right), ToScreenYPos(bottom), {0x80,0,0,0x80}, {0x80,0,0,0x80})

		c = c + 1
		CurrentBlock = AreaBlockages[CurrentArea][c]
	end
end


local function main_draw()
	if(do_drawing == false)	then
		return	end
	if(Is_J_Version)
	then
		PosX = memory.readbyte(0x0034)
		PosY = memory.readbyte(0x0035)
		CurrentArea = memory.readbyte(0x0045)
		CurrentHP = memory.readbyte(0x0036)
		MaxHP = memory.readbyte(0x003F)
		CurrentStrength = memory.readbyte(0x0037)
		CurrentExperience = memory.readbyte(0x0038)
		CurrentMP = memory.readbyte(0x0039)
		MaxMP = memory.readbyte(0x0040)
		CurrentLevel = memory.readbyte(0x003A)
		DamageTimer = memory.readbyte(0x003B)
		KeyChestPosition = memory.readbyte(0x006E)
		Fairy1TreePosition = memory.readbyte(0x0078)
		Fairy2TreePosition = memory.readbyte(0x007A)
		RNG1 = memory.readbyte(0x002C)
		RNG2 = memory.readbyte(0x002D)
	else
		PosX = memory.readbyte(0x0036)
		PosY = memory.readbyte(0x0037)
		CurrentArea = memory.readbyte(0x0047)
		CurrentHP = memory.readbyte(0x0038)
		MaxHP = memory.readbyte(0x0041)
		CurrentStrength = memory.readbyte(0x0039)
		CurrentExperience = memory.readbyte(0x003A)
		CurrentMP = memory.readbyte(0x003B)
		MaxMP = memory.readbyte(0x0042)
		CurrentLevel = memory.readbyte(0x003C)
		DamageTimer = memory.readbyte(0x003D)
		KeyChestPosition = memory.readbyte(0x0070)
		Fairy1TreePosition = memory.readbyte(0x007A)
		Fairy2TreePosition = memory.readbyte(0x007C)
		RNG1 = memory.readbyte(0x002E)
		RNG2 = memory.readbyte(0x002F)
	end
	RNG = RNG1*256 + RNG2

	-- Draw Player Info
	gui.text(1, 9, string.format("P(%2d,%2d)", PosX, PosY))
	gui.drawbox(ToScreenXPos(PosX), ToScreenYPos(PosY), ToScreenXPos(PosX+2), ToScreenYPos(PosY+2), 0, {0,0,0xFF,0xFF})

	gui.text(50, 9, string.format("T %3d", DamageTimer))
	gui.text(90, 9, string.format("RNG: %5d", RNG))
	gui.text(160, 9, string.format("F1: %2d", Fairy1TreePosition))
	gui.text(200, 9, string.format("K: %1d", KeyChestPosition))
	gui.text(228, 9, string.format("F2: %1d", Fairy2TreePosition))

	gui.text(192, 48, string.format("Level %2d", CurrentLevel + 1)) -- make it 1 based
	gui.text(192, 64, string.format("%3d/%3d", CurrentHP, MaxHP))
	gui.text(192, 87, string.format("%3d", CurrentStrength))
	gui.text(192, 111, string.format("%3d", CurrentExperience))
	gui.text(192, 135, string.format("%3d/%3d", CurrentMP, MaxMP))

	gui.text(200, 192, string.format("Screen %2d", CurrentArea))

	DrawArea(CurrentArea)

	-- Draw Enemy Info
	gui.text(72,192,"Offscreen:")
	for i=1,8
	do
		ThisEnemyBase = EnemyMemBaseValue + 10 * (i-1)
		EnemyType = memory.readbyte( ThisEnemyBase + EnemyTypeOffset) -- 0
		EnemyX = memory.readbyte(ThisEnemyBase + EnemyXPosOffset) -- 1
		EnemyY = memory.readbyte(ThisEnemyBase + EnemyYPosOffset) -- 2
		EnemyUnknown1 = memory.readbyte(ThisEnemyBase + EnemyUnknown1Offset) -- 3
		EnemyOffscreenTimer = memory.readbyte(ThisEnemyBase + EnemyOffscreenTimerOffset) -- 4
		EnemyDirection = memory.readbyte(ThisEnemyBase + EnemyDirectionOffset) -- 5
		EnemyNextActionTimer = memory.readbyte(ThisEnemyBase + EnemyNextActionTimerOffset) -- 6
		EnemyAnimationTimer = memory.readbyte(ThisEnemyBase + EnemyAnimationTimerOffset) -- 7
		EnemyHP = memory.readbyte(ThisEnemyBase + EnemyHPOffset) -- 8
		EnemyUnknown2 = memory.readbyte(ThisEnemyBase + EnemyUnknown2Offset) -- 9
		ValueSum = EnemyType + EnemyX + EnemyY + EnemyUnknown1 + EnemyOffscreenTimer + EnemyDirection + EnemyNextActionTimer + EnemyAnimationTimer + EnemyHP + EnemyUnknown2

		if(ValueSum ~= 0) and (EnemyOffscreenTimer == 0)
		then
			EnemyScreenX = ToScreenXPos(EnemyX)
			EnemyScreenY = ToScreenYPos(EnemyY)

			gui.text(EnemyScreenX-8, EnemyScreenY+1, string.format("%1d%3d", i, EnemyHP), {0xFF,0xFF,0xFF,0xFF}, {0,0,0,0x80})
			if(DrawEnemyActionTimer == true)	then
				gui.text(EnemyScreenX, EnemyScreenY+9, string.format("%2d",EnemyNextActionTimer))	end
			DrawEnemyDirection(EnemyScreenX, EnemyScreenY, EnemyScreenX + 16, EnemyScreenY + 8)
			DrawEnemyHitBox(EnemyType, EnemyX, EnemyY)
		end

		if(i<=4)	then
			gui.text(128+16*(i-1),192,string.format("%2d",EnemyOffscreenTimer))	end
	end
end


--REMOTE CONTROL--
local controller_input = {}

local function AdvanceFrames(count) -- <= 0 means no advance
	for i=1,count	do
		emu.frameadvance()	end
	if(count > 0)	then
		controller_input = {}	end
end

                            
local function PushButton(key, is_clearing) -- is_clearing is true or false
	if(key == "clear")	then
		controller_input = {}	end
	if(key == "up")	then
		controller_input["up"] = not is_clearing	end
	if(key == "down")	then
		controller_input["down"] = not is_clearing	end
	if(key == "left")	then
		controller_input["left"] = not is_clearing	end
	if(key == "right")	then
		controller_input["right"] = not is_clearing	end
	if(key == "A")	then
		controller_input["A"] = not is_clearing	end
	if(key == "B")	then
		controller_input["B"] = not is_clearing	end
	if(key == "start")	then
		controller_input["start"] = not is_clearing	end
	if(key == "select")	then
		controller_input["select"] = not is_clearing	end
	joypad.set(1, controller_input)
end


local function DoRunStart(DoReset)
	if(DoReset == true)	then
		emu.poweron()	end
	AdvanceFrames(7)
	PushButton("start")
	AdvanceFrames(24)
end


local function DoSoftReset()
	emu.softreset()
	AdvanceFrames(27)
end


local function MenuToGame(delay_count)
	for i=1,delay_count	do
		AdvanceFrames(9)	end
	PushButton("start")
	AdvanceFrames(58)
end


local function MenuHandleDemoOld(delay_count, monster_delay)
	AdvanceFrames(840)
	for i=1,delay_count	do
		AdvanceFrames(6)	end
	AdvanceFrames(2*monster_delay)
	PushButton("start")
	AdvanceFrames(15)
end


local function MenuHandleDemo(RNG_delay)
	AdvanceFrames(783)
	if(RNG_delay == true)	then
		AdvanceFrames(8)	end
	DoSoftReset()
end


local function MenuToPassword(delay_count)
	for i=1,delay_count	do
		AdvanceFrames(9)	end
	PushButton("down")
	AdvanceFrames(10)
	PushButton("start")
	AdvanceFrames(14)
end


local function PasswordErrorOld()
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(122)
	PushButton("start")
	AdvanceFrames(15)
end


local function PasswordError()
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(1)
	DoSoftReset()
end


local function Password3DGolfSuperVer()
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("up")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("up")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("up")
	AdvanceFrames(2)
	PushButton("left")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("up")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("down")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("right")
	AdvanceFrames(2)
	PushButton("A")
	AdvanceFrames(3)
	PushButton("A")
	AdvanceFrames(50)
end


local function GameMoveSlow(direction, is_monster)
	PushButton(direction)
	if(is_monster == true)	then
		PushButton("A")	end
	AdvanceFrames(6)
	if(is_monster == true)	then
		AdvanceFrames(2)	end
end


local function GameMenuGame(direction, is_monster, do_reset)
	PushButton(direction)
	PushButton("select")
	if(is_monster == true)	then
		PushButton("A")	end
	AdvanceFrames(26)
	if(is_monster == true)	then
		AdvanceFrames(2)	end
	PushButton("up")
	AdvanceFrames(12)
	PushButton("select")
	if(do_reset)
	then
		AdvanceFrames(1)
		DoSoftReset()
	else
		AdvanceFrames(10)
	end
end


local function GameMenuChangeSpeed(direction, is_monster)
	PushButton(direction)
	PushButton("select")
	if(is_monster == true)	then
		PushButton("A")	end
	AdvanceFrames(26)
	if(is_monster == true)	then
		AdvanceFrames(2)	end
	PushButton("up")
	AdvanceFrames(12)
	PushButton("up")
	AdvanceFrames(12)
	PushButton("select")
	AdvanceFrames(13)
	PushButton("down")
	AdvanceFrames(12)
	PushButton("select")
	AdvanceFrames(10)
end


local function GameDeath()
	AdvanceFrames(129)
	PushButton("start")
	AdvanceFrames(15)
end


--when attacking, the delay needs to be added manually
local function MoveFast(direction, attacking, delay)
	PushButton(direction)
	if(attacking == true)	then
		PushButton("A")	end
	AdvanceFrames(4+delay)
end


-- delay_list is a list that must have (at least) count items
--            but it can be a 0 which means all elements are 0
local function MultiMove(direction, count, delay_list)
	for i=1,count
	do	
		if(delay_list ~= 0)	then
			MoveFast(direction, false, delay_list[i])
		else
			MoveFast(direction, false, 0)	end
	end	
end


local function U_MultiMoveAttack(direction, count, skip_position_check)
	PosMem = 0
	PosSeek = -1
	if(direction == "left")
	then
		PosMem = 0x0036 -- X
		PosSeek = memory.readbyte(PosMem) - count
	end
	if(direction == "right")
	then
		PosMem = 0x0036 -- X
		PosSeek = memory.readbyte(PosMem) + count
	end
	if(direction == "up")
	then
		PosMem = 0x0037 -- Y
		PosSeek = memory.readbyte(PosMem) - count
	end
	if(direction == "down")
	then
		PosMem = 0x0037 -- Y
		PosSeek = memory.readbyte(PosMem) + count
	end

	if(PosSeek < 0) or (PosSeek > 20)	then
		return false	end

	mma_state = savestate.create()
	savestate.save(mma_state)
	savestate.persist(mma_state)
	for c=1,50
	do
		MoveFast(direction, true, 0)
		while(emu.lagged() == true)
		do
			savestate.save(mma_state)
			emu.frameadvance()
			HP = memory.readbyte(0x0038)
			if(HP == 0)	then
				return false	end
		end
		if(HP == 0)	then
			return false	end
		savestate.load(mma_state)
		if(skip_position_check == false)
		then
			if(memory.readbyte(PosMem) == PosSeek)	then
				return true	end
		else
			if(c == count) then
				return true	end
		end
	end
	return false
end


local function MultiMoveStutter(direction, count, delay_list)
	for i=1,count
	do	
		MoveFast("clear", false, 0) -- stutter

		if(delay_list ~= 0)
		then
			MoveFast(direction, false, delay_list[i])
		else
			MoveFast(direction, false, 0)
		end
	end
end


local function MultiMoveStutterAttack(direction, count) -- (U) version
	for i=1,count
	do	
		MoveFast("clear", false, 0) -- stutter
		if( U_MultiMoveAttack(direction, 1, false) == false)	then
			return false	end
	end
	return true
end


-- array_list example: (array_count 4, array_stutter_count 12)
-- { {"left", 6, false},	each contain: direction, steps, stutter_flag
--   {"left", 1, true},
--   {"left", 3, false}
--   {"left", 11, true} }
-- array_count is the number of items in the array
-- array_stutter_count is the sum of the steps that have the stutter_flag set
local function MultiMoveDistribute(array_list, array_count, array_stutter_count, stutter_count)
	dist_delay = stutter_count / array_stutter_count
	extra_delay = stutter_count % array_stutter_count
	for c=1,array_count
	do
		direction = array_list[c][1]
		steps = array_list[c][2]
		stutter_flag = array_list[c][3]
		if(stutter_flag == false)
		then
			U_MultiMoveAttack(direction, steps, false)
		else
			step_count = math.max(steps,1)
			for n=1,step_count
			do
				delay_amt = dist_delay
				if(extra_delay > 0)
				then
					delay_amt = delay_amt + 1
					extra_delay = extra_delay - 1
				end
				MultiMove("clear", delay_amt, 0)
				if(steps ~= 0)	then
					U_MultiMoveAttack(direction, 1, false)	end
			end
		end
	end
end


local function MultiMoveAttackArray(u_m_array, HP_low_limit) -- u_m_array example: {{"down", 1}, {"right", 3}, {"down", 3}, {"DONE",0}}  Must have DONE to mark the end
	u_m_index = 1
	while(u_m_array[u_m_index][1] ~= "DONE")
	do 
		if( U_MultiMoveAttack(u_m_array[u_m_index][1], u_m_array[u_m_index][2], false) == false)	then
			return false	end
		HP = memory.readbyte(0x0038)
		if(HP < HP_low_limit)	then
			return false	end

		u_m_index = u_m_index + 1
	end

	return true
end


local function ScreenTransition(TransitionType, AddlDelay)
	if(TransitionType == "small")	then
		AdvanceFrames(10 + AddlDelay)	end
	if(TransitionType == "medium")	then
		AdvanceFrames(27 + AddlDelay)	end
	if(TransitionType == "large")	then
		AdvanceFrames(49 + AddlDelay)	end
end


local function ItemGet(AddlDelay)
	AdvanceFrames(122 + AddlDelay)
end


local function SaveReload(direction1, direction2)
	PushButton(direction1)
	PushButton("select")
	AdvanceFrames(24)
	PushButton("down")
	AdvanceFrames(12)
	PushButton("select")
	AdvanceFrames(15)
	PushButton("select")
	AdvanceFrames(10)

	PushButton(direction2)
	PushButton("select")
	AdvanceFrames(24)
	PushButton("down")
	AdvanceFrames(12)
	PushButton("down")
	AdvanceFrames(12)
	PushButton("select")
	AdvanceFrames(15)
	PushButton("select")
	AdvanceFrames(30)
end


-----------------------------------------------------------------------------------------------


-----(J) Easter Egg-----
local function J_StartYourEngine(DoReset)
	DoRunStart(DoReset)
	MenuToPassword(0)
	PasswordError()
	MenuHandleDemo(false)
	MenuToGame(0)
	GameMenuGame("left", false, false)
	GameMenuGame("left", false, false)
	GameMenuGame("up", false, false)
	GameMenuGame("left", false, true)
	MenuHandleDemoOld(1, 0)
	MenuToPassword(0)
	PasswordError()
	MenuToPassword(0)
	PasswordError()
	MenuToPassword(0)
	Password3DGolfSuperVer()
	GameMenuChangeSpeed("up", false)
end


local function J_ToTheNotBatCave()
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 5, 0)
	MultiMove("right", 5, 0)
	ScreenTransition("small", 0)

	MoveFast("up", false, 0)
	ScreenTransition("small", 0)

	MoveFast("right", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 5, 0)
	MoveFast("clear", false, 0)	--RNG manipulation
	MultiMove("up", 2, 0)
	MultiMove("right", 8, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 0)
	ScreenTransition("medium", 1)
end


local function J_TakeAWispOfLuck()
	MoveFast("clear", false, 0)	-- on top of enemy, can't move
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 3, {0,2,0})	-- hit by the wisp
	MultiMove("up",    3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down",  6, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  3, 0)
	MultiMove("down",  6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    5, 0)
	ItemGet(2)
	MultiMove("down",  5, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    6, 0)
	MultiMove("left",  6, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  6, {0,0,0,0,2,0})	-- HP Refill
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  2, 0)
	MoveFast("left", true, 0)
	ScreenTransition("large", 0)
end


local function J_YouGetSomeErAPot()
	MoveFast("up", false, 0)
	MultiMove("left", 5, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 11, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 8, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 12, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 4, 0)
	MultiMove("up", 4, 0)
	MultiMove("left", 17, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 8, 0)
	MultiMove("down", 4, 0)
	MultiMove("left", 5, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("down", true, 1)	-- kobold
	MultiMove("down", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 8, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 9, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 7, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 7, 0)
	MultiMove("down", 3, 0)
	MoveFast("clear", false, 0)	--RNG manipulation
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	ItemGet(4)			-- 2 for revealing the hole animation
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 11, 0)
	MultiMove("right", 12, 0)
	ScreenTransition("small", 0)

	MoveFast("right", false, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 4, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 2, 0)	
	MoveFast("down", true, 0)
	ScreenTransition("medium", 0)
end


local function J_YouGetAQuickKey()
	MultiMove("down", 3, 0)	
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)	
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)	
	MultiMove("left", 3, 0)
	MultiMove("down", 9, 0)	
	MultiMove("left", 3, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 6, 0)	
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)	
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)	
	MultiMove("right", 3, 0)
	MultiMove("down", 4, 0)
	ItemGet(2)
	MultiMove("down", 2, 0)	
	MultiMove("left", 5, 0)
	MoveFast("left", true, 0)
	ScreenTransition("large", 0)
end


local function J_LeafTheTreeAlone()
	MultiMove("up", 4, 0)
	MultiMove("left", 6, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 2, {0,2})	-- HP Refill
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 5, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)

	MoveFast("up", true, 0)
	ItemGet(1)
	MultiMove("left", 4, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 16, 0)
	MultiMove("up", 5, 0)
	MultiMove("left", 5, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 9, 0)
	MoveFast("left", true, 0)
	ScreenTransition("medium", 0)
end


local function J_DoesItRingABell()
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0) --this and...
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0) --this avoid getting hit, which overall saves 2 frames
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)
	MultiMove("down", 2, 0)
	MoveFast("clear", false, 0) --RNG Manipulation
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 6) --got hit
	MoveFast("right", true, 1)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("down", true, 2)
	MultiMove("right", 4, 0)
	ScreenTransition("small", 0)

	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)
	MultiMove("right", 5, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 6, 0)
	ItemGet(2)
	MultiMove("down", 6, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 7, 0)
	ScreenTransition("small", 0)

	MoveFast("left", true, 1) --ladyam, but only 1 hit due to attacking before
	MultiMove("left", 2, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 7, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 0)
	ScreenTransition("large", 0)
end


local function J_GrabTheFamilyJewels()
	MoveFast("right", false, 0)
	MultiMove("down", 12, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 21, 0)
	ScreenTransition("small", 0)

	MoveFast("down", false, 0)
	MoveFast("down", true, 1)
	MultiMove("down", 19, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 13, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 7, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)

	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 4, 0)
	MultiMove("down", 7, 0)
	ItemGet(3)
	MultiMove("up", 7, 0)
	MultiMove("right", 4, 0)
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 6, 0)
end


local function J_WizardsCantRideWaves()
	MoveFast("right", false, 0)
	ScreenTransition("small", 0)

	AdvanceFrames(999) -- march of the goldams
	PushButton("B")
	MultiMove("up", 2, {1,0})
	PushButton("B")
	MultiMove("up", 2, {1,0})
	ItemGet(1)
	PushButton("B")
	MoveFast("left", false, 1)
	ScreenTransition("small", 0)

	MoveFast("left", false, 0)
	PushButton("B")
	MoveFast("left", false, 1)
	MultiMove("up", 15, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 18, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 16, 0)
	MultiMove("left", 11, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 3, 0)
	ScreenTransition("small", 0)

	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)			
	PushButton("B")
	MoveFast("left", true, 0)
	AdvanceFrames(1264) -- fairy3 get and fairy ride
end


local function J_CommitAGraveCrime()
	PushButton("B")	
	MoveFast("up", false, 1)
	MoveFast("left", false, 0)
	PushButton("B")
	MultiMove("up", 3, {1,0,0})
	PushButton("B")
	MoveFast("right", true, 0) -- and A pressed
	AdvanceFrames(151) -- FIRE!!!
	MoveFast("right", false, 0)
	MoveFast("right", true, 0)
	ScreenTransition("large", 0)
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 9, {0,0,0,0,0,0,0,2,0}) -- HP Refill
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	MultiMove("right", 4, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 2, 0)
	MoveFast("clear", false, 0) -- damage and HP Refill
	MultiMove("up", 2, 0)
	MoveFast("clear", false, 0) -- damage and HP Refill
	MultiMove("up", 2, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	ScreenTransition("large", 0)

	MultiMove("right", 2, 0)
	MultiMove("down", 17, 0)
	ScreenTransition("small", 0)

	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 15, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 10, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	AdvanceFrames(35) -- Infinite MP wore off
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("up", true, 0)
	ItemGet(0)
	MultiMove("up", 5, 0)
	MultiMove("left", 5, 0)
	MultiMove("down", 9, 0)
	MultiMove("right", 3, 0)-----------------Manipulate the skeleton to the right
	MoveFast("clear", false, 0) -- waiting for skeleton
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0) -- waiting for skeleton
	MultiMove("left", 6, 0)-----------------
	MultiMove("up", 13, 0)
	MultiMove("right", 2, 0)
	MultiMove("up", 6, 0)
	ScreenTransition("small", 1)

	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("clear", false, 0) -- skeleton avoid, could take damage as an alt
	MultiMove("left", 2, 0)
	MultiMove("up", 14, 0)
	MultiMove("left", 2, 0)
	ScreenTransition("large", 0)

	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left",6, 0)
	MultiMove("up",3, 0)
	MultiMove("left",3, 0)
	MultiMove("down",3, 0)
	MultiMove("left",3, 0)
	MultiMove("down",6, 0)
	MultiMove("left",6, 0)
	MultiMove("up", 9, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",3, 0)
	MultiMove("left",3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",3, 0)
	MultiMove("left",3, 0)
	MultiMove("up",2, 0)
	ScreenTransition("large", 0)
end


local function J_FightDoesNotDragOn()
	MoveFast("right", false, 0)
	MultiMove("left",2, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 6)
	MoveFast("right", true, 5)
	ItemGet(2)
	MultiMove("left",4, 0)
	MultiMove("up",5, 0)
end


local function J_LubySlippers()
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 1)

	MultiMove("up", 7, 0)
	MultiMove("right", 5, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 4, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 5, 0)
	ScreenTransition("small", 1)

	MultiMove("right", 7, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 4, 0)
	ScreenTransition("small", 1)

	MultiMove("down", 4, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	ItemGet(3)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	ScreenTransition("small", 1)

	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 6, 0)
	ScreenTransition("small", 1)

	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 9, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 8, 0)
	ScreenTransition("small", 1)

	MoveFast("left", false, 0)
	MultiMove("down", 6, 0)
	MultiMove("right", 3, 0)
	MoveFast("right", true, 0)
	ScreenTransition("large", 0)
end


local function J_NoBossMusicForYou()
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 5, 0)
	MoveFast("down", false, 2) -- Blackam attacks
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	MultiMove("right", 4, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 6, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	ScreenTransition("large", 0)

	MultiMove("down", 2, 0)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
	MoveFast("down", true, 6)
end


-----------------------------------------------------------------------------------------------

-----(U) Any%-----
local function U_StartYourEngine(DoReset)
	if(DoReset == true)	then
		emu.poweron()	end
	AdvanceFrames(7)
	PushButton("start")
	AdvanceFrames(23)
	PushButton("start")
	AdvanceFrames(58)
	GameMenuChangeSpeed("up", false)
end


local function U_ToTheNotBatCave()
	MultiMove("up", 2, 0)
	MultiMove("right", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 1, 0)
	MultiMove("right", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 1, 0)
	MultiMove("right", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 1, 0)
	MultiMove("right", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 4, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("right", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("right", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("right", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 1, 0)
	MultiMove("right", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("up", 2, 0)
	MultiMove("right", 8, 0)
	MultiMove("up", 1, 0)
	MoveFast("right", true, 0)
	ScreenTransition("medium", 1)
end


local function U_TakeAWispOfLuck()
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down",  6, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  3, 0)
	MultiMove("down",  6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    4, 0)
	MoveFast("up", true, 2) -- attack the wisp because it got in the way
	ItemGet(2) -- this animation takes 2 frames longer than the least animation time
	MoveFast("up", true, 2) -- fighting the wisp costs 13 frames, but gains 7 exp
	MoveFast("up", true, 1) -- but because of less grinding later, the time is recovered
	MultiMove("down",  5, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down",  3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up",    6, 0)
	MultiMove("left",  5, 0)
	MoveFast("left", true, 2) -- a wisp is again in the way
	MoveFast("left", true, 2) -- kill it because of the high exp
	MoveFast("left", true, 1) -- and it is better than wasting frames to avoid/bump into them
	MultiMove("up",    3, 0)
	MultiMove("left",  6, 0)
	MultiMove("down",  3, 0)
	MultiMove("left",  3, 0)
	MultiMove("up",    3, 0)
	MultiMove("left",  2, 0)
	MoveFast("left", true, 0)
	ScreenTransition("large", 0)
end


local function U_YouGetSomeErAPot()
	MultiMove("up", 1, 0)
	MultiMove("left", 5, 0)
	MultiMove("up", 7, 0)
	MultiMove("left", 1, 0)
	MultiMove("left", 4, 0)
	MultiMove("up", 1, 0)
	MultiMove("left", 6, 0)
	ScreenTransition("small", 0)

	MultiMoveStutter("left", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMoveStutter("up", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMoveStutter("left", 11, 0)
	MoveFast("left", true, 1)
	MultiMove("left", 7, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 6, 0)
	MultiMove("clear", 3, 0) -- RNG manipulation / HP recover
	MultiMove("left", 4, 0)
	for i=1,4 do
		MultiMove("clear", 3, 0) -- RNG manipulation / HP recover
		MoveFast("left", false, 0)
	end
	MultiMove("clear", 3, 0) -- RNG manipulation / HP recover
	MoveFast("left", true, 1)
	for i=1,5 do
		MultiMove("clear", 2, 0) -- RNG manipulation / HP recover
		MoveFast("left", false, 0)
	end
	MoveFast("left", false, 0)			
	ScreenTransition("small", 0)
			
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover   
	MultiMove("left", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover  
	MultiMove("left", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("left", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("left", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MultiMove("down", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover
	MoveFast("down", true, 1)
	MultiMove("down", 1, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 2, 0)
	MultiMove("left", 3, 0)				
	MultiMove("down", 11, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 8, 0)
	MultiMove("clear", 12, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 9, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 7, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 7, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	ItemGet(4)		-- 2 of it is for revealing the hole animation
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 8, 0)
end


local function U_YouGetAQuickKey()
	MultiMove("down", 3, 0)
	MultiMove("right", 12, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 1, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 3, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 4, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 2, 0)
	MoveFast("down", true, 0)
	ScreenTransition("medium", 0)

	MultiMove("down", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 2, 0)
	SaveReload("up", "right")
	MultiMove("right", 3, 0)
	ItemGet(2)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 2, 0)
	MoveFast("up", true, 0)
	ScreenTransition("large", 0)

	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 5, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 2, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 2, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 11, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
end


local function U_GrabTheFamilyJewels()
	MultiMove("clear", 6, 0) -- RNG manipulation / HP recover 
	MultiMove("up", 9, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 10, 0)
	MultiMove("right", 1, 0)
	MultiMoveStutter("right", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("up", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("right", 3, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("up", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MoveFast("up", true, 1)
	MultiMoveStutter("up", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("right", 5, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("right", 4, 0)
	ScreenTransition("small", 0)

	MultiMoveStutter("right", 11, 0)
	MultiMove("right", 3, 0)
	MultiMove("clear", 2, 0) -- RNG manipulation / HP recover 
	MultiMove("right", 2, 0)
	MultiMove("down", 3, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("down", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("down", 4, 0)
	MultiMove("down", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("down", 4, 0)
	ScreenTransition("small", 0)

	MultiMoveStutter("down", 3, 0)
	MultiMove("down", 18, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 7, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("down", 3, 0)
	MultiMove("down", 2, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("down", 1, 0)
	MultiMove("clear", 1, 0) -- RNG manipulation / HP recover 
	MultiMoveStutter("left", 2, 0)
	MultiMove("down", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 2, 0)
	MultiMove("down", 1, 0)
	MultiMove("left", 4, 0)
	MultiMove("down", 7, 0)
	ItemGet(3)
	MultiMove("up", 7, 0)
	MultiMove("right", 4, 0)
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 5, 0)
end


local function U_ItsAFair_y_Tree()
	MultiMoveStutter("right", 2, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 4, 0)
	ItemGet(1)
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)

	for i=1,2 do
		MultiMove("clear", 3, 0)
		MoveFast("left", false, 0)
	end
	for i=1,2 do
		MultiMove("clear", 3, 0)
		MoveFast("up", false, 0)
	end
	for i=1,5 do
		MultiMove("clear", 2, 0)
		MoveFast("up", false, 0)
	end
	MultiMove("up", 8, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 11, 0)
	MultiMove("clear", 2, 0)
	MultiMove("up", 5, 0)
	for i=1,2 do
		MultiMove("clear", 3, 0)
		MoveFast("up", false, 0)
	end
	for i=1,2 do
		MultiMove("clear", 3, 0)
		MoveFast("left", false, 0)
	end
	for i=1,2 do
		MultiMove("clear", 3, 0)
		MoveFast("up", false, 0)
	end
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)

	for i=1,4 do
		MultiMove("clear", 2, 0)
		MoveFast("up", false, 0)
	end
	MultiMove("up", 2, 0)
	for i=1,4 do
		MultiMove("clear", 2, 0)
		MoveFast("up", false, 0)
	end
	MultiMove("up", 2, 0)
	for i=1,2 do
		MultiMove("clear", 2, 0)
		MoveFast("up", false, 0)
	end
	MultiMove("up", 7, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 9, 0)
	MultiMove("clear", 12, 0) -- RNG manipulation / HP recover
	MultiMove("up", 2, 0)
	MoveFast("left", true, 0)
	ScreenTransition("medium", 1)	-- 1 frame lost here for who knows what reason
end


local function U_TheShieldAlwaysRingsTwice()
	MultiMove("left", 3, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)
	MultiMove("up", 2, 0)
	MultiMove("left", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("clear", false, 0)	-- natural occurrence for goldam running away
	MultiMove("down", 2, 0)
	MoveFast("left", true, 1)
	MultiMove("left", 5, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 4, 0)
	ScreenTransition("small", 0)

	MultiMove("up", 3, 0)
	MultiMove("left", 4, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("right", false, 0)	-- retreat costs 8 frames (fighting goldam head-on)
	MoveFast("left", true, 1)	-- non-move from the attack (natural occurrance)
	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 7, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 6, 0)
	ItemGet(2)
	MultiMove("down", 6, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 3, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)
	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 7, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 3, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)	-- moving up to get to the ladyam costs 8 frames
	MultiMove("down", 4, 0)
	MultiMove("left", 3, 0)
	MoveFast("clear", false, 0)	-- 4 frames for waiting for Ladyam
	MoveFast("down", true, 2)
	MoveFast("down", true, 1) -- moving down to get to the ladyam costs 8 frames
	ItemGet(2)
	MultiMove("up", 4, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 5, 0)
	MoveFast("left", true, 0)
	ScreenTransition("large", 0)
end


local function U_LeafTheTreeAlone()
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 10, 0)
	ScreenTransition("small", 0)

	MultiMove("right", 20, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	ScreenTransition("small", 0) -- path taken loses 6 terrain counter

	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0) -- a better tree (at 4,15-16) would save 8 frames
	MoveFast("up", true, 0)
	ItemGet(1)

	MultiMove("down", 5, 0)
	ScreenTransition("small", 0)

	MultiMove("left", 4, 0)
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)

	MultiMove("down", 3, 0)
	MultiMove("clear", 4, 0)
	MoveFast("down", false, 0)
	MultiMove("clear", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 2, 0)
	MultiMove("left", 4, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 11, 0)
	ScreenTransition("small", 0)

	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)

	MultiMove("clear", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("clear", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("clear", 5, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 0)
	ScreenTransition("large", 0)
end


local function U_Eel_aborateOnTheGrind()
	MultiMove("down", 2, 0)
	MoveFast("down", true, 2)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- eel 1
	MultiMove("down", 4, 0)
	ScreenTransition("small", 0)
	MultiMove("down", 4, 0)
	MoveFast("right", true, 2)
	MoveFast("down", false, 0)
	MoveFast("right", true, 2)
	MoveFast("down", false, 0)
	MoveFast("right", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 2
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("up", false, 0)
	MoveFast("down", true, 1)	-- 3
	MultiMove("right", 2, 0)
	ScreenTransition("small", 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 4
	MultiMove("up", 3, 0)
	MultiMove("clear", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 5
	MoveFast("up", false, 0)
	MultiMove("clear", 4, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 6
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)
	MultiMove("up", 2, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 7
	MoveFast("clear", false, 0)
	MultiMove("down", 4, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 8
	MultiMove("right", 2, 0)
	ScreenTransition("small", 0)
	MoveFast("clear", false, 0)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 9
	MultiMove("up", 5, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 10
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 11
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 12
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)
	MoveFast("clear", false, 0)
	MoveFast("up", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("left", false, 0)
	MoveFast("up", true, 1)		-- 13
	MultiMove("up", 2, 0)
	MultiMove("clear", 4, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 14
	MultiMove("up", 2, 0)
	ScreenTransition("small", 0)
	MoveFast("up", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 15
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MultiMove("up", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- 16
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	ScreenTransition("small", 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 17
	MultiMove("down", 3, 0)
	ScreenTransition("small", 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 18
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("up", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 19
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("down", false, 0)
	MoveFast("up", true, 1)		-- 20
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MultiMove("clear", 3, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 21
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 22
	MultiMove("right", 3, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- 23
	MoveFast("left", false, 0)
	MultiMove("down", 5, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 24
	MultiMove("up", 6, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 25
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 26
	MultiMove("down", 3, 0)	
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 27
	MultiMove("up", 6, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 28
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 29
	MoveFast("left", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("down", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 30
	MultiMove("up", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 31
	MoveFast("right", false, 0)
	MultiMove("clear", 5, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 32
	MoveFast("up", false, 0)
	MultiMove("clear", 3, 0)
	MoveFast("left", true, 2)
	MoveFast("left", true, 2)
	MoveFast("left", true, 1)	-- 33
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 34
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("down", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 35
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 36
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("up", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 37
	MultiMove("down", 2, 0)
	MultiMove("clear", 3, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 38
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	ScreenTransition("small", 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 39
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("down", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 40
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 41
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	ScreenTransition("small", 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 42
	MultiMove("left", 3, 0)
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- 43
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 44
end


local function U_WizardsCantRideWaves()
	MoveFast("right", false, 0)
	ScreenTransition("small", 0)
	MultiMove("up", 3, 0)
	ScreenTransition("small", 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- 45
	MultiMove("up", 4, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 46
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 6, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 2)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- 47
	MultiMove("right", 4, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- 48
	MultiMove("right", 2, 0)
	ScreenTransition("small", 0)
	MultiMove("right", 2, 0)
	PushButton("B")
	MoveFast("down", false, 1)
	MoveFast("down", false, 0)
	PushButton("B")
	MoveFast("down", false, 1)
	MoveFast("down", false, 0)
	PushButton("B")
	MoveFast("down", false, 1)
	MoveFast("down", false, 0)
	PushButton("B")
	MoveFast("down", false, 1)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MultiMove("clear", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("left", false, 0)
	MoveFast("B", true, 0) -- and A
	AdvanceFrames(856) -- fairy3 get and fairy ride
end


local function U_GrindingMakesMeHyper()
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 5, 0)
	MoveFast("left", true, 1)	-- hyper 1
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)	
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- slime to get hypers
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MoveFast("left", true, 1)	-- 2
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- 3
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- 4
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("left", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- 5
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MultiMove("right", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", true, 1)	-- 6
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- 7
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- 8
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- 9
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("right", 3, 0)
	MoveFast("left", true, 1)	-- 10
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- 11
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", true, 1)	-- 12
	MultiMove("up", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", true, 1)	-- 13
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("right", 2, 0)
	MoveFast("left", true, 1)	-- 14
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- 15
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- 16
	MoveFast("clear", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- 17
	MoveFast("up", false, 0)
	ScreenTransition("small", 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- 18
	MultiMove("right", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- 19
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- 20
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 0)
	MultiMove("down", 4, 0)
	PushButton("B")
	MoveFast("down", false, 1)
	MoveFast("down", false, 0)
	PushButton("B")
	MoveFast("right", false, 1)
	PushButton("B")
	MoveFast("right", true, 0) -- and A
	AdvanceFrames(151) -- FIRE!!!
	MoveFast("right", false, 0)
	MoveFast("right", true, 0)
	ScreenTransition("large", 0)
end


local function U_CommitAGraveCrime()
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- misc 1
	MultiMove("down", 8, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 6, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	ScreenTransition("large", 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("down", true, 2)
	MoveFast("down", true, 1)	-- misc 2
	MultiMove("down", 12, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	ScreenTransition("small", 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 15, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 10, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 5, 0)
	MultiMove("right", 2, 0)
	MoveFast("up", true, 0)
	ItemGet(0)
	MultiMove("up", 2, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)		-- misc 3
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 4, 0)
	MultiMove("down", 10, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 13, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 2)
	MoveFast("up", false, 0)
	MoveFast("right", true, 1)	--misc 4
	MultiMove("up", 5, 0)
	ScreenTransition("small", 1)
	MultiMove("up", 2, 0)
	MoveFast("right", true, 2)
	MoveFast("right", true, 1)	-- misc 5
	MultiMove("left", 4, 0)
	MultiMove("up", 14, 0)
	MultiMove("left", 2, 0)
	ScreenTransition("large", 0)
	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("left", 6, 0)
	MoveFast("up", true, 2)
	MoveFast("up", true, 1)	-- misc 6
	MultiMove("up", 8, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 2, 0)
	ScreenTransition("large", 0)
end


local function U_MakeTheHyperGrindDragOn()
	MultiMove("right", 7, {0, 4, 4, 4, 4, 4, 4})	-- dragon 1-6
	MultiMove("left", 6, 0)
	MultiMove("up", 6, 0)
	MoveFast("left", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 1)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- slime
	MultiMove("up", 3, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 1
	MoveFast("up", false, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", true, 1)	-- hyper 2
	MultiMove("right", 7, 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", true, 1)	-- hyper 3
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 4
	MoveFast("clear", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 5
	MoveFast("down", false, 0)
	ScreenTransition("small", 1)
	MultiMove("down", 4, {0, 0, 4, 4})	-- dragon 7-8
	MultiMove("up", 3, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 6
	MoveFast("left", false, 0)
	MultiMove("right", 4, 0)
	MoveFast("right", true, 1)	-- hyper 7
	MultiMove("left", 6, 0)
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 8
	MoveFast("up", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 9
	MultiMove("right", 4, 0)
	MultiMove("left", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 10
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 1)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 11
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 12
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- hyper 13
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", false, 0)
	MoveFast("down", true, 1)	-- hyper 14
	MultiMove("left", 4, 0)
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- hyper 15
	MultiMove("right", 4, 0)
	MoveFast("left", true, 1)	-- hyper 16
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("left", true, 1)	-- hyper 17
	MultiMove("up", 2, 0)
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("right", true, 1)	-- hyper 18
	MultiMove("up", 3, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", true, 1)	-- hyper 19
	MultiMove("right", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 20
	MoveFast("up", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 1)	-- hyper 21
	MultiMove("left", 4, 0)
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 22
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 23
	MultiMove("up", 4, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 4, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 24
	MultiMove("up", 2, 0)
	MultiMove("left", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 25
	MoveFast("up", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- hyper 26
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 27
	MultiMove("left", 6, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 2, 0)
	MoveFast("right", true, 1)	-- hyper 28
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("left", true, 1)	-- hyper 29
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 30
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", true, 1)	-- hyper 31
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 4, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", true, 1)	-- hyper 32
	MultiMove("down", 2, 0)
	MultiMove("right", 5, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- hyper 33
	MultiMove("left", 3, 0)
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 34
	MultiMove("up", 3, 0)
	MultiMove("down", 4, 0)
	MoveFast("left", true, 1)	-- hyper 35
	MultiMove("right", 4, 0)
	MultiMove("left", 2, 0)
	MoveFast("left", true, 1)	-- hyper 36
	MultiMove("left", 4, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- hyper 37
	MultiMove("right", 3, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("left", true, 1)	-- hyper 38
	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 39
	MoveFast("clear", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 40
	MultiMove("up", 3, 0)
	MultiMove("left", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("down", true, 1)	-- hyper 41
	MoveFast("up", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", true, 1)	-- hyper 42
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- hyper 43
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 44
	MultiMove("left", 4, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 6, 0)
	MoveFast("down", true, 1)	-- hyper 45
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- hyper 46
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 3, 0)
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("left", true, 1)	-- hyper 47
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- hyper 48
	MultiMove("down", 2, 0)
	MultiMove("left", 5, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- hyper 49
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", true, 1)	-- hyper 50
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", true, 1)	-- hyper 51
	MultiMove("up", 3, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("left", true, 1)	-- hyper 52
	MultiMove("left", 3, 0)
	MultiMove("right", 3, 0)
	MoveFast("down", false, 0)
	MoveFast("right", true, 1)	-- hyper 53
	MultiMove("left", 6, 0)
	MoveFast("down", false, 0)
	MoveFast("clear", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- hyper 54
	MoveFast("clear", false, 0)
	MoveFast("left", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 1)
	MultiMove("down", 3, 0)
	MoveFast("up", true, 1)		-- hyper 55
	MultiMove("up", 2, 0)
	MultiMove("down", 9, {0, 0, 4, 4, 4, 4, 4, 4, 4})	-- dragon 9-15
	ItemGet(1)			-- medicine
	MoveFast("up", false, 0)
	MoveFast("left", true, 1)	-- hyper 56
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", true, 1)		-- hyper 57
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 58
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 1)	-- hyper 59
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("up", true, 1)		-- hyper 60
	MoveFast("right", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 5, 0)
	MultiMove("left", 2, 0)
	MoveFast("left", true, 1)	-- hyper 61
	MultiMove("right", 4, 0)
	MoveFast("left", true, 1)	-- hyper 62
	MultiMove("left", 4, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 63
	MoveFast("up", false, 0)
	ScreenTransition("small", 1)
	MultiMove("up", 2, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("left", true, 1)	-- hyper 64
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MultiMove("left", 5, 0)
	MoveFast("right", true, 1)	-- hyper 65
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 1)	-- hyper 66
	MultiMove("left", 3, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 4, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- hyper 67
	MultiMove("right", 3, 0)
	MultiMove("down", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", true, 1)	-- hyper 68
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 69
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("down", true, 1)	-- hyper 70
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("left", true, 1)	-- hyper 71
	MultiMove("left", 3, 0)
	MultiMove("right", 2, 0)
	MoveFast("right", true, 1)	-- hyper 72
	MultiMove("up", 3, 0)
	MultiMove("down", 4, 0)
	MoveFast("right", true, 1)	-- hyper 73
	MultiMove("right", 2, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("left", true, 1)	-- hyper 74
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", true, 1)	-- hyper 75
	MultiMove("right", 2, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- hyper 76
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MoveFast("right", true, 1)	-- hyper 77
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("right", true, 1)	-- hyper 78
	MultiMove("right", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", true, 1)	-- hyper 79
	MoveFast("left", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("left", true, 1)	-- hyper 80
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("left", true, 1)	-- hyper 81
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", true, 1)	-- hyper 82
	MultiMove("left", 4, 0)
	MultiMove("right", 5, 0)
	MoveFast("left", false, 0)
	MoveFast("left", true, 1)	-- hyper 83
	MultiMove("right", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("clear", false, 0)
	MoveFast("right", true, 1)	-- hyper 84
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MoveFast("clear", false, 0)
	MultiMove("left", 3, 0)
	MoveFast("left", true, 1)	-- hyper 85
	MultiMove("left", 3, 0)
	MultiMove("right", 4, 0)
	MoveFast("right", true, 1)	-- hyper 86
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("clear", false, 0)
	MoveFast("down", true, 1)	-- hyper 87
	MultiMove("down", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- hyper 88
	MultiMove("left", 4, 0)
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", true, 1)	-- hyper 89
	MultiMove("left", 2, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 3, 0)
	MoveFast("down", false, 0)
	MoveFast("left", true, 1)	-- hyper 90
end


local function U_YellowRubyApparently()
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 4, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 4, 0)
	MoveFast("right", false, 0)
	MultiMove("up", 4, 0)
	MoveFast("left", false, 0)
	MultiMove("down", 3, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 5, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 4, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 5, 0)
	ScreenTransition("small", 1)
	MultiMove("right", 5, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	ScreenTransition("small", 1)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	ItemGet(3)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 4, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	ScreenTransition("small", 1)
	MultiMove("up", 4, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 8, 0)
	ScreenTransition("small", 1)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 9, 0)
	MoveFast("up", false, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 2, 0)
end


local function U_ToVaralysAndBeyond()
	MultiMove("down", 5, 0)
	MoveFast("right", false, 0)
	MultiMove("up", 4, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 4, 0)
	MultiMove("right", 5, 0)
	MoveFast("down", false, 0)
	ScreenTransition("small", 1)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 8, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 2, 0)
	MultiMove("right", 2, 0)
	MultiMove("down", 4, 0)
	MultiMove("right", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("up", 4, 0)
	MoveFast("right", false, 0)
	MoveFast("right", true, 0)	-- to underground
	ScreenTransition("small", 39)
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("down", 9, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 6, 0)
	MultiMove("right", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 6, 0)
	MultiMove("left", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 6, 0)
	MultiMove("down", 3, 0)
	MultiMove("right", 2, 0)
	ScreenTransition("large", 0)
end


local function U_NoSmokeBreakDuringVaralys()
	MultiMove("down", 6, {4,4,4,4,4,4})	-- Varalys 1-6
	MoveFast("down", true, 4)		-- Varalys 7
	AdvanceFrames(326)				-- HP Refill
	MultiMove("down", 6, {4,4,4,4,4,4})	-- Varalys 8-13
	MoveFast("up", false, 0)
	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("right", 2, 0)
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MultiMove("up", 3, 0)
	MultiMove("left", 3, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 3, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 6, 0)
	MultiMove("right", 7, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 2, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("left", 7, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 3, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	MultiMove("right", 4, 0)
	MultiMove("down", 5, 0)
	MultiMove("left", 2, 0)
	MultiMove("down", 2, 0)
	MultiMove("left", 6, 0)
	MoveFast("clear", false, 0)
	MultiMove("up", 7, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("right", 2, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 3, 0)
	MultiMove("down", 6, 0)
	MultiMove("right", 5, 0)
	MoveFast("down", false, 0)
	MoveFast("left", false, 0)
	MultiMove("up", 3, 0)
	MoveFast("right", false, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("right", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MoveFast("left", false, 0)
	MoveFast("up", false, 0)
	MultiMove("right", 6, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MoveFast("down", false, 0)
	MoveFast("right", false, 0)
	MultiMove("down", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 2, 0)
	MultiMove("up", 2, 0)
	MoveFast("right", false, 0)
	MultiMove("up", 2, 0)
	MultiMove("left", 6, 0)
	MultiMove("up", 2, 0)
	MoveFast("left", false, 0)
	MoveFast("down", false, 0)
	MultiMove("left", 4, 0)
end


-----------------------------------------------------------------------------------------------


do_drawing = false

do_remote_control = true
Is_J_Version = false

-----MAIN-----
if(do_drawing)	then
	gui.register(main_draw)	end

if(do_remote_control == true)
then
	if(Is_J_Version == false)
	then
		U_StartYourEngine(true)
		U_ToTheNotBatCave()
		U_TakeAWispOfLuck()
		U_YouGetSomeErAPot()
		U_YouGetAQuickKey()		
		U_GrabTheFamilyJewels()
		U_ItsAFair_y_Tree()
		U_TheShieldAlwaysRingsTwice()
		U_LeafTheTreeAlone()
		U_Eel_aborateOnTheGrind()
		U_WizardsCantRideWaves()
		U_GrindingMakesMeHyper()
		U_CommitAGraveCrime()
		U_MakeTheHyperGrindDragOn()
		U_YellowRubyApparently()
		U_ToVaralysAndBeyond()
		U_NoSmokeBreakDuringVaralys()
	else
		J_StartYourEngine(true)
		J_ToTheNotBatCave()
		J_TakeAWispOfLuck()
		J_YouGetSomeErAPot()
		J_YouGetAQuickKey()
		J_LeafTheTreeAlone()
		J_DoesItRingABell()
		J_GrabTheFamilyJewels()
		J_WizardsCantRideWaves()
		J_CommitAGraveCrime()
		J_FightDoesNotDragOn()
		J_LubySlippers()
		J_NoBossMusicForYou()
	end
	
	emu.speedmode("normal")
	emu.pause()
end


--NORMAL LOOP
while (true)	do
	FCEU.frameadvance()	end