Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
-- --------------------------- -- -- Final Fantasy IV LUA script -- -- -- -- By: Pasky13 -- -- --------------------------- -- -- Globals char_atbm = {0, 0, 0, 0, 0} enemy_atbm = {0, 0, 0, 0, 0, 0, 0, 0} -- Change this to the amount of groups you want displayed at a time groupmax = 5 TableEnemyFormation = { "Imp x3", "FloatEye x2", "Eagle x2, FloatEye x1", "Eagle x3", "Imp x3, Sword Rat x1", "SwordRat x2, Imp x2", "Imp x4", "Larva x3", "SandMoth x2, Larva x2", "Sand Man x4", "SandPede x1, Sand Man x2", "SandWorm x1", "Evilshell x3 WaterBug x1", "Pike x3", "CaveToad x3", "Pike x2, Evilshell x2", "Zombie x4", "Pike x2, Evilshell x2, WaterBug x2", "Jelly x4", "TinyMage x2, WaterHag x4", "CaveToad x4", "CaveToad x2, Mad Toad x2", "Aligator x1, Pike x2", "Aligator x2", "Zombie x6", "Aligator x1, WaterBug x2", "Mad Toad x4", "TinyMage x4", "Imp x8", "SwordRat x2, Imp x2, TinyMage x2", "SandWorm x1, Sandpede x1", "SandWorm x2", "Imp x3, Imp Captain x1", "Turtle x1, Imp x2", "Cream x4", "Basilisk x1, Imp x3", "Turtle x2", "Weeper x1, Turtle x1, Basilisk x1", "Basilisk x1, Turtle x1", "Weeper x2", "Skelton x4", "Spirit x2", "Gargoyle x1, Cocktrice x1", "Bomb x3", "Cocktrice x3", "Gargoyle x2", "GrayBomb x2, Bomb x2", "Spirit x2, Skelton x2", "Red Bone x1, Skelton x3", "GrayBomb x2, Bomb x4", "Spirit x3, Skelton x2, Red Bone x1", "Imp Captain x3, Needler x1", "Imp Captain x3, Needler x3", "Imp Captain x4, Imp x2", "SwordRat x3, Needler x3", "Raven x1", "Needler x2, SwordRat x2", "Raven x1 Cockatrice x3", "Spirit x3, Soul x1", "Soul x2, Red Bone x2", "Skelton x3, Red Bone x2", "Lilith x1, Red Bone x2", "Ghoul x1, Red Bone x2, Skelton x2", "Spirit x2, Soul x2, Red Bone x2", "Zombie x2, Ghoul x2", "Ghoul x2, Soul x2", "Revenant x1, Ghoul x3", "Zombie x3, Ghoul x2, Revenant x2", "Lilith x1", "Soul x2, Ghoul x2, Revenant x2", "Soul x3, Ghoul x1, Revenant x1", "Lilith x2", "Piranha x2, FangShel x1, Evilshell x1", "Pike x3, Piranha x3", "Crocdile x1, Piranha x2", "FangShel x3, Aligator x1, Crocdile x1", "Piranha x2, ElecFish x2", "Crocdile x1, ElecFish x3", "AquaWorm x1, Piranha x3", "Hydra x2", "Crocdile x2", "AquaWorm x1, ElecFish x3", "AquaWorm x1, Hydra x1, Crocdile x1", "Guard x2", "Guard x1, Hydra x2", "AquaWorm x2", "StingRat x3, Treant x2", "Panther x1, StingRat x3", "Cannibal x1, Treant x2", "Python x1, StingRat x2", "Ogre x1, Panther x2", "Ogre x2", "Cave Bat x3", "Panther x2", "Mage x2", "CaveNaga x1, Ogre x1", "CaveNaga x1, Python x2", "CaveNaga x1, Python x2", "Ogre x3", "VampGirl x1, Cave Bat x3", "Mage x1, Panther x1, Ogre x1", "Panther x2, Ogre x2", "CaveNaga x2, Python x2", "VampGirl x2, Cave Bat x3", "Panther x2, Ogre x1, CaveNaga x1", "VampGirl x1, Cave Bat x6", "Marion x1, (Summon Puppet x1), Puppet x2", "Marion x1, (Summon Puppet x1), Puppet x3", "Marion x1,(Summon Puppet x1), Puppet x3", "Centaur x1, IceBeast x2", "Centaur x2, IceBeast x2", "Centaur x3", "Centaur x1, Gremlin x2", "Slime x4", "Ice Lizard x1, Slime x3", "Jelly x1, Slime x2, Cream x1", "Gremlin x2, Ice Lizard x2", "Carapace x2, Ice Lizard x2", "SwordMan x2", "SwordMan x1, Ice Lizard x2", "Swordman x2, Ice Lizard x 2", "SwordMan x1, IceBeast x2", "EpeeGirl x2, SwordMan x2", "EpeeGirl x3", "Witch x1, EpeeGirl x1, Swordman x1", "EpeeGirl x1, Ice Lizard x1, IceBeast x1", "Witch x1, EpeeGirl, x1, Centaur x1", "Witch x1, IceBeast x2, EpeeGirl x1", "Witch x1, SwordMan x2, EpeeGirl x1", "Witch x1, EpeeGirl x2", "Imp x1", "Imp x1", "Imp x1", "Imp x1", "Imp x1", "Roc x1, Roc Baby x2", "Roc x1, Roc Baby x3", "HugeCell x4", "HugeCell x3", "GiantBat x3", "GiantBat x4", "GiantBat x3, Cave Bat x3", "Ironback x2", "Ironback x1, Armadilo x1, BlackLiz x1", "Ironback x2, BlackLiz x2", "Skull x3", "Skull x4", "Red Bone x3, Skull x2", "Staleman x1", "Staleman x1, Skull x2", "Staleman x1, Skull x2, Red Bone x2", "Mad Ogre x2", "Mad Ogre x3", "Mad Ogre x4", "BlackCat x2", "BlackCat x3", "Lamia x1, BlackCat x1, Mad Ogre x1", "Mad Ogre x1, BlackCat x2", "Mad Ogre x2, BlackCat x2", "Egg(Lamia x1)", "Lamia x2", "Lamia x3", "Lamia x1, Mad Ogre x1", "BlackCat x2, Lamia x1", "BlackCat x2, Lamia x2", "Balloon x3", "Balloon x4", "Mad Ogre x1, BlackCat x1, Balloon x2", "Grudger x1, Mad Ogre x1, Balloon x2", "Grudger x2", "Grudger x3", "Balloon x3, Grudger x1", "Grudger x2, Lamia x1", "BladeMan x3", "BlackCat x1, BladeMan x1, Mad Ogre x1", "Blademan x1, Balloon x3, BlackCat x1", "Mad Ogre x1, BladeMan x1, BlackCat x1", "Egg(Green Dragon x1)", "Sorcerer x1, (Summon Mad Ogre x1), BladeMan x2", "Sorcerer x1, (Summon BlackCat x1), BladeMan x2", "Sorcerer x1, (Summon BladeMan x1), BladeMan x2", "Sorcerer x1, (Summon Green Dragon x1), BladeMan x2", "Imp x1", "Searcher x1, (Summon Machine x1)", "Searcher x1, (Summon Machine x1), Machine x2", "Machine x2, Beamer x1", "Machine x2, Beamer x2", "Searcher x1, (Summon Horseman x1), Machine x2", "Horseman x1, Machine x2", "MacGiant x1", "MacGiant x1", "Horseman x1, Beamer x2", "Horseman x1, Beamer x1, Machine x1", "Searcher x1, (Summon MacGiant x1)", "MacGiant x1, Horseman x1", "Searcher x1, (Summon Horseman x1), Beamer x2", "Machine x2, Beamer x3", "Horseman x2", "D.Machin x1", "Searcher x1, (Summon D.Machin x1), Beamer x2", "MacGiant x1, Machine x1, Beamer x1", "MacGiant x1, Horseman x1, Beamer x1", "Imp x1", "Machine x3, Beamer x2", "Beamer x1, Machine x2, Horseman x1", "MacGiant x2", "Imp x1", "Imp x6", "SwordRat x6", "FlameDog x2, BlackLiz x2", "Horseman x1, Machine x2", "Horseman x1, Juclyote x2", "Horseman x2", "EvilMask", "Imp x1", "Armadillo x2", "Dark Imp x3, Armadillo x1, BlackLiz x1", "Armadillo x1, Tortise x2", "Dark Imp x4", "Tortise x1, Dark Imp x2", "Tortise x2, Armadillo x1, Black Liz x1", "BlackLiz x3", "Marion x1, (Summon EvilDoll x1), EvilDoll x2", "Marion x1, (Summon EvilDoll x1), EvilDoll x3", "FlameDog x2", "FlameDog x3", "FlameDog x4", "FlameMan x1, FlameDog x2", "FlameMan x2, FlameDog x2", "BlackLiz x2", "BlackLiz x3", "Egg(BlackLiz x1)", "Tortoise x2, BlackLiz x1", "Tortoise x2, BlackLiz x2", "Tofu x4", "Tofu x6", "Chimera x1, Tofu x3", "Chimera x1", "Chimera x2", "Chimera x1, FlameMan x1", "Chimera x1, FlameMan x2", "Chimera x1, FlameDog x2", "Stoneman x1, Medusa x1", "Medusa x2", "Stoneman x2", "Alert x1, (Summon Chimera x1)", "Alert x1, (Summon Stoneman x1)", "Alert x1, (Summon Naga x1)", "Alert x1, (Summon FlameDog x1)", "Alert x1, (Summon Naga x1)", "Egg(Lamia x1), Q. Lamia x1", "Egg(Lamia x3), Q. Lamia x1", "Q. Lamia x1, Egg(Lamia x1), BlackCat x1", "Q. Lamia x1, Egg(Lamia x1), Lamia x2", "Ironman x1", "Ironman x2", "Ironman x1, BladeMan x2", "Green Dragon x1", "BladeMan x1, BlackCat x1, Q. Lamia x1", "Ironman x1, Blackcat x2", "Sorcerer x1, (Summon Q. Lamia x1), BlackCat x2", "Sorcerer x1, (Summon Ironman x1), BlackCat x2", "Sorcerer x1, (Summon Q. Lamia x1), BlackCat x2", "Grudger x2, BladeMan x2", "Grudger x2, BladeMan x2", "Grudger x1, BladeMan x2", "Grudger x1, BlackCat x2, BladeMan x1", "Centpede x1", "TrapRose x1, Centpede x2", "TrapRose x2", "RocLarva x4", "RockMoth x2", "RockMoth x2, RocLarva x2", "TrapRose x1, RockMoth x2", "TrapRose x1, RockMoth x2, RocLarva x2", "ToadLady x1, TinyToad x3", "ToadLady x1, TinyToad x6", "Marlboro x2", "Marlboro x3", "Marlboro x1, Ghost x2", "Ghost x3", "Ghost x4", "Marlboro x1, Ghost x1, DarkTree x1", "Ghost x3, DarkTree x2", "DarkTree x2, Marlboro x1, Ghost x1", "Centpede x1, Marlboro x2", "DarkTree x2, Marlboro x2", "Red Eye x2", "Red Eye x3", "Hooligan x1, Red Eye x1", "Hooligan x1", "Hooligan x2", "Warrior x2, Fiend x2", "Warrior x2, Fiend x4", "Conjurer x1, (Summon Imp x1)", "Conjurer x1, (Summon RockMoth x1)", "Conjurer x1, (Summon Arachne x1)", "Conjurer x1, (Summon HugeNaga x1)", "Conjurer x1, (Summon Clapper x1)", "Arachne x1", "Arachne x2", "Clapper x1", "Clapper x2", "Were Bat x4", "Were Bat x3", "VampLady x1, Were Bat x3", "VampLady x1, Were Bat x6", "VampLady x2, Were Bat x3", "Yellow Dragonragon x1", "Screamer x2", "Mantcore x1, Screamer x1", "HugeNaga x2", "Screamer x1, HugeNaga x1", "HugeNaga x1, Screamer x2", "MoonCell x2, Pudding x2", "Juclyote x2, MoonCell x2, Grenade x1", "Procyote x1, Juclyote x2", "Procyote x1, Pudding x2", "Juclyote x1, Procyote x2", "Red Worm x1, Procyote x1, Juclyote x1", "Red Worm x2", "H.Ito", "K.Higuchi", "K.Aoki", "A.Matsui", "K.Yoshii", "H.Nakada", "Takahashi", "Warlock x1", "Warlock x1, Kary x1", "Warlock x1, Kary x2", "RedGiant x1", "Warlock x1, Kary x1, RedGiant x1", "RedGiant x2", "Warlock x2, RedGiant x1", "Dragon Bone x1", "Ging-Ryu x1", "Dragon Bone x1, Warlock x1", "King-Ryu x2", "Warlock x3", "Blue Dragon x1", "FatalEye x1", "Blue Dragon x2", "Ging-Ryu x1, RedGiant x1", "FatalEye x2", "D.Fossil x1", "King-Ryu x1", "King-Ryu x1, Ging-Ryu x1", "Tricker x1", "Tricker x1", "PinkPuff x5", "EvilMask x1", "Red D. x1", "Red D. x2", "Red D. x1, Behemoth x1", "EvilMask x1", "Behemoth x2", "EvilMask x2", "Red D. x3", "Breath x1", "Mind x1", "Behemoth x1", "Pudding x4", "Pudding x2, Grenade x2", "Balloon x2, Grenade x2", "Slime x1, Tofu x1, Pudding x1", "Red Worm x1, Grenade x3", "TrapRose x1, GlomWing x2, Crawler x2", "Medusa x1, Gorgon x1, Stoneman x1", "Talantla x1, BlackCat x2", "Egg(BlackLiz x1)", "Egg(Lamia x1)", "Egg(HugeNaga x1)", "Egg(Green Dragon x1)", "Egg(Yellow Dragon x1)" } local function retrievegroup(formation) if formation < 0x1DF then return TableEnemyFormation[formation+1] else return "Unknown" end end local function ecords_y(y) local ex = bit.lshift(bit.band(y,0x0F),3) +0x0C - 0x16 return ex end local function ecords_x(x) local ey = bit.rshift(bit.band(x,0xF0),1) + 8 + 0x10 return ey end local function rndbattle() local steps = 0 local encounter = false local val1 = 0 local val2 = 0 local val3 = 0 local val4 = 0 local val5 = 0 local rollover = false local area = memory.readbyte(0x7E1700) if area == 0 then -- Earth world map while encounter == false do steps = steps +1 val1 = bit.band(bit.rshift(memory.readbyte (0x7E1707),2),0xF8) val2 = bit.rshift(memory.readbyte(0x7E1706),5) + val1 val3 = memory.readbyte(0x0EC300 + val2) val4 = memory.readbyte(0x14EE00+((memory.readbyte(0x7E0686)+steps)) % 0x100) if (memory.readbyte(0x7E0686) + steps) % 0x100 == 0 then rollover = true end if rollover == true then val5 = (val4 + (memory.readbyte(0x7E17EF)) + 0x11) % 0x100 else val5 = (val4 + memory.readbyte(0x7E17EF)) % 0x100 end if val5 < val3 then gui.text(145,3,"(Earth world map)",0x0000FFFF) encounter = true end if steps > 500 then encounter = true steps = 0 gui.text(145,3,"(No Encounters)",0x0000FFFF) end end elseif area == 1 then -- Underground while encounter == false do steps = steps +1 val1 = (memory.readbyte(0x7E0686) + steps) % 0x100 val2 = memory.readbyte(0x14EE00 + val1) if val1 == 0 then rollover = true end if rollover == true then val3 = val2 + ((memory.readbyte (0x7E17EF)+0x11) % 0x100) else val3 = val2 + memory.readbyte (0x7E17EF) end val3 = val3 % 0x100 val4 = memory.readbyte(0x0EC340) if val3 < val4 then gui.text(145,3,"(Underworld world map)",0x0000FFFF) encounter = true end if steps > 500 then encounter = true gui.text(145,3,"(No Encounters)",0x0000FFFF) steps = 0 end end elseif area == 2 then -- Moon while encounter == false do steps = steps +1 val1 = (memory.readbyte(0x7E0686) + steps) % 0x100 val2 = memory.readbyte(0x14EE00 + val1) if val1 == 0 then rollover = true end if rollover == true then val3 = val2 + ((memory.readbyte(0x7E17EF) + 0x11)%0x100) else val3 = val2 + memory.readbyte (0x7E17EF) end val3 = val3 % 0x100 val4 = memory.readbyte(0x0EC341) if val3 < val4 then gui.text(145,3,"(Moon world map)",0x0000FFFF) encounter = true end if steps > 500 then encounter = true gui.text(145,3,"(No Encounters)",0x0000FFFF) steps = 0 end end elseif area > 2 then -- Dungeon while encounter == false do steps = steps +1 val1 = memory.readbyte(0x7E1702) if memory.readbyte(0x7E1701) > 0 then val1 = val1 + 0x100 end val2 = memory.readbyte(0x0EC342+ val1) val3 = memory.readbyte(0x7E0686) + steps val3 = val3 % 0x100 val4 = memory.readbyte(0x14EE00 + val3) if val3 == 0 then rollover = true end if rollover == true then val5 = val4 + ((memory.readbyte(0x7E17EF) + 0x11) % 0x100) else val5 = val4 + memory.readbyte(0x7E17EF) end val5 = val5 % 0x100 if val5 < val2 then gui.text(145,3,"(Dungeon)",0x0000FFFF) encounter = true end if steps > 500 then encounter = true gui.text(145,3,"(No Encounters)",0x0000FFFF) steps = 0 end end end return steps end local function enemygroup(num) local area = memory.readbyte(0x7E1700) local group = nil local x = 0 local x2 = 0 local val1 = 0 local val2 = 0 local val3 = 0 local rollover = false local rollover2 = false local i = 0 if area == 0 then -- Earth world map for i=0, num do val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),2), 0xF8) x = (bit.rshift(memory.readbyte(0x7E1706),5) + val1) % 0x100 val2 = bit.lshift(memory.readbyte(0x0ec542+x),3) x2 = (memory.readbyte(0x7E0687) + i) % 0x100 if (memory.readbyte(0x7E0687) + i) % 0x100 == 0xFF then rollover = true end if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then val3 = memory.readbyte(0x7E17EE) +0x11 elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11) % 0x100) elseif rollover == false then val3 = memory.readbyte(0x14EE00 + x2) + memory.readbyte(0x7E17EE) end val3 = val3 % 0x100 --val3 = (memory.readbyte(0x14ee00+x2) + memory.readbyte(0x7E17EE)) % 0x100 if val3 > 0xFC then val2 = val2 + 7 elseif val3 > 0xEC then val2 = val2 + 6 elseif val3 > 0xCC then val2 = val2 + 5 elseif val3 > 0xAC then val2 = val2 + 4 elseif val3 > 0x81 then val2 = val2 + 3 elseif val3 > 0x56 then val2 = val2 + 2 elseif val3 > 0x2B then val2 = val2 + 1 end val2 = memory.readbyte(0xEC796+val2) if memory.readbyte(0x7E1701) > 0 then val2 = val2 + 0x100 end group = val2 end elseif area == 1 then -- Underground world map for i=0, num do val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),3),0xFC) x = bit.rshift(memory.readbyte(0x7E1706),5) x = (x + val1) % 0x100 val2 = bit.lshift(memory.readbyte(0x0ec582+x),3) x2 = (memory.readbyte(0x7E0687) + i) % 0x100 if memory.readbyte(0x7E0687) == 0xFF then rollover = true end if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then val3 = memory.readbyte(0x7E17EE) +0x11 elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11) % 0x100) elseif rollover == false then val3 = memory.readbyte(0x14EE00 + x2) + memory.readbyte(0x7E17EE) end val3 = val3 % 0x100 if val3 > 0xFC then val2 = val2 + 7 elseif val3 > 0xEC then val2 = val2 + 6 elseif val3 > 0xCC then val2 = val2 + 5 elseif val3 > 0xAC then val2 = val2 + 4 elseif val3 > 0x81 then val2 = val2 + 3 elseif val3 > 0x56 then val2 = val2 + 2 elseif val3 > 0x2B then val2 = val2 + 1 end val2 = memory.readbyte(0xEC796+val2) if memory.readbyte(0x7E1701) > 0 then val2 = val2 + 0x100 end group = val2 end elseif area == 2 then --Moon world map for i = 0, num do if memory.readbyte(0x7E1707) > 0x20 then x = 2 end if memory.readbyte(0x7E1706) > 0x20 then x = x + 1 end if (memory.readbyte(0x7E0687) + i) %0x100 == 0xFF then rollover = true end val2 = memory.readbyte(0x0EC592 + x) val2 = bit.lshift(val2,3) x2 = (memory.readbyte(0x7E0687) + i) % 0x100 if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then val3 = memory.readbyte(0x7E17EE) +0x11 elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11) % 0x100) elseif rollover == false then val3 = memory.readbyte(0x14EE00 + x2)+ memory.readbyte(0x7E17EE) end val3 = val3 % 0x100 if val3 > 0xFC then val2 = val2 + 7 elseif val3 > 0xEC then val2 = val2 + 6 elseif val3 > 0xCC then val2 = val2 + 5 elseif val3 > 0xAC then val2 = val2 + 4 elseif val3 > 0x81 then val2 = val2 + 3 elseif val3 > 0x56 then val2 = val2 + 2 elseif val3 > 0x2B then val2 = val2 + 1 end val2 = memory.readbyte(0x0EC796+val2) if memory.readbyte(0x7E1701) > 0 then val2 = val2 + 0x100 end group = val2 end elseif area > 2 then for i=0, num do --Dungeon val1 = memory.readbyte(0x7E1702) if memory.readbyte(0x7E1701) > 0 then val1 = val1 + 0x100 end val2 = bit.lshift(memory.readbyte(0x0EC596+val1),3) val3 = memory.readbyte(0x14EE00 + ((memory.readbyte(0x7E0687)+i)%0x100)) if memory.readbyte(0x7E0687) == 0xFF then rollover = true end if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then val3 = (memory.readbyte(0x7E17EE)+0x11) % 0x100 elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then val3 = val3 + ((memory.readbyte(0x7E17EE) + 0x11) % 0x100) elseif rollover == false then val3 = val3 + memory.readbyte(0x7E17EE) end val3 = val3 % 0x100 if val3 > 0xFC then val2 = val2 + 7 elseif val3 > 0xEC then val2 = val2 + 6 elseif val3 > 0xCC then val2 = val2 + 5 elseif val3 > 0xAC then val2 = val2 + 4 elseif val3 > 0x81 then val2 = val2 + 3 elseif val3 > 0x56 then val2 = val2 + 2 elseif val3 > 0x2B then val2 = val2 + 1 end val4 = memory.readbyte(0x0EC816 + val2) if memory.readbyte(0x7E1701) > 0 then val4 = val4 + 0x100 end group = val4 end end return group end local function predictgroup() gui.text(3,13,"Encounter Groups:",0xABFF93FF) for i = 0, groupmax-1 do if i == 0 then gui.text(3,23,"1: " .. retrievegroup(enemygroup(i)) .. " (0x" .. string.format("%X",enemygroup(i)) .. ")",0xABFF93FF) else gui.text(3,23+(10 * i),i+1 .. ": " .. retrievegroup(enemygroup(i)) .. " (0x" .. string.format("%X",enemygroup(i)) .. ")",0xFFFFFF7F) end end end local function enemygroupexists(num) local area = memory.readbyte(0x7E1700) local group = 0 local x = 0 local x2 = 0 local val1 = 0 local val2 = 0 local val3 = 0 local rollover = false local rollover2 = false local i = 0 local j = 0 if area == 0 then -- Earth world map val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),2), 0xF8) x = (bit.rshift(memory.readbyte(0x7E1706),5) + val1) % 0x100 val2 = bit.lshift(memory.readbyte(0x0ec542+x),3) for j = val2, val2+7 do if num == memory.readbyte(0xEC796+j) then group = 1 end if memory.readbyte(0x7E1701) > 0 then if num == (memory.readbyte(0xEC796+j)+0x100) then group = 1 end end end elseif area == 1 then -- Underground world map val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),3),0xFC) x = bit.rshift(memory.readbyte(0x7E1706),5) x = (x + val1) % 0x100 val2 = bit.lshift(memory.readbyte(0x0ec582+x),3) for j = val2, val2+7 do if num == memory.readbyte(0xEC796+j) then group = 1 end if memory.readbyte(0x7E1701) > 0 then if num == (memory.readbyte(0xEC796+j)+0x100) then group = 1 end end end elseif area == 2 then --Moon world map if memory.readbyte(0x7E1707) > 0x20 then x = 2 end if memory.readbyte(0x7E1706) > 0x20 then x = x + 1 end val2 = memory.readbyte(0x0EC592 + x) val2 = bit.lshift(val2,3) for j = val2, val2+7 do if num == memory.readbyte(0xEC796+j) then group = 1 end if memory.readbyte(0x7E1701) > 0 then if num == (memory.readbyte(0xEC796+j)+0x100) then group = 1 end end end elseif area > 2 then --Dungeon val1 = memory.readbyte(0x7E1702) if memory.readbyte(0x7E1701) > 0 then val1 = val1 + 0x100 end val2 = bit.lshift(memory.readbyte(0x0EC596+val1),3) for j = val2, val2+7 do if num == memory.readbyte(0xEC816+j) then group = 1 end if memory.readbyte(0x7E1701) > 0 then if num == (memory.readbyte(0xEC796+j)+0x100) then group = 1 end end end end return group end local function findenemy(e,x) local c = 0 local i = 0 local result = ": " if enemygroupexists(e) == 0 then result = "(Enemy not present in area)" return result end while c ~= x do if enemygroup(i) == e then c = c +1 if c ~= x then result = result .. i .. "," else result = result .. i end end i = i + 1 if i >= 500 and c == 0 then result = "(Enemy not present in next 500 battles)" c = x end end result = retrievegroup(e) .. " (" .. string.format("%X",e) .. ")" .. result return result end local function drawatb_e(x,y,atb,e) gui.box(x-3, y-4, x+17, y-1, 0x00000000, 0x000000FF) if atb == 0 then enemy_atbm[e] = 0 gui.box(x-3, y-4, x+17, y-1, 0xFF0000C0, 0000000000) else if enemy_atbm[e] == 0 then enemy_atbm[e] = atb end gui.box(x-3, y-4, (x-3)+20-((20/enemy_atbm[e])*atb), y-1, 0xFF0000C0, 0000000000) --gui.text(x,y, enemy_atb[e] .. "/" .. enemy_atbm[e]) end end local function drawatb_c(x,y,atb,c) gui.box(x-3, y-4, x+17, y-1, 0x00000000, 0x000000FF) if atb == 0 then char_atbm[c] = 0 gui.box(x-3, y-4, x+17, y-1, 0xFFFF00C0, 0000000000) else if char_atbm[c] == 0 then char_atbm[c] = atb end gui.box(x-3, y-4, (x-3)+20-((20/char_atbm[c])*atb), y-1, 0xFFFF00C0, 0000000000) --gui.text(x,y, character_atb[c] .. "/" .. char_atbm[c]) end end -- For who knows what reason, the data of the characters are not in order, so this fix it local function fix(character) fix_order = {3, 1, 5, 2, 4} return fix_order[character] end while true do character_atb = {} character_x = {} character_y = {} for c=1, 5 do character_atb[fix(c)] = memory.readbyte(0x7E2A07 + 0x15*(c-1)) character_x[fix(c)] = memory.readbyte(0x7EEFC5 + 0x10*(c-1)) character_y[fix(c)] = memory.readbyte(0x7EEFC6 + 0x10*(c-1)) end enemy_atb = {} enemy_cur_hp = {} enemy_max_hp = {} enemy_xy = {} for e=1, 8 do enemy_atb[e] = memory.readbyte(0x7E2A70 + 0x15*(e-1)) enemy_cur_hp[e] = memory.readword(0x7E2287 + 0x80*(e-1)) enemy_max_hp[e] = memory.readword(0x7E2289 + 0x80*(e-1)) enemy_xy[e] = memory.readbyte(0x7E29A5 + 0x01*(e-1)) end battle = memory.readbyte(0x7E0201) attack = memory.readbyte(0x7E3581) -- normal 00, back 08 if battle ~= 0x85 then for c=1, 5 do drawatb_c(character_x[c], character_y[c], character_atb[c], c) end for e=1, 8 do if enemy_cur_hp[e] > 0 then gui.text( ecords_x(enemy_xy[e]), ecords_y(enemy_xy[e]), e .. " " .. enemy_cur_hp[e] .. "/" .. enemy_max_hp[e] ) drawatb_e(ecords_x(enemy_xy[e]), ecords_y(enemy_xy[e]), enemy_atb[e], e) end end else for i=1,5 do char_atbm[i] = 0 end for i=1,8 do enemy_atbm[i] = 0 end gui.text( 3, 3, "Steps until random battle: ") gui.text(111, 3, rndbattle(), 0xFFFF00FF) gui.text(125, 3, "("..string.format("%X",memory.readbyte(0x7E0686)) .. ")") if rndbattle() ~= 0 then predictgroup() end -- Uncomment to find a specific enemy group, the way its implemented slows the emulator down tremendously if its a rare spawn or a high amount is desired -- format is findenemy(ENEMY VALUE,NEXT NUMBER OF ENCOUNTERS) -- I.E. findenemy(0x196,5) will look for the next 5 pink puff encounters --gui.text(5,100,findenemy(0x196,2)) end snes9x.frameadvance() end
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
✅ MAKE $2500 IN 15 MIN ✅ Working 💵 💎
JavaScript | 11 min ago | 0.22 KB
✅ Make 3000$ in 20 minutes 💵 💎
JavaScript | 18 min ago | 0.22 KB
✅ Instant BTC Profit Method ✅ Working 🚨 🔥
JavaScript | 24 min ago | 0.22 KB
Сумма НУП
C++ | 25 min ago | 1.97 KB
Вася и пароль
C++ | 26 min ago | 2.71 KB
Keypad Toggle rev_01
Arduino | 27 min ago | 2.93 KB
Радуга, Флаттершай и шахматная раскраска
C++ | 27 min ago | 0.75 KB
✅ Exchange profit method 🚨 🔥
JavaScript | 31 min ago | 0.22 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!