User File #38597753864589843

Upload All User Files

#38597753864589843 - Zook Man ZX4 - We'll Hex The Name In Later - General Information Script

OrganizationIsHard.lua
974 downloads
Uploaded 4/26/2017 5:50 AM by Invariel (see all 16)
X = 0x1560
Y = 0x1564

FrameCounter = 0x17A0

Items = { }
Items ["2H"] = { 1, 14, 19 }
Items ["5H"] = { 3, 9, 18, 22 }
Items ["HT"] = { 6, 13, 29 }
Items ["2W"] = { 5, 12, 17, 31 }
Items ["5W"] = { 7, 11, 21, 26 }
Items ["WT"] = { 24, 27 }
ItemDrops = { "2H", "5H", "HT", "2W", "5W", "WT" }

ItemDropList = { }
for x = 0, 31, 1 do
	ItemDropList [x] = "--"
end

for x = 1, 6, 1 do
	whichItem = ItemDrops[x]
	for y = 1, table.getn(Items[whichItem]), 1 do
		ItemDropList [Items[whichItem][y]] = whichItem
	end
end

Health = 0x1638
Invincibility = 0x1628
State = 0x15F0
Charge = 0x1608
Air = 0x1554
JumpCounter = 0x1E6C
DashCounter = 0x15D0
FlameDashCounter = 0x1EA4
Section = 0x1530

cameraLeft = 0x16A0
cameraTop = 0x16A4
cameraRight = 0x16A8
cameraBot = 0x16AC

BossHP = 0x1708
BossHPperBar = 0x170C
BossInvincibility = 0x16F8

MiniBoss1HP = 0x2ED4
MiniBoss2HP = 0x2F48
MiniBoss3HP = 0x2EBC
MiniBoss4HP = 0x3030
MiniBossInvincibility = 0x16E0

ShotDelay = 0x15E0
CurrentWeapon = 0x15E4
ShotTimer = 0x2710
BubbleShieldHP = 0x16B4

ProjectileX1 = 0x26F4
ProjectileY1 = 0x26F8
ProjectileDamage1 = 0x273C

ProjectileX2 = 0x2768
ProjectileY2 = 0x276C
ProjectileDamage2 = 0x27B0

ProjectileX3 = 0x27DC
ProjectileY3 = 0x27E0
ProjectileDamage3 = 0x2824

line = 0
lineHeight = 16
yStart = 50

weapon1Collected = 0x1669
weapon1Energy = 0x165D

ETanks = 0x1640
WTanks = 0x1644

console.clear()

function printStatus (text, foreColour, backColour)
	x = 70
	gui.text (x, yStart + line * lineHeight, text, foreColour, backColour or 0x88444444)
	line = line + 1
end

while true do
	if (memory.read_u16_le(Charge) >= 139) then
		chargeShot = 2
	elseif (memory.read_u16_le(Charge) > 59) then
		chargeShot = 1
	else
		chargeShot = 0
	end

	nextHit = 0
	bossHealth = (memory.read_s16_le(BossHP, "IWRAM") - 1) * 5 + memory.read_s16_le(BossHPperBar)

	if (bossHealth > 0) then
		if memory.read_u16_le(BossInvincibility) > 0 then
			nextHit = emu.framecount() + memory.read_u16_le(BossInvincibility)
		else
			nextHit = 0
		end
	end

	if (memory.read_u16_le(MiniBossInvincibility) > 0) then
		nextMiniBossHit = emu.framecount() + 60 - memory.read_u16_le(MiniBossInvincibility) 
	else
		nextMiniBossHit = 0
	end

	if (memory.read_u16_le(Air, "IWRAM") > 0) then
		inAir	= "Y"
	else
		inAir = "N"
	end

	gui.drawRectangle (15, 12, 175, line * 5, 0, 0xCC666666)

	line = 0

	jumpBehaviour = ""
	if (memory.read_u16_le (JumpCounter, "IWRAM") > 0) then
		jumpVal = memory.read_u16_le (JumpCounter, "IWRAM")
		jumpStr = "";

		if (jumpVal >= 25) then
			jumpStr = "Wallslide"
		elseif (jumpVal >= 18) then
			jumpStr = "2nd Wallkick"
		elseif (jumpVal >= 12) then
			jumpStr = "1st Wallkick"
		elseif (jumpVal >= 8) then
			jumpStr = "Jump Higher"
		end

		jumpBehaviour = string.format ("[%d] %s", jumpVal, jumpStr);
	end

	Dash = "0";
	if (memory.read_u16_le(DashCounter, "IWRAM") > 0) then
		Dash = string.format ("[%2d / 40]", memory.read_u16_le(DashCounter, "IWRAM"))
	elseif (memory.read_u16_le(FlameDashCounter, "IWRAM") > 0) then
		Dash = string.format ("[%2d / 63]", memory.read_u16_le(FlameDashCounter, "IWRAM"))
	end

	currentFrame = memory.read_u32_le (FrameCounter, "IWRAM") % 32
	ItemDropString = ""
	for itemNumber = 1, 6, 1 do
		min = 33
		whichItem = ItemDrops[itemNumber]

		for x = 1, table.getn (Items[whichItem]), 1 do
			val = (Items [whichItem][x] + 32 - currentFrame) % 32
			if (val < min) then
				min = val
			end
		end

		ItemDropString = string.format ("%s %s: %d", ItemDropString, whichItem, min)
	end

	ItemDropFirstSixteen = ItemDropList [currentFrame]
	ItemDropNextSixteen = ItemDropList [(currentFrame + 16) % 32]

	for frameNumber = currentFrame + 1, currentFrame + 15, 1 do
		ItemDropFirstSixteen = string.format ("%s, %s", ItemDropFirstSixteen, ItemDropList[frameNumber % 32])
		ItemDropNextSixteen = string.format ("%s, %s", ItemDropNextSixteen, ItemDropList[(frameNumber + 16) % 32])
	end

	printStatus (string.format ("HP: %2d  St: %2d  Inv: %2d  E-T: %2d  W-T: %2d  Chg: %3d [%d]  Delay: %2d", memory.read_u16_le(Health, "IWRAM"), memory.read_u16_le(State, "IWRAM"), memory.read_u16_le(Invincibility, "IWRAM"), memory.read_u16_le(ETanks, "IWRAM"), memory.read_u16_le(WTanks, "IWRAM"), memory.read_u16_le(Charge, "IWRAM"), chargeShot, memory.read_u16_le(ShotDelay, "IWRAM")))
	printStatus (string.format ("  Position: (%5d, %5d) [%2d]     Air:  %s %s", memory.read_u16_le(X, "IWRAM"), memory.read_u16_le(Y, "IWRAM"), memory.read_u16_le(Section, "IWRAM"), inAir, jumpBehaviour))
	printStatus (string.format (" On-Screen: (%5d, %5d)         Dash:  %s", memory.read_u16_le (cameraRight, "IWRAM"), memory.read_u16_le (cameraBot, "IWRAM"), Dash))
	--printStatus (string.format ("Item Drops:%s", ItemDropString))
	printStatus (ItemDropFirstSixteen)
	printStatus (ItemDropNextSixteen)
	printStatus (string.format ("   Boss HP: %3d: %2d [%2d]     Inv: %3d [%5d]", bossHealth, memory.read_s16_le(BossHP, "IWRAM"), memory.read_s16_le(BossHPperBar), memory.read_u16_le(BossInvincibility), nextHit))
	printStatus (string.format ("Minibosses: %3d %3d %3d %3d  Inv: %3d [%5d]", memory.read_u8(MiniBoss1HP, "IWRAM"), memory.read_u8(MiniBoss2HP, "IWRAM"), memory.read_u8(MiniBoss3HP, "IWRAM"), memory.read_u8(MiniBoss4HP, "IWRAM"), memory.read_u16_le(MiniBossInvincibility, "IWRAM"), nextMiniBossHit))

	weapons = "";

	for weaponNumber = 0, 7, 1 do
		have = memory.read_u8 (weapon1Collected + weaponNumber)
		energy = memory.read_u8 (weapon1Energy + weaponNumber)

		textline = ""
		if (have == 1) then
			textline = string.format ("%1d: %2d ", weaponNumber + 1, energy)
		else
			textline = string.format ("%7s", "")
		end

		weapons = string.format ("%s%s", weapons, textline)
	end
	printStatus (weapons)

	if (memory.read_u16_le(ProjectileX1, "IWRAM") ~= 0 or memory.read_u16_le(ProjectileY1, "IWRAM") ~= 0 or memory.read_u16_le(ProjectileDamage1, "IWRAM") ~= 0) then
		if (memory.read_u16_le (CurrentWeapon, "IWRAM") == 4) then
			printStatus (string.format ("Shot 1: (%5d, %5d) [%2d] [%1d / 6]", memory.read_u16_le(ProjectileX1, "IWRAM"), memory.read_u16_le(ProjectileY1, "IWRAM"), memory.read_u16_le(ProjectileDamage1, "IWRAM"), memory.read_u16_le(BubbleShieldHP, "IWRAM")))
		else
			printStatus (string.format ("Shot 1: (%5d, %5d) [%2d]", memory.read_u16_le(ProjectileX1, "IWRAM"), memory.read_u16_le(ProjectileY1, "IWRAM"), memory.read_u16_le(ProjectileDamage1, "IWRAM")))
		end
	end

	if (memory.read_u16_le(ProjectileX2) ~= 0 or memory.read_u16_le(ProjectileY2) ~= 0 or memory.read_u16_le(ProjectileDamage2) ~= 0) then
		printStatus (string.format ("Shot 2: (%5d, %5d) [%2d]", memory.read_u16_le(ProjectileX2), memory.read_u16_le(ProjectileY2), memory.read_u16_le(ProjectileDamage2)))
	end

	if (memory.read_u16_le(ProjectileX3) ~= 0 or memory.read_u16_le(ProjectileY3) ~= 0 or memory.read_u16_le(ProjectileDamage3) ~= 0) then
		printStatus (string.format ("Shot 3: (%5d, %5d) [%2d]", memory.read_u16_le(ProjectileX3), memory.read_u16_le(ProjectileY3), memory.read_u16_le(ProjectileDamage3)))
	end

	emu.frameadvance()
end