Advertisement
Guest User

Untitled

a guest
Oct 4th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 42.69 KB | None | 0 0
  1. -- Globals
  2.  
  3.   c1_atbm = 0
  4.   c2_atbm = 0
  5.   c3_atbm = 0
  6.   c4_atbm = 0
  7.   c5_atbm = 0
  8.  
  9.   e1_atbm = 0
  10.   e2_atbm = 0
  11.   e3_atbm = 0
  12.   e4_atbm = 0
  13.   e5_atbm = 0
  14.   e6_atbm = 0
  15.   e7_atbm = 0
  16.   e8_atbm = 0
  17.  
  18.   -- Change this to the amount of groups you want displayed at a time
  19.   groupmax = 5
  20.  
  21. local function retrievegroup(e)
  22.  
  23.     local group = ""
  24.    
  25.     if e == 0x00 then
  26.         group = "Imp x3"
  27.     elseif e == 0x001 then
  28.         group = "FloatEye x2"
  29.     elseif e == 0x002 then
  30.         group = "Eagle x2, FloatEye x1"
  31.     elseif e == 0x003 then
  32.         group = "Eagle x3"
  33.     elseif e == 0x004 then
  34.         group = "Imp x3, Sword Rat x1"
  35.     elseif e == 0x005 then
  36.         group = "SwordRat x2, Imp x2"
  37.     elseif e == 0x006 then
  38.         group = "Imp x4"
  39.     elseif e == 0x007 then
  40.         group = "Larva x3"
  41.     elseif e == 0x008 then
  42.         group = "SandMoth x2, Larva x2"
  43.     elseif e == 0x009 then
  44.         group = "Sand Man x4"
  45.     elseif e == 0x00A then
  46.         group = "SandPede x1, Sand Man x2"
  47.     elseif e == 0x00B then
  48.         group = "SandWorm x1"
  49.     elseif e == 0x00C then
  50.         group = "Evilshell x3 WaterBug x1"
  51.     elseif e == 0x00D then
  52.         group = "Pike x3"
  53.     elseif e == 0x00E then
  54.         group = "CaveToad x3"
  55.     elseif e == 0x00F then
  56.         group = "Pike x2, Evilshell x2"
  57.     elseif e == 0x010 then
  58.         group = "Zombie x4"
  59.     elseif e == 0x011 then
  60.         group = "Pike x2, Evilshell x2, WaterBug x2"
  61.     elseif e == 0x012 then
  62.         group = "Jelly x4"
  63.     elseif e == 0x013 then
  64.         group = "TinyMage x2, WaterHag x4"
  65.     elseif e == 0x014 then
  66.         group = "CaveToad x4"
  67.     elseif e == 0x015 then
  68.         group = "CaveToad x2, Mad Toad x2"
  69.     elseif e == 0x016 then
  70.         group = "Aligator x1, Pike x2"
  71.     elseif e == 0x017 then
  72.         group = "Aligator x2"
  73.     elseif e == 0x018 then
  74.         group = "Zombie x6"
  75.     elseif e == 0x019 then
  76.         group = "Aligator x1, WaterBug x2"
  77.     elseif e == 0x01A then
  78.         group = "Mad Toad x4"
  79.     elseif e == 0x01B then
  80.         group = "TinyMage x4"
  81.     elseif e == 0x01C then
  82.         group = "Imp x8"
  83.     elseif e == 0x01D then
  84.         group = "SwordRat x2, Imp x2, TinyMage x2"
  85.     elseif e == 0x01E then
  86.         group = "SandWorm x1, Sandpede x1"
  87.     elseif e == 0x01F then
  88.         group = "SandWorm x2"
  89.     elseif e == 0x020 then
  90.         group = "Imp x3, Imp Captain x1"
  91.     elseif e == 0x021 then
  92.         group = "Turtle x1, Imp x2"
  93.     elseif e == 0x022 then
  94.         group = "Cream x4"
  95.     elseif e == 0x023 then
  96.         group = "Basilisk x1, Imp x3"
  97.     elseif e == 0x024 then
  98.         group = "Turtle x2"
  99.     elseif e == 0x025 then
  100.         group = "Weeper x1, Turtle x1, Basilisk x1"
  101.     elseif e == 0x026 then
  102.         group = "Basilisk x1, Turtle x1"
  103.     elseif e == 0x027 then
  104.         group = "Weeper x2"
  105.     elseif e == 0x028 then
  106.         group = "Skelton x4"
  107.     elseif e == 0x029 then
  108.         group = "Spirit x2"
  109.     elseif e == 0x02A then
  110.         group = "Gargoyle x1, Cocktrice x1"
  111.     elseif e == 0x02B then
  112.         group = "Bomb x3"
  113.     elseif e == 0x02C then
  114.         group = "Cocktrice x3"
  115.     elseif e == 0x02D then
  116.         group = "Gargoyle x2"
  117.     elseif e == 0x02E then
  118.         group = "GrayBomb x2, Bomb x2"
  119.     elseif e == 0x02F then
  120.         group = "Spirit x2, Skelton x2"
  121.     elseif e == 0x031 then
  122.         group = "Red Bone x1, Skelton x3"
  123.     elseif e == 0x032 then
  124.         group = "GrayBomb x2, Bomb x4"
  125.     elseif e == 0x033 then
  126.         group = "Spirit x3, Skelton x2, Red Bone x1"
  127.     elseif e == 0x034 then
  128.         group = "Imp Captain x3, Needler x1"
  129.     elseif e == 0x035 then
  130.         group = "Imp Captain x3, Needler x3"
  131.     elseif e == 0x036 then
  132.         group = "Imp Captain x4, Imp x2"
  133.     elseif e == 0x037 then
  134.         group = "SwordRat x3, Needler x3"
  135.     elseif e == 0x038 then
  136.         group = "Raven x1"
  137.     elseif e == 0x03A then
  138.         group = "Needler x2, SwordRat x2"
  139.     elseif e == 0x039 then
  140.         group = "Raven x1 Cockatrice x3"
  141.     elseif e == 0x03C then
  142.         group = "Spirit x3, Soul x1"
  143.     elseif e == 0x03D then
  144.         group = "Soul x2, Red Bone x2"
  145.     elseif e == 0x03E then
  146.         group = "Skelton x3, Red Bone x2"
  147.     elseif e == 0x03F then
  148.         group = "Lilith x1, Red Bone x2"
  149.     elseif e == 0x040 then
  150.         group = "Ghoul x1, Red Bone x2, Skelton x2"
  151.     elseif e == 0x041 then
  152.         group = "Spirit x2, Soul x2, Red Bone x2"
  153.     elseif e == 0x042 then
  154.         group = "Zombie x2, Ghoul x2"
  155.     elseif e == 0x043 then
  156.         group = "Ghoul x2, Soul x2"
  157.     elseif e == 0x044 then
  158.         group = "Revenant x1, Ghoul x3"
  159.     elseif e == 0x045 then
  160.         group = "Zombie x3, Ghoul x2, Revenant x2"
  161.     elseif e == 0x046 then
  162.         group = "Lilith x1"
  163.     elseif e == 0x047 then
  164.         group = "Soul x2, Ghoul x2, Revenant x2"
  165.     elseif e == 0x048 then
  166.         group = "Soul x3, Ghoul x1, Revenant x1"
  167.     elseif e == 0x049 then
  168.         group = "Lilith x2"
  169.     elseif e == 0x04A then
  170.         group = "Piranha x2, FangShel x1, Evilshell x1"
  171.     elseif e == 0x04B then
  172.         group = "Pike x3, Piranha x3"
  173.     elseif e == 0x04C then
  174.         group = "Crocdile x1, Piranha x2"
  175.     elseif e == 0x04D then
  176.         group = "FangShel x3, Aligator x1, Crocdile x1"
  177.     elseif e == 0x04E then
  178.         group = "Piranha x2, ElecFish x2"
  179.     elseif e == 0x04F then
  180.         group = "Crocdile x1, ElecFish x3"
  181.     elseif e == 0x050 then
  182.         group = "AquaWorm x1, Piranha x3"
  183.     elseif e == 0x051 then
  184.         group = "Hydra x2"
  185.     elseif e == 0x052 then
  186.         group = "Crocdile x2"
  187.     elseif e == 0x053 then
  188.         group = "AquaWorm x1, ElecFish x3"
  189.     elseif e == 0x054 then
  190.         group = "AquaWorm x1, Hydra x1, Crocdile x1"
  191.     elseif e == 0x055 then
  192.         group = "Guard x2"
  193.     elseif e == 0x056 then
  194.         group = "Guard x1, Hydra x2"
  195.     elseif e == 0x057 then
  196.         group = "AquaWorm x2"
  197.     elseif e == 0x058 then
  198.         group = "StingRat x3, Treant x2"
  199.     elseif e == 0x059 then
  200.         group = "Panther x1, StingRat x3"
  201.     elseif e == 0x05A then
  202.         group = "Cannibal x1, Treant x2"
  203.     elseif e == 0x05B then
  204.         group = "Python x1, StingRat x2"
  205.     elseif e == 0x05C then
  206.         group = "Ogre x1, Panther x2"
  207.     elseif e == 0x05D then
  208.         group = "Ogre x2"
  209.     elseif e == 0x05E then
  210.         group = "Cave Bat x3"
  211.     elseif e == 0x05F then
  212.         group = "Panther x2"
  213.     elseif e == 0x060 then
  214.         group = "Mage x2"
  215.     elseif e == 0x061 then
  216.         group = "CaveNaga x1, Ogre x1"
  217.     elseif e == 0x062 then
  218.         group = "CaveNaga x1, Python x2"
  219.     elseif e == 0x062 then
  220.         group = "CaveNaga x1, Python x2"
  221.     elseif e == 0x063 then
  222.         group = "Ogre x3"
  223.     elseif e == 0x064 then
  224.         group = "VampGirl x1, Cave Bat x3"
  225.     elseif e == 0x065 then
  226.         group = "Mage x1, Panther x1, Ogre x1"
  227.     elseif e == 0x066 then
  228.         group = "Panther x2, Ogre x2"
  229.     elseif e == 0x067 then
  230.         group = "CaveNaga x2, Python x2"
  231.     elseif e == 0x068 then
  232.         group = "VampGirl x2, Cave Bat x3"
  233.     elseif e == 0x069 then
  234.         group = "Panther x2, Ogre x1, CaveNaga x1"
  235.     elseif e == 0x06A then
  236.         group = "VampGirl x1, Cave Bat x6"
  237.     elseif e == 0x06B then
  238.         group = "Marion x1, (Summon Puppet x1), Puppet x2"
  239.     elseif e == 0x06C then
  240.         group = "Marion x1, (Summon Puppet x1), Puppet x3"
  241.     elseif e == 0x06C then
  242.         group = "Marion x1,(Summon Puppet x1), Puppet x3"
  243.     elseif e == 0x06D then
  244.         group = "Centaur x1, IceBeast x2"
  245.     elseif e == 0x06E then
  246.         group = "Centaur x2, IceBeast x2"
  247.     elseif e == 0x06F then
  248.         group = "Centaur x3"
  249.     elseif e == 0x070 then
  250.         group = "Centaur x1, Gremlin x2"
  251.     elseif e == 0x071 then
  252.         group = "Slime x4"
  253.     elseif e == 0x072 then
  254.         group = "Ice Lizard x1, Slime x3"
  255.     elseif e == 0x073 then
  256.         group = "Jelly x1, Slime x2, Cream x1"
  257.     elseif e == 0x074 then
  258.         group = "Gremlin x2, Ice Lizard x2"
  259.     elseif e == 0x075 then
  260.         group = "Carapace x2, Ice Lizard x2"
  261.     elseif e == 0x076 then
  262.         group = "SwordMan x2"
  263.     elseif e == 0x077 then
  264.         group = "SwordMan x1, Ice Lizard x2"
  265.     elseif e == 0x078 then
  266.         group = "Swordman x2, Ice Lizard x 2"
  267.     elseif e == 0x079 then
  268.         group = "SwordMan x1, IceBeast x2"
  269.     elseif e == 0x07A then
  270.         group = "EpeeGirl x2, SwordMan x2"
  271.     elseif e == 0x07B then
  272.         group = "EpeeGirl x3"
  273.     elseif e == 0x07C then
  274.         group = "Witch x1, EpeeGirl x1, Swordman x1"
  275.     elseif e == 0x07D then
  276.         group = "EpeeGirl x1, Ice Lizard x1, IceBeast x1"
  277.     elseif e == 0x07E then
  278.         group = "Witch x1, EpeeGirl, x1, Centaur x1"
  279.     elseif e == 0x07F then
  280.         group = "Witch x1, IceBeast x2, EpeeGirl x1"
  281.     elseif e == 0x080 then
  282.         group = "Witch x1, SwordMan x2, EpeeGirl x1"
  283.     elseif e == 0x081 then
  284.         group = "Witch x1, EpeeGirl x2"
  285.     elseif e == 0x082 then
  286.         group = "Imp x1"
  287.     elseif e == 0x083 then
  288.         group = "Imp x1"
  289.     elseif e == 0x084 then
  290.         group = "Imp x1"
  291.     elseif e == 0x085 then
  292.         group = "Imp x1"
  293.     elseif e == 0x086 then
  294.         group = "Imp x1"
  295.     elseif e == 0x088 then
  296.         group = "Roc x1, Roc Baby x2"
  297.     elseif e == 0x089 then
  298.         group = "Roc x1, Roc Baby x3"
  299.     elseif e == 0x08A then
  300.         group = "HugeCell x4"
  301.     elseif e == 0x08B then
  302.         group = "HugeCell x3"
  303.     elseif e == 0x08C then
  304.         group = "GiantBat x3"
  305.     elseif e == 0x08D then
  306.         group = "GiantBat x4"
  307.     elseif e == 0x08E then
  308.         group = "GiantBat x3, Cave Bat x3"
  309.     elseif e == 0x08F then
  310.         group = "Ironback x2"
  311.     elseif e == 0x090 then
  312.         group = "Ironback x1, Armadilo x1, BlackLiz x1"
  313.     elseif e == 0x091 then
  314.         group = "Ironback x2, BlackLiz x2"
  315.     elseif e == 0x092 then
  316.         group = "Skull x3"
  317.     elseif e == 0x093 then
  318.         group = "Skull x4"
  319.     elseif e == 0x094 then
  320.         group = "Red Bone x3, Skull x2"
  321.     elseif e == 0x095 then
  322.         group = "Staleman x1"
  323.     elseif e == 0x096 then
  324.         group = "Staleman x1, Skull x2"
  325.     elseif e == 0x097 then
  326.         group = "Staleman x1, Skull x2, Red Bone x2"
  327.     elseif e == 0x098 then
  328.         group = "Mad Ogre x2"
  329.     elseif e == 0x099 then
  330.         group = "Mad Ogre x3"
  331.     elseif e == 0x09A then
  332.         group = "Mad Ogre x4"
  333.     elseif e == 0x09B then
  334.         group = "BlackCat x2"
  335.     elseif e == 0x09C then
  336.         group = "BlackCat x3"
  337.     elseif e == 0x09D then
  338.         group = "Lamia x1, BlackCat x1, Mad Ogre x1"
  339.     elseif e == 0x09E then
  340.         group = "Mad Ogre x1, BlackCat x2"
  341.     elseif e == 0x09F then
  342.         group = "Mad Ogre x2, BlackCat x2"
  343.     elseif e == 0x0A0 then
  344.         group = "Egg(Lamia x1)"
  345.     elseif e == 0x0A1 then
  346.         group = "Lamia x2"
  347.     elseif e == 0x0A2 then
  348.         group = "Lamia x3"
  349.     elseif e == 0x0A3 then
  350.         group = "Lamia x1, Mad Ogre x1"
  351.     elseif e == 0x0A4 then
  352.         group = "BlackCat x2, Lamia x1"
  353.     elseif e == 0x0A5 then
  354.         group = "BlackCat x2, Lamia x2"
  355.     elseif e == 0x0A6 then
  356.         group = "Balloon x3"
  357.     elseif e == 0x0A7 then
  358.         group = "Balloon x4"
  359.     elseif e == 0x0A8 then
  360.         group = "Mad Ogre x1, BlackCat x1, Balloon x2"
  361.     elseif e == 0x0A9 then
  362.         group = "Grudger x1, Mad Ogre x1, Balloon x2"
  363.     elseif e == 0x0AA then
  364.         group = "Grudger x2"
  365.     elseif e == 0x0AB then
  366.         group = "Grudger x3"
  367.     elseif e == 0x0AC then
  368.         group = "Balloon x3, Grudger x1"
  369.     elseif e == 0x0AD then
  370.         group = "Grudger x2, Lamia x1"
  371.     elseif e == 0x0AE then
  372.         group = "BladeMan x3"
  373.     elseif e == 0x0AF then
  374.         group = "BlackCat x1, BladeMan x1, Mad Ogre x1"
  375.     elseif e == 0x0B0 then
  376.         group = "Blademan x1, Balloon x3, BlackCat x1"
  377.     elseif e == 0x0B1 then
  378.         group = "Mad Ogre x1, BladeMan x1, BlackCat x1"
  379.     elseif e == 0x0B2 then
  380.         group = "Egg(Green Dragon x1)"
  381.     elseif e == 0x0B3 then
  382.         group = "Sorcerer x1, (Summon Mad Ogre x1), BladeMan x2"
  383.     elseif e == 0x0B4 then
  384.         group = "Sorcerer x1, (Summon BlackCat x1), BladeMan x2"
  385.     elseif e == 0x0B5 then
  386.         group = "Sorcerer x1, (Summon BladeMan x1), BladeMan x2"
  387.     elseif e == 0x0B6 then
  388.         group = "Sorcerer x1, (Summon Green Dragon x1), BladeMan x2"
  389.     elseif e == 0x0B7 then
  390.         group = "Imp x1"
  391.     elseif e == 0x0B8 then
  392.         group = "Searcher x1, (Summon Machine x1)"
  393.     elseif e == 0x0B9 then
  394.         group = "Searcher x1, (Summon Machine x1), Machine x2"
  395.     elseif e == 0x0BA then
  396.         group = "Machine x2, Beamer x1"
  397.     elseif e == 0x0BB then
  398.         group = "Machine x2, Beamer x2"
  399.     elseif e == 0x0BC then
  400.         group = "Searcher x1, (Summon Horseman x1), Machine x2"
  401.     elseif e == 0x0BD then
  402.         group = "Horseman x1, Machine x2"
  403.     elseif e == 0x0BE then
  404.         group = "MacGiant x1"
  405.     elseif e == 0x0BF then
  406.         group = "MacGiant x1"
  407.     elseif e == 0x0C0 then
  408.         group = "Horseman x1, Beamer x2"
  409.     elseif e == 0x0C1 then
  410.         group = "Horseman x1, Beamer x1, Machine x1"
  411.     elseif e == 0x0C2 then
  412.         group = "Searcher x1, (Summon MacGiant x1)"
  413.     elseif e == 0x0C3 then
  414.         group = "MacGiant x1, Horseman x1"
  415.     elseif e == 0x0C4 then
  416.         group = "Searcher x1, (Summon Horseman x1), Beamer x2"
  417.     elseif e == 0x0C5 then
  418.         group = "Machine x2, Beamer x3"
  419.     elseif e == 0x0C6 then
  420.         group = "Horseman x2"
  421.     elseif e == 0x0C7 then
  422.         group = "D.Machin x1"
  423.     elseif e == 0x0C8 then
  424.         group = "Searcher x1, (Summon D.Machin x1), Beamer x2"
  425.     elseif e == 0x0C9 then
  426.         group = "MacGiant x1, Machine x1, Beamer x1"
  427.     elseif e == 0x0CA then
  428.         group = "MacGiant x1, Horseman x1, Beamer x1"
  429.     elseif e == 0x0CB then
  430.         group = "Imp x1"
  431.     elseif e == 0x0CC then
  432.         group = "Machine x3, Beamer x2"
  433.     elseif e == 0x0CD then
  434.         group = "Beamer x1, Machine x2, Horseman x1"
  435.     elseif e == 0x0CE then
  436.         group = "MacGiant x2"
  437.     elseif e == 0x0CF then
  438.         group = "Imp x1"
  439.     elseif e == 0x0D0 then
  440.         group = "Imp x6"
  441.     elseif e == 0x0D1 then
  442.         group = "SwordRat x6"
  443.     elseif e == 0x0D2 then
  444.         group = "FlameDog x2, BlackLiz x2"
  445.     elseif e == 0x0D3 then
  446.         group = "Horseman x1, Machine x2"
  447.     elseif e == 0x0D4 then
  448.         group = "Horseman x1, Juclyote x2"
  449.     elseif e == 0x0D5 then
  450.         group = "Horseman x2"
  451.     elseif e == 0x0D6 then
  452.         group = "EvilMask"
  453.     elseif e == 0x0D7 then
  454.         group = "Imp x1"
  455.     elseif e == 0x101 then
  456.         group = "Armadillo x2"
  457.     elseif e == 0x102 then
  458.         group = "Dark Imp x3, Armadillo x1, BlackLiz x1"
  459.     elseif e == 0x103 then
  460.         group = "Armadillo x1, Tortise x2"
  461.     elseif e == 0x104 then
  462.         group = "Dark Imp x4"
  463.     elseif e == 0x105 then
  464.         group = "Tortise x1, Dark Imp x2"
  465.     elseif e == 0x106 then
  466.         group = "Tortise x2, Armadillo x1, Black Liz x1"
  467.     elseif e == 0x107 then
  468.         group = "BlackLiz x3"
  469.     elseif e == 0x108 then
  470.         group = "Marion x1, (Summon EvilDoll x1), EvilDoll x2"
  471.     elseif e == 0x109 then
  472.         group = "Marion x1, (Summon EvilDoll x1), EvilDoll x3"
  473.     elseif e == 0x10A then
  474.         group = "FlameDog x2"
  475.     elseif e == 0x10B then
  476.         group = "FlameDog x3"
  477.     elseif e == 0x10C then
  478.         group = "FlameDog x4"
  479.     elseif e == 0x10D then
  480.         group = "FlameMan x1, FlameDog x2"
  481.     elseif e == 0x10E then
  482.         group = "FlameMan x2, FlameDog x2"
  483.     elseif e == 0x10F then
  484.         group = "BlackLiz x2"
  485.     elseif e == 0x110 then
  486.         group = "BlackLiz x3"
  487.     elseif e == 0x111 then
  488.         group = "Egg(BlackLiz x1)"
  489.     elseif e == 0x112 then
  490.         group = "Tortoise x2, BlackLiz x1"
  491.     elseif e == 0x113 then
  492.         group = "Tortoise x2, BlackLiz x2"
  493.     elseif e == 0x114 then
  494.         group = "Tofu x4"
  495.     elseif e == 0x115 then
  496.         group = "Tofu x6"
  497.     elseif e == 0x116 then
  498.         group = "Chimera x1, Tofu x3"
  499.     elseif e == 0x117 then
  500.         group = "Chimera x1"
  501.     elseif e == 0x118 then
  502.         group = "Chimera x2"
  503.     elseif e == 0x119 then
  504.         group = "Chimera x1, FlameMan x1"
  505.     elseif e == 0x11A then
  506.         group = "Chimera x1, FlameMan x2"
  507.     elseif e == 0x11B then
  508.         group = "Chimera x1, FlameDog x2"
  509.     elseif e == 0x11C then
  510.         group = "Stoneman x1, Medusa x1"
  511.     elseif e == 0x11D then
  512.         group = "Medusa x2"
  513.     elseif e == 0x11E then
  514.         group = "Stoneman x2"
  515.     elseif e == 0x11F then
  516.         group = "Alert x1, (Summon Chimera x1)"
  517.     elseif e == 0x120 then
  518.         group = "Alert x1, (Summon Stoneman x1)"
  519.     elseif e == 0x121 then
  520.         group = "Alert x1, (Summon Naga x1)"
  521.     elseif e == 0x122 then
  522.         group = "Alert x1, (Summon FlameDog x1)"
  523.     elseif e == 0x121 then
  524.         group = "Alert x1, (Summon Naga x1)"
  525.     elseif e == 0x128 then
  526.         group = "Egg(Lamia x1), Q. Lamia x1"
  527.     elseif e == 0x129 then
  528.         group = "Egg(Lamia x3), Q. Lamia x1"
  529.     elseif e == 0x12A then
  530.         group = "Q. Lamia x1, Egg(Lamia x1), BlackCat x1"
  531.     elseif e == 0x12B then
  532.         group = "Q. Lamia x1, Egg(Lamia x1), Lamia x2"
  533.     elseif e == 0x12C then
  534.         group = "Ironman x1"
  535.     elseif e == 0x12D then
  536.         group = "Ironman x2"
  537.     elseif e == 0x12E then
  538.         group = "Ironman x1, BladeMan x2"
  539.     elseif e == 0x12F then
  540.         group = "Green Dragon x1"
  541.     elseif e == 0x130 then
  542.         group = "BladeMan x1, BlackCat x1, Q. Lamia x1"
  543.     elseif e == 0x131 then
  544.         group = "Ironman x1, Blackcat x2"
  545.     elseif e == 0x132 then
  546.         group = "Sorcerer x1, (Summon Q. Lamia x1), BlackCat x2"
  547.     elseif e == 0x133 then
  548.         group = "Sorcerer x1, (Summon Ironman x1), BlackCat x2"
  549.     elseif e == 0x134 then
  550.         group = "Sorcerer x1, (Summon Q. Lamia x1), BlackCat x2"
  551.     elseif e == 0x135 then
  552.         group = "Grudger x2, BladeMan x2"
  553.     elseif e == 0x135 then
  554.         group = "Grudger x2, BladeMan x2"
  555.     elseif e == 0x136 then
  556.         group = "Grudger x1, BladeMan x2"
  557.     elseif e == 0x137 then
  558.         group = "Grudger x1, BlackCat x2, BladeMan x1"
  559.     elseif e == 0x138 then
  560.         group = "Centpede x1"
  561.     elseif e == 0x139 then
  562.         group = "TrapRose x1, Centpede x2"
  563.     elseif e == 0x13A then
  564.         group = "TrapRose x2"
  565.     elseif e == 0x13B then
  566.         group = "RocLarva x4"
  567.     elseif e == 0x13C then
  568.         group = "RockMoth x2"
  569.     elseif e == 0x13D then
  570.         group = "RockMoth x2, RocLarva x2"
  571.     elseif e == 0x13E then
  572.         group = "TrapRose x1, RockMoth x2"
  573.     elseif e == 0x13F then
  574.         group = "TrapRose x1, RockMoth x2, RocLarva x2"
  575.     elseif e == 0x140 then
  576.         group = "ToadLady x1, TinyToad x3"
  577.     elseif e == 0x141 then
  578.         group = "ToadLady x1, TinyToad x6"
  579.     elseif e == 0x142 then
  580.         group = "Marlboro x2"
  581.     elseif e == 0x143 then
  582.         group = "Marlboro x3"
  583.     elseif e == 0x144 then
  584.         group = "Marlboro x1, Ghost x2"
  585.     elseif e == 0x145 then
  586.         group = "Ghost x3"
  587.     elseif e == 0x146 then
  588.         group = "Ghost x4"
  589.     elseif e == 0x147 then
  590.         group = "Marlboro x1, Ghost x1, DarkTree x1"
  591.     elseif e == 0x148 then
  592.         group = "Ghost x3, DarkTree x2"
  593.     elseif e == 0x149 then
  594.         group = "DarkTree x2, Marlboro x1, Ghost x1"
  595.     elseif e == 0x14A then
  596.         group = "Centpede x1, Marlboro x2"
  597.     elseif e == 0x14B then
  598.         group = "DarkTree x2, Marlboro x2"
  599.     elseif e == 0x14C then
  600.         group = "Red Eye x2"
  601.     elseif e == 0x14D then
  602.         group = "Red Eye x3"
  603.     elseif e == 0x14E then
  604.         group = "Hooligan x1, Red Eye x1"
  605.     elseif e == 0x14F then
  606.         group = "Hooligan x1"
  607.     elseif e == 0x150 then
  608.         group = "Hooligan x2"
  609.     elseif e == 0x151 then
  610.         group = "Warrior x2, Fiend x2"
  611.     elseif e == 0x152 then
  612.         group = "Warrior x2, Fiend x4"
  613.     elseif e == 0x153 then
  614.         group = "Conjurer x1, (Summon Imp x1)"
  615.     elseif e == 0x154 then
  616.         group = "Conjurer x1, (Summon RockMoth x1)"
  617.     elseif e == 0x155 then
  618.         group = "Conjurer x1, (Summon Arachne x1)"
  619.     elseif e == 0x156 then
  620.         group = "Conjurer x1, (Summon HugeNaga x1)"
  621.     elseif e == 0x157 then
  622.         group = "Conjurer x1, (Summon Clapper x1)"
  623.     elseif e == 0x158 then
  624.         group = "Arachne x1"
  625.     elseif e == 0x159 then
  626.         group = "Arachne x2"
  627.     elseif e == 0x15A then
  628.         group = "Clapper x1"
  629.     elseif e == 0x15B then
  630.         group = "Clapper x2"
  631.     elseif e == 0x160 then
  632.         group = "Were Bat x4"
  633.     elseif e == 0x161 then
  634.         group = "Were Bat x3"
  635.     elseif e == 0x162 then
  636.         group = "VampLady x1, Were Bat x3"
  637.     elseif e == 0x163 then
  638.         group = "VampLady x1, Were Bat x6"
  639.     elseif e == 0x164 then
  640.         group = "VampLady x2, Were Bat x3"
  641.     elseif e == 0x165 then
  642.         group = "Yellow Dragonragon x1"
  643.     elseif e == 0x166 then
  644.         group = "Screamer x2"
  645.     elseif e == 0x167 then
  646.         group = "Mantcore x1, Screamer x1"
  647.     elseif e == 0x168 then
  648.         group = "HugeNaga x2"
  649.     elseif e == 0x169 then
  650.         group = "Screamer x1, HugeNaga x1"
  651.     elseif e == 0x16A then
  652.         group = "HugeNaga x1, Screamer x2"
  653.     elseif e == 0x170 then
  654.         group = "MoonCell x2, Pudding x2"
  655.     elseif e == 0x172 then
  656.         group = "Juclyote x2, MoonCell x2, Grenade x1"
  657.     elseif e == 0x173 then
  658.         group = "Procyote x1, Juclyote x2"
  659.     elseif e == 0x174 then
  660.         group = "Procyote x1, Pudding x2"
  661.     elseif e == 0x175 then
  662.         group = "Juclyote x1, Procyote x2"
  663.     elseif e == 0x176 then
  664.         group = "Red Worm x1, Procyote x1, Juclyote x1"
  665.     elseif e == 0x177 then
  666.         group = "Red Worm x2"
  667.     elseif e == 0x178 then
  668.         group = "H.Ito"
  669.     elseif e == 0x179 then
  670.         group = "K.Higuchi"
  671.     elseif e == 0x17A then
  672.         group = "K.Aoki"
  673.     elseif e == 0x17B then
  674.         group = "A.Matsui"
  675.     elseif e == 0x17C then
  676.         group = "K.Yoshii"
  677.     elseif e == 0x17D then
  678.         group = "H.Nakada"
  679.     elseif e == 0x17E then
  680.         group = "Takahashi"
  681.     elseif e == 0x180 then
  682.         group = "Warlock x1"
  683.     elseif e == 0x181 then
  684.         group = "Warlock x1, Kary x1"
  685.     elseif e == 0x182 then
  686.         group = "Warlock x1, Kary x2"
  687.     elseif e == 0x183 then
  688.         group = "RedGiant x1"
  689.     elseif e == 0x184 then
  690.         group = "Warlock x1, Kary x1, RedGiant x1"
  691.     elseif e == 0x185 then
  692.         group = "RedGiant x2"
  693.     elseif e == 0x186 then
  694.         group = "Warlock x2, RedGiant x1"
  695.     elseif e == 0x187 then
  696.         group = "Dragon Bone x1"
  697.     elseif e == 0x188 then
  698.         group = "Ging-Ryu x1"
  699.     elseif e == 0x189 then
  700.         group = "Dragon Bone x1, Warlock x1"
  701.     elseif e == 0x18A then
  702.         group = "King-Ryu x2"
  703.     elseif e == 0x18B then
  704.         group = "Warlock x3"
  705.     elseif e == 0x18C then
  706.         group = "Blue Dragon x1"
  707.     elseif e == 0x18D then
  708.         group = "FatalEye x1"
  709.     elseif e == 0x18E then
  710.         group = "Blue Dragon x2"
  711.     elseif e == 0x18F then
  712.         group = "Ging-Ryu x1, RedGiant x1"
  713.     elseif e == 0x190 then
  714.         group = "FatalEye x2"
  715.     elseif e == 0x191 then
  716.         group = "D.Fossil x1"
  717.     elseif e == 0x192 then
  718.         group = "King-Ryu x1"
  719.     elseif e == 0x193 then
  720.         group = "King-Ryu x1, Ging-Ryu x1"
  721.     elseif e == 0x194 then
  722.         group = "Tricker x1"
  723.     elseif e == 0x195 then
  724.         group = "Tricker x1"
  725.     elseif e == 0x196 then
  726.         group = "PinkPuff x5"
  727.     elseif e == 0x197 then
  728.         group = "EvilMask x1"
  729.     elseif e == 0x199 then
  730.         group = "Red D. x1"
  731.     elseif e == 0x19A then
  732.         group = "Red D. x2"
  733.     elseif e == 0x19B then
  734.         group = "Red D. x1, Behemoth x1"
  735.     elseif e == 0x19C then
  736.         group = "EvilMask x1"
  737.     elseif e == 0x19D then
  738.         group = "Behemoth x2"
  739.     elseif e == 0x19E then
  740.         group = "EvilMask x2"
  741.     elseif e == 0x19F then
  742.         group = "Red D. x3"
  743.     elseif e == 0x1A1 then
  744.         group = "Breath x1"
  745.     elseif e == 0x1A2 then
  746.         group = "Mind x1"
  747.     elseif e == 0x1A3 then
  748.         group = "Behemoth x1"
  749.     elseif e == 0x1BB then
  750.         group = "Pudding x4"
  751.     elseif e == 0x1BC then
  752.         group = "Pudding x2, Grenade x2"
  753.     elseif e == 0x1BD then
  754.         group = "Balloon x2, Grenade x2"
  755.     elseif e == 0x1BE then
  756.         group = "Slime x1, Tofu x1, Pudding x1"
  757.     elseif e == 0x1BF then
  758.         group = "Red Worm x1, Grenade x3"
  759.     elseif e == 0x1D8 then
  760.         group = "TrapRose x1, GlomWing x2, Crawler x2"
  761.     elseif e == 0x1D9 then
  762.         group = "Medusa x1, Gorgon x1, Stoneman x1"
  763.     elseif e == 0x1DA then
  764.         group = "Talantla x1, BlackCat x2"
  765.     elseif e == 0x1DB then
  766.         group = "Egg(BlackLiz x1)"
  767.     elseif e == 0x1DC then
  768.         group = "Egg(Lamia x1)"
  769.     elseif e == 0x1DD then
  770.         group = "Egg(HugeNaga x1)"
  771.     elseif e == 0x1DE then
  772.         group = "Egg(Green Dragon x1)"
  773.     elseif e == 0x1DF then
  774.         group = "Egg(Yellow Dragon x1)"
  775.     else
  776.         group = "Unknown"
  777.     end
  778.    
  779.     return group
  780.    
  781. end
  782.  
  783.  
  784.  
  785. local function ecords_y(x)
  786.     local ex = bit.lshift(bit.band(x,0x0F),3) +0x0C - 0x16
  787.     return ex
  788. end
  789.  
  790. local function ecords_x(y)
  791.     local ey = bit.rshift(bit.band(y,0xF0),1) + 8 + 0x10
  792.     return ey
  793.  end
  794.  
  795.  local function rndbattle()
  796.  
  797.     local steps = 0
  798.     local encounter = false
  799.     local val1 = 0
  800.     local val2 = 0
  801.     local val3 = 0
  802.     local val4 = 0
  803.     local val5 = 0
  804.     local rollover = false
  805.     local area = memory.readbyte(0x7E1700)
  806.    
  807.     if area == 0 then
  808.         -- Earth world map
  809.         while encounter == false do
  810.        
  811.             steps = steps +1
  812.            
  813.             val1 = bit.band(bit.rshift(memory.readbyte (0x7E1707),2),0xF8)
  814.             val2 = bit.rshift(memory.readbyte(0x7E1706),5) + val1
  815.             val3 = memory.readbyte(0x0EC300 + val2)
  816.             val4 = memory.readbyte(0x14EE00+((memory.readbyte(0x7E0686)+steps)) % 0x100)
  817.            
  818.             if (memory.readbyte(0x7E0686) + steps) % 0x100 == 0
  819.                 then rollover = true
  820.             end
  821.            
  822.             if rollover == true then
  823.                 val5 = (val4 + (memory.readbyte(0x7E17EF)) + 0x11) % 0x100
  824.             else
  825.                 val5 = (val4 + memory.readbyte(0x7E17EF)) % 0x100
  826.             end
  827.            
  828.             if val5 < val3 then
  829.                 gui.text(145,3,"(Earth world map)",0x0000FFFF)
  830.                 encounter = true
  831.             end
  832.            
  833.             if steps > 500 then
  834.                 encounter = true
  835.                 steps = 0
  836.                 gui.text(145,3,"(No Encounters)",0x0000FFFF)
  837.             end
  838.            
  839.         end
  840.        
  841.     elseif area == 1 then
  842.     -- Underground
  843.    
  844.             while encounter == false do
  845.        
  846.             steps = steps +1
  847.                
  848.             val1 = (memory.readbyte(0x7E0686) + steps) % 0x100
  849.             val2 = memory.readbyte(0x14EE00 + val1)
  850.            
  851.             if val1 == 0 then
  852.                 rollover =  true
  853.             end
  854.            
  855.             if rollover == true then
  856.                 val3 = val2 + ((memory.readbyte (0x7E17EF)+0x11) % 0x100)
  857.             else
  858.                 val3 = val2 + memory.readbyte (0x7E17EF)
  859.             end
  860.            
  861.             val3 = val3 % 0x100
  862.             val4 = memory.readbyte(0x0EC340)
  863.            
  864.             if val3 < val4 then
  865.                 gui.text(145,3,"(Underworld world map)",0x0000FFFF)
  866.                 encounter = true
  867.             end
  868.            
  869.             if steps > 500 then
  870.                 encounter = true
  871.                 gui.text(145,3,"(No Encounters)",0x0000FFFF)
  872.                 steps = 0
  873.             end
  874.            
  875.                        
  876.         end
  877.        
  878.     elseif area == 2 then
  879.     -- Moon
  880.         while encounter == false do
  881.        
  882.             steps = steps +1
  883.                    
  884.             val1 = (memory.readbyte(0x7E0686) + steps) % 0x100
  885.             val2 = memory.readbyte(0x14EE00 + val1)
  886.            
  887.             if val1 == 0 then
  888.                 rollover = true
  889.             end
  890.            
  891.             if rollover == true then
  892.                 val3 = val2 + ((memory.readbyte(0x7E17EF) + 0x11)%0x100)
  893.             else
  894.                 val3 = val2 + memory.readbyte (0x7E17EF)
  895.             end
  896.            
  897.             val3 = val3 % 0x100
  898.             val4 = memory.readbyte(0x0EC341)
  899.            
  900.             if val3 < val4 then
  901.                 gui.text(145,3,"(Moon world map)",0x0000FFFF)
  902.                 encounter = true
  903.             end
  904.            
  905.             if steps > 500 then
  906.                 encounter = true
  907.                 gui.text(145,3,"(No Encounters)",0x0000FFFF)
  908.                 steps = 0
  909.             end
  910.            
  911.                        
  912.         end
  913.        
  914.     elseif area > 2 then
  915.     -- Dungeon
  916.    
  917.         while encounter == false do
  918.        
  919.             steps = steps +1
  920.                        
  921.             val1 = memory.readbyte(0x7E1702)
  922.            
  923.             if memory.readbyte(0x7E1701) > 0 then
  924.                 val1 = val1 + 0x100
  925.             end
  926.            
  927.             val2 = memory.readbyte(0x0EC342+ val1)
  928.             val3 = memory.readbyte(0x7E0686) + steps
  929.             val3 = val3 % 0x100
  930.             val4 = memory.readbyte(0x14EE00 + val3)
  931.            
  932.             if val3 == 0 then
  933.                 rollover = true
  934.             end
  935.            
  936.             if rollover == true then
  937.                 val5 = val4 + ((memory.readbyte(0x7E17EF) + 0x11) % 0x100)
  938.             else
  939.                 val5 = val4 + memory.readbyte(0x7E17EF)
  940.             end
  941.            
  942.             val5 = val5 % 0x100
  943.            
  944.             if val5 < val2 then
  945.                 gui.text(145,3,"(Dungeon)",0x0000FFFF)
  946.                 encounter = true
  947.             end
  948.            
  949.             if steps > 500 then
  950.                 encounter = true
  951.                 gui.text(145,3,"(No Encounters)",0x0000FFFF)
  952.                 steps = 0
  953.             end
  954.            
  955.         end
  956.        
  957.     end
  958.    
  959.     return steps
  960.    
  961. end
  962.  
  963. local function enemygroup(num)
  964.  
  965.     local area = memory.readbyte(0x7E1700)
  966.     local group = nil
  967.     local x = 0
  968.     local x2 = 0
  969.     local val1 = 0
  970.     local val2 = 0
  971.     local val3 = 0
  972.     local rollover = false
  973.     local rollover2 = false
  974.     local i = 0
  975.    
  976.     if area == 0 then
  977.     -- Earth world map
  978.         for i=0, num do
  979.        
  980.             val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),2), 0xF8)
  981.             x = (bit.rshift(memory.readbyte(0x7E1706),5) + val1)  % 0x100
  982.             val2 = bit.lshift(memory.readbyte(0x0ec542+x),3)
  983.             x2 = (memory.readbyte(0x7E0687) + i) % 0x100
  984.            
  985.             if (memory.readbyte(0x7E0687) + i) % 0x100 == 0xFF then
  986.                 rollover = true
  987.             end
  988.            
  989.             if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then
  990.                 val3 = memory.readbyte(0x7E17EE) +0x11
  991.             elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then
  992.                 val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11)  % 0x100)
  993.             elseif rollover == false then
  994.                 val3 = memory.readbyte(0x14EE00 + x2) + memory.readbyte(0x7E17EE)
  995.             end
  996.            
  997.             val3 = val3 % 0x100
  998.             --val3 = (memory.readbyte(0x14ee00+x2) + memory.readbyte(0x7E17EE)) % 0x100
  999.            
  1000.             if val3 > 0xFC  then
  1001.                 val2 = val2 + 7
  1002.             elseif val3 > 0xEC then
  1003.                 val2 = val2 + 6
  1004.             elseif val3 > 0xCC then
  1005.                 val2 = val2 + 5
  1006.             elseif val3 > 0xAC then
  1007.                 val2 = val2 + 4
  1008.             elseif val3 > 0x81 then
  1009.                 val2 = val2 + 3
  1010.             elseif val3 > 0x56 then
  1011.                 val2 = val2 + 2
  1012.             elseif val3 > 0x2B then
  1013.                 val2 = val2 + 1
  1014.             end
  1015.            
  1016.             val2 = memory.readbyte(0xEC796+val2)
  1017.            
  1018.             if memory.readbyte(0x7E1701)  > 0 then
  1019.                 val2 = val2 + 0x100
  1020.             end
  1021.            
  1022.             group = val2
  1023.            
  1024.         end
  1025.    
  1026.     elseif area == 1 then
  1027.         -- Underground world map
  1028.        
  1029.         for i=0, num do
  1030.        
  1031.             val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),3),0xFC)
  1032.             x = bit.rshift(memory.readbyte(0x7E1706),5)
  1033.             x = (x + val1)  % 0x100
  1034.             val2 = bit.lshift(memory.readbyte(0x0ec582+x),3)
  1035.             x2 = (memory.readbyte(0x7E0687) + i)  % 0x100
  1036.            
  1037.             if memory.readbyte(0x7E0687) == 0xFF then
  1038.                 rollover = true
  1039.             end
  1040.            
  1041.             if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then
  1042.                 val3 = memory.readbyte(0x7E17EE) +0x11
  1043.             elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then
  1044.                 val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11)  % 0x100)
  1045.             elseif rollover == false then
  1046.                 val3 = memory.readbyte(0x14EE00 + x2) + memory.readbyte(0x7E17EE)
  1047.             end
  1048.            
  1049.             val3 = val3 % 0x100
  1050.            
  1051.             if val3 > 0xFC  then
  1052.                 val2 = val2 + 7
  1053.             elseif val3 > 0xEC then
  1054.                 val2 = val2 + 6
  1055.             elseif val3 > 0xCC then
  1056.                 val2 = val2 + 5
  1057.             elseif val3 > 0xAC then
  1058.                 val2 = val2 + 4
  1059.             elseif val3 > 0x81 then
  1060.                 val2 = val2 + 3
  1061.             elseif val3 > 0x56 then
  1062.                 val2 = val2 + 2
  1063.             elseif val3 > 0x2B then
  1064.                 val2 = val2 + 1
  1065.             end
  1066.            
  1067.             val2 = memory.readbyte(0xEC796+val2)
  1068.            
  1069.             if memory.readbyte(0x7E1701) > 0 then
  1070.                 val2 = val2 + 0x100
  1071.             end
  1072.            
  1073.             group = val2
  1074.            
  1075.         end
  1076.        
  1077.     elseif area == 2 then
  1078.     --Moon world map
  1079.         for i = 0, num do
  1080.        
  1081.             if memory.readbyte(0x7E1707) > 0x20 then
  1082.                 x = 2
  1083.             end
  1084.            
  1085.             if memory.readbyte(0x7E1706) > 0x20 then
  1086.                 x = x + 1
  1087.             end
  1088.            
  1089.             if (memory.readbyte(0x7E0687) + i) %0x100 == 0xFF then
  1090.                 rollover = true
  1091.             end
  1092.            
  1093.             val2 = memory.readbyte(0x0EC592 + x)
  1094.             val2 = bit.lshift(val2,3)
  1095.             x2 = (memory.readbyte(0x7E0687) + i) % 0x100
  1096.            
  1097.             if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then
  1098.                 val3 = memory.readbyte(0x7E17EE) +0x11
  1099.             elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then
  1100.                 val3 = memory.readbyte(0x14EE00 + x2) + ((memory.readbyte(0x7E17EE) + 0x11)  % 0x100)
  1101.             elseif rollover == false then
  1102.                 val3 = memory.readbyte(0x14EE00 + x2)+ memory.readbyte(0x7E17EE)
  1103.             end
  1104.            
  1105.             val3 = val3 % 0x100
  1106.            
  1107.             if val3 > 0xFC  then
  1108.                 val2 = val2 + 7
  1109.             elseif val3 > 0xEC then
  1110.                 val2 = val2 + 6
  1111.             elseif val3 > 0xCC then
  1112.                 val2 = val2 + 5
  1113.             elseif val3 > 0xAC then
  1114.                 val2 = val2 + 4
  1115.             elseif val3 > 0x81 then
  1116.                 val2 = val2 + 3
  1117.             elseif val3 > 0x56 then
  1118.                 val2 = val2 + 2
  1119.             elseif val3 > 0x2B then
  1120.                 val2 = val2 + 1
  1121.             end
  1122.            
  1123.             val2 = memory.readbyte(0x0EC796+val2)
  1124.            
  1125.             if memory.readbyte(0x7E1701) > 0 then
  1126.                 val2 = val2 + 0x100
  1127.             end
  1128.            
  1129.             group = val2       
  1130.            
  1131.         end
  1132.        
  1133.     elseif area > 2 then
  1134.    
  1135.         for i=0, num do
  1136.         --Dungeon
  1137.             val1 = memory.readbyte(0x7E1702)
  1138.            
  1139.             if memory.readbyte(0x7E1701) > 0 then
  1140.                 val1 = val1 + 0x100
  1141.             end
  1142.            
  1143.             val2 = bit.lshift(memory.readbyte(0x0EC596+val1),3)
  1144.             val3 = memory.readbyte(0x14EE00 + ((memory.readbyte(0x7E0687)+i)%0x100))   
  1145.            
  1146.             if memory.readbyte(0x7E0687) == 0xFF then
  1147.                 rollover = true
  1148.             end
  1149.            
  1150.             if rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) == 0xFF then
  1151.                 val3 = (memory.readbyte(0x7E17EE)+0x11) % 0x100
  1152.             elseif rollover == true and ((memory.readbyte(0x7E0687)+i)%0x100) ~= 0xFF then
  1153.                     val3 = val3 + ((memory.readbyte(0x7E17EE) + 0x11) % 0x100)
  1154.             elseif rollover == false then
  1155.                 val3 = val3 + memory.readbyte(0x7E17EE)
  1156.             end
  1157.            
  1158.             val3 = val3 % 0x100
  1159.            
  1160.             if val3 > 0xFC  then
  1161.                 val2 = val2 + 7
  1162.             elseif val3 > 0xEC then
  1163.                 val2 = val2 + 6
  1164.             elseif val3 > 0xCC then
  1165.                 val2 = val2 + 5
  1166.             elseif val3 > 0xAC then
  1167.                 val2 = val2 + 4
  1168.             elseif val3 > 0x81 then
  1169.                 val2 = val2 + 3
  1170.             elseif val3 > 0x56 then
  1171.                 val2 = val2 + 2
  1172.             elseif val3 > 0x2B then
  1173.                 val2 = val2 + 1
  1174.             end
  1175.            
  1176.             val4 = memory.readbyte(0x0EC816 + val2)
  1177.            
  1178.             if memory.readbyte(0x7E1701) > 0 then
  1179.                 val4 = val4 + 0x100
  1180.             end
  1181.            
  1182.             group = val4
  1183.            
  1184.         end
  1185.        
  1186.     end
  1187.    
  1188.     return group
  1189.    
  1190. end
  1191.  
  1192.  local function predictgroup()
  1193.     gui.text(3,13,"Encounter Groups:",0xABFF93FF)
  1194.     for i = 0, groupmax-1 do
  1195.         if i == 0 then
  1196.             gui.text(3,23,"1: " .. retrievegroup(enemygroup(i)) .. " (0x" .. string.format("%X",enemygroup(i)) .. ")",0xABFF93FF)
  1197.         else
  1198.             gui.text(3,23+(10 * i),i+1 .. ": " .. retrievegroup(enemygroup(i)) .. " (0x" .. string.format("%X",enemygroup(i)) .. ")",0xFFFFFF7F)
  1199.         end
  1200.     end
  1201.  end
  1202.  
  1203.  local function findenemy(e,x)
  1204.  
  1205.     local c = 0
  1206.     local i = 0
  1207.     local result  = ": "
  1208.    
  1209.     while c ~= x  do
  1210.        
  1211.         if enemygroup(i) == e then
  1212.             c = c +1
  1213.        
  1214.             if c ~= x then
  1215.                 result = result .. i .. ","
  1216.             else
  1217.                 result = result .. i
  1218.             end
  1219.            
  1220.         end
  1221.        
  1222.         i = i + 1
  1223.        
  1224.         if i >= 500 and c == 0 then
  1225.             result = "(Enemy not present)"
  1226.             c = x
  1227.         end
  1228.     end
  1229.  
  1230.     result = retrievegroup(e) .. " (" .. string.format("%X",e) .. ")" .. result
  1231.     return result
  1232.    
  1233.  end
  1234.  
  1235.     local function drawatb_e(x,y,z,c)
  1236.    
  1237.      gui.box(x-3,y-4,x+17,y-1,0x00000000,0x000000FF)
  1238.      
  1239.      if z == 0 then
  1240.         if c == 1 then
  1241.             e1_atbm = 0
  1242.         elseif c == 2 then
  1243.             e2_atbm = 0
  1244.         elseif c == 3 then
  1245.             e3_atbm = 0
  1246.         elseif c == 4 then
  1247.             e4_atbm = 0
  1248.         elseif c == 5 then
  1249.             e5_atbm = 0
  1250.         elseif c == 6 then
  1251.             e6_atbm = 0
  1252.         elseif c == 7 then
  1253.             e7_atbm = 0
  1254.         elseif c == 8 then
  1255.             e8_atbm = 0
  1256.         end    
  1257.     gui.box(x-3,y-4,x+17,y-1,0xFF0000C0,0000000000)
  1258.     else
  1259.         if c == 1 then
  1260.             if e1_atbm == 0 then
  1261.                 e1_atbm = z
  1262.             end
  1263.             gui.box(x-3,y-4,(x-3)+20-((20/e1_atbm)*z),y-1,0xFF0000C0,0000000000)
  1264.             --gui.text(x,y, e1_atb .. "/" .. e1_atbm)
  1265.         elseif c == 2 then
  1266.             if e2_atbm == 0 then
  1267.                 e2_atbm = z
  1268.             end
  1269.             gui.box(x-3,y-4,(x-3)+20-((20/e2_atbm)*z),y-1,0xFF0000C0,0000000000)
  1270.             --gui.text(x,y, e2_atb .. "/" .. e2_atbm)
  1271.         elseif c == 3 then
  1272.             if e3_atbm == 0 then
  1273.                 e3_atbm = z
  1274.             end
  1275.             gui.box(x-3,y-4,(x-3)+20-((20/e3_atbm)*z),y-1,0xFF0000C0,0000000000)
  1276.             --gui.text(x,y, e3_atb .. "/" .. e3_atbm)
  1277.         elseif c == 4 then
  1278.             if e4_atbm == 0 then
  1279.                 e4_atbm = z
  1280.             end
  1281.             gui.box(x-3,y-4,(x-3)+20-((20/e4_atbm)*z),y-1,0xFF0000C0,0000000000)
  1282.             --gui.text(x,y, e4_atb .. "/" .. e4_atbm)
  1283.         elseif c == 5 then
  1284.             if e5_atbm == 0 then
  1285.                 e5_atbm = z
  1286.             end
  1287.             gui.box(x-3,y-4,(x-3)+20-((20/e5_atbm)*z),y-1,0xFF0000C0,0000000000)
  1288.             --gui.text(x,y, e5_atb .. "/" .. e5_atbm)
  1289.         elseif c == 6 then
  1290.             if e6_atbm == 0 then
  1291.                 e6_atbm = z
  1292.             end
  1293.             gui.box(x-3,y-4,(x-3)+20-((20/e6_atbm)*z),y-1,0xFF0000C0,0000000000)
  1294.             --gui.text(x,y, e6_atb .. "/" .. e6_atbm)
  1295.         elseif c == 7 then
  1296.             if e7_atbm == 0 then
  1297.                 e7_atbm = z
  1298.             end
  1299.             gui.box(x-3,y-4,(x-3)+20-((20/e7_atbm)*z),y-1,0xFF0000C0,0000000000)
  1300.             --gui.text(x,y, e7_atb .. "/" .. e7_atbm)
  1301.         elseif c == 8 then
  1302.             if e8_atbm == 0 then
  1303.                 e8_atbm = z
  1304.             end
  1305.             gui.box(x-3,y-4,(x-3)+20-((20/e8_atbm)*z),y-1,0xFF0000C0,0000000000)
  1306.             --gui.text(x,y, e8_atb .. "/" .. e8_atbm)
  1307.         end
  1308.     end
  1309. end
  1310.  
  1311.     local function drawatb_c(x,y,z,c)
  1312.      gui.box(x-3,y-4,x+17,y-1,0x00000000,0x000000FF)
  1313.      
  1314.     if z == 0 then
  1315.         if c == 1 then
  1316.             c1_atbm = 0
  1317.         elseif c == 2 then
  1318.             c2_atbm = 0
  1319.         elseif c == 3 then
  1320.             c3_atbm = 0
  1321.         elseif c == 4 then
  1322.             c4_atbm = 0
  1323.         elseif c == 5 then
  1324.             c5_atbm = 0
  1325.         end
  1326.     gui.box(x-3,y-4,x+17,y-1,0xFFFF00C0,0000000000)
  1327.     else
  1328.         if c == 1 then
  1329.             if c1_atbm == 0 then
  1330.                 c1_atbm = z
  1331.             end
  1332.             gui.box(x-3,y-4,(x-3)+20-((20/c1_atbm)*z),y-1,0xFFFF00C0,0000000000)
  1333.             --gui.text(x,y, c1_atb .. "/" .. c1_atbm)
  1334.         elseif c == 2 then
  1335.             if c2_atbm == 0 then
  1336.                 c2_atbm = z
  1337.             end
  1338.             gui.box(x-3,y-4,(x-3)+20-((20/c2_atbm)*z),y-1,0xFFFF00C0,0000000000)
  1339.             --gui.text(x,y, c2_atb .. "/" .. c2_atbm)
  1340.         elseif c == 3 then
  1341.             if c3_atbm == 0 then
  1342.                 c3_atbm = z
  1343.             end
  1344.             gui.box(x-3,y-4,(x-3)+20-((20/c3_atbm)*z),y-1,0xFFFF00C0,0000000000)
  1345.             --gui.text(x,y, c3_atb .. "/" .. c3_atbm)
  1346.         elseif c == 4 then
  1347.             if c4_atbm == 0 then
  1348.                 c4_atbm = z
  1349.             end
  1350.             gui.box(x-3,y-4,(x-3)+20-((20/c4_atbm)*z),y-1,0xFFFF00C0,0000000000)
  1351.             --gui.text(x,y, c4_atb .. "/" .. c4_atbm)
  1352.         elseif c == 5 then
  1353.             if c5_atbm == 0 then
  1354.                 c5_atbm = z
  1355.             end
  1356.             gui.box(x-3,y-4,(x-3)+20-((20/c5_atbm)*z),y-1,0xFFFF00C0,0000000000)
  1357.             --gui.text(x,y, c5_atb .. "/" .. c5_atbm)
  1358.         end
  1359.     end
  1360. end
  1361.  
  1362. while true do
  1363.  
  1364. c1_atb = memory.readbyte(0x7E2A1C)
  1365. c2_atb = memory.readbyte(0x7E2A46)
  1366. c3_atb = memory.readbyte(0x7E2A07)
  1367. c4_atb = memory.readbyte(0x7E2A5B)
  1368. c5_atb = memory.readbyte(0x7E2A31)
  1369.  
  1370. e1_atb = memory.readbyte(0x7E2A70)
  1371. e2_atb = memory.readbyte(0x7E2A85)
  1372. e3_atb = memory.readbyte(0x7E2A9A)
  1373. e4_atb = memory.readbyte(0x7E2AAF)
  1374. e5_atb = memory.readbyte(0x7E2AC4)
  1375. e6_atb = memory.readbyte(0x7E2AD9)
  1376. e7_atb = memory.readbyte(0x7E2AEE)
  1377. e8_atb = memory.readbyte(0x7E2B03)
  1378.  
  1379. c1_x = memory.readbyte(0x7EEFD5)
  1380. c1_y = memory.readbyte(0x7EEFD6)
  1381. c2_x = memory.readbyte(0x7EEFF5)
  1382. c2_y = memory.readbyte(0x7EEFF6)
  1383. c3_x = memory.readbyte(0x7EEFC5)
  1384. c3_y = memory.readbyte(0x7EEFC6)
  1385. c4_x = memory.readbyte(0x7EF005)
  1386. c4_y = memory.readbyte(0x7EF006)
  1387. c5_x = memory.readbyte(0x7EEFE5)
  1388. c5_y = memory.readbyte(0x7EEFE6)   
  1389.  
  1390. e1_xy = memory.readbyte(0x7E29A5)
  1391. e2_xy = memory.readbyte(0x7E29A6)
  1392. e3_xy = memory.readbyte(0x7E29A7)
  1393. e4_xy = memory.readbyte(0x7E29A8)
  1394. e5_xy = memory.readbyte(0x7E29A9)
  1395. e6_xy = memory.readbyte(0x7E29AA)
  1396. e7_xy = memory.readbyte(0x7E29AB)
  1397. e8_xy = memory.readbyte(0x7E29AC)
  1398.  
  1399. e1_life = memory.readword(0x7E2287)
  1400. e1_lifem = memory.readword(0x7E2287+2)
  1401. e2_life = memory.readword(0x7E2307)
  1402. e2_lifem = memory.readword(0x7E2307+2)
  1403. e3_life = memory.readword(0x7E2387)
  1404. e3_lifem = memory.readword(0x7E2387+2)
  1405. e4_life = memory.readword(0x7E2407)
  1406. e4_lifem = memory.readword(0x7E2407+2)
  1407. e5_life = memory.readword(0x7E2487)
  1408. e5_lifem = memory.readword(0x7E2487+2)
  1409. e6_life = memory.readword(0x7E2507)
  1410. e6_lifem = memory.readword(0x7E2507+2)
  1411. e7_life = memory.readword(0x7E2587)
  1412. e7_lifem = memory.readword(0x7E2587+2)
  1413. e8_life = memory.readword(0x7E2607)
  1414. e8_lifem = memory.readword(0x7E2607+2)
  1415.  
  1416.  
  1417. battle = memory.readbyte(0x7E0201)
  1418. attack = memory.readbyte(0x7E3581) -- nromal 00, back 08
  1419.  
  1420. if battle ~= 0x85 then
  1421.  
  1422.     drawatb_c(c1_x,c1_y,c1_atb,1)
  1423.     drawatb_c(c2_x,c2_y,c2_atb,2)
  1424.     drawatb_c(c3_x,c3_y,c3_atb,3)
  1425.     drawatb_c(c4_x,c4_y,c4_atb,4)
  1426.     drawatb_c(c5_x,c5_y,c5_atb,5)
  1427.    
  1428.     if e1_life > 0 then
  1429.     gui.text(ecords_x(e1_xy),ecords_y(e1_xy),"1 " .. e1_life .. "/" .. e1_lifem )
  1430.     drawatb_e(ecords_x(e1_xy),ecords_y(e1_xy),e1_atb,1)
  1431.     end
  1432.     if e2_life > 0 then
  1433.     gui.text(ecords_x(e2_xy),ecords_y(e2_xy),"2 " .. e2_life .. "/" .. e2_lifem)
  1434.     drawatb_e(ecords_x(e2_xy),ecords_y(e2_xy),e2_atb,2)
  1435.     end
  1436.     if e3_life > 0 then
  1437.     gui.text(ecords_x(e3_xy),ecords_y(e3_xy),"3 " .. e3_life .. "/" .. e3_lifem)
  1438.     drawatb_e(ecords_x(e3_xy),ecords_y(e3_xy),e3_atb,3)
  1439.     end
  1440.     if e4_life > 0 then
  1441.     gui.text(ecords_x(e4_xy),ecords_y(e4_xy),"4 " .. e4_life .. "/" .. e4_lifem)
  1442.     drawatb_e(ecords_x(e4_xy),ecords_y(e4_xy),e4_atb,4)
  1443.     end
  1444.     if e5_life > 0 then
  1445.     gui.text(ecords_x(e5_xy),ecords_y(e5_xy),"5 " .. e5_life .. "/" .. e5_lifem)
  1446.     drawatb_e(ecords_x(e5_xy),ecords_y(e5_xy),e5_atb,5)
  1447.     end
  1448.     if e6_life > 0 then
  1449.     gui.text(ecords_x(e6_xy),ecords_y(e6_xy),"6 " .. e6_life .. "/" .. e6_lifem)
  1450.     drawatb_e(ecords_x(e6_xy),ecords_y(e6_xy),e6_atb,6)
  1451.     end
  1452.     if e7_life > 0 then
  1453.     gui.text(ecords_x(e7_xy),ecords_y(e7_xy),"7 " .. e7_life .. "/" .. e7_lifem)
  1454.     drawatb_e(ecords_x(e7_xy),ecords_y(e7_xy),e7_atb,7)
  1455.     end
  1456.     if e8_life > 0 then
  1457.     gui.text(ecords_x(e8_xy),ecords_y(e8_xy),"8 " .. e8_life .. "/" .. e8_lifem)
  1458.     drawatb_e(ecords_x(e8_xy),ecords_y(e8_xy),e8_atb,8)
  1459.     end
  1460.    
  1461.     else
  1462.     c1_atbm = 0
  1463.     c2_atbm = 0
  1464.     c3_atbm = 0
  1465.     c4_atbm = 0
  1466.     c5_atbm = 0
  1467.    
  1468.     e1_atbm = 0
  1469.     e2_atbm = 0
  1470.     e3_atbm = 0
  1471.     e4_atbm = 0
  1472.     e5_atbm = 0
  1473.     e6_atbm = 0
  1474.     e7_atbm = 0
  1475.     e8_atbm = 0
  1476.    
  1477.     gui.text(3,3,"Steps until random battle: ")
  1478.     gui.text(111,3,rndbattle(),0xFFFF00FF)
  1479.     gui.text(125,3,"("..string.format("%X",memory.readbyte(0x7E0686)) .. ")")
  1480.        
  1481.         if rndbattle() ~= 0 then
  1482.             predictgroup()
  1483.         end
  1484.     -- 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
  1485.     -- format is findenemy(ENEMY VALUE,NEXT NUMBER OF ENCOUNTERS)
  1486.     -- I.E. findenemy(0x196,5) will look for the next 5 pink puff encounters
  1487.     --gui.text(5,100,findenemy(0x196,2))
  1488. end
  1489.  
  1490. snes9x.frameadvance()
  1491.  
  1492. end
  1493.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement