Advertisement
Guest User

Untitled

a guest
Jan 24th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.02 KB | None | 0 0
  1. local table = { }
  2. lag = 0
  3.  
  4. function popcount(x)
  5.   local counter = 0
  6.   while (x > 0) do
  7.     local y = x % 2
  8.     counter = counter + y
  9.       x = (x - y ) / 2
  10.     end
  11.     return counter
  12. end
  13.  
  14. while true do
  15.  
  16. -- Speeds
  17.  
  18.   xspd = memory.readwordsigned(0x7E0BC2)
  19.   yspd = memory.readwordsigned(0x7E0BC4)
  20.   cartxspd = memory.readwordsigned(0x7E1002)
  21.   cartyspd = memory.readwordsigned(0x7E1004)
  22.   gui.text(13,199, "X Spd: " .. xspd)
  23.   gui.text(13,209, "Y Spd: " .. yspd)
  24.  
  25. -- Positions
  26.  
  27.   mmx = memory.readword(0x7E0BCA)
  28.   mmy = memory.readword(0x7E0BCC)
  29.   xsub = memory.readbyte(0x7E0BAC)
  30.   ysub = memory.readbyte(0x7E0BAF)
  31.   gui.text(180,199, "X Pos: " .. mmx)
  32.   gui.text(180,209, "Y Pos: " .. mmy)
  33.   gui.text(230,199, ": " .. xsub)
  34.   gui.text(230,209, ": " .. ysub)
  35.  
  36. -- HP
  37.  
  38.   gui.transparency(0.0)
  39.  
  40.   HP = memory.readbyte(0x7E0BCF)
  41.   if HP > 0 then
  42.     gui.text(9,98, " " .. HP, "#0xF8C000FF")
  43.   end
  44.  
  45. -- Weapon Energy
  46.  
  47.   gui.transparency(0.0)
  48.  
  49.   Weapon = memory.readbyte(0x7E0BDB)
  50.   Ammo1 = memory.readbyte(0x7E1F88)
  51.   Ammo2 = memory.readbyte(0x7E1F8A)
  52.   Ammo3 = memory.readbyte(0x7E1F8C)
  53.   Ammo4 = memory.readbyte(0x7E1F8E)
  54.   Ammo5 = memory.readbyte(0x7E1F90)
  55.   Ammo6 = memory.readbyte(0x7E1F92)
  56.   Ammo7 = memory.readbyte(0x7E1F94)
  57.   Ammo8 = memory.readbyte(0x7E1F96)
  58.   Half1 = memory.readbyte(0x7E1F87)
  59.   Half2 = memory.readbyte(0x7E1F89)
  60.   Half4 = memory.readbyte(0x7E1F8D)
  61.   Half5 = memory.readbyte(0x7E1F8F)
  62.   Half6 = memory.readbyte(0x7E1F91)
  63.   Half7 = memory.readbyte(0x7E1F93)
  64.   Half8 = memory.readbyte(0x7E1F95)
  65.  
  66.   -- Homing Torpedo
  67.  
  68.   if Weapon == 2 then
  69.     if Ammo1 < 190 then
  70.       gui.text(24,98, " " .. 2*Ammo1-129+Half1/128, "#0x88B8A0FF")
  71.       afix1 = 2*Ammo1-129+Half1/128
  72.     else
  73.       if afix1 == nil then
  74.         afix1 = 2*Ammo1-129+Half1/128
  75.       else
  76.         gui.text(24,98, " " .. afix1, "#0x88B8A0FF")
  77.       end
  78.     end
  79.  
  80.   -- Chameleon Sting
  81.  
  82.   elseif Weapon == 4 then
  83.     if Ammo2 < 190 then
  84.       gui.text(24,98, " " .. 2*Ammo2-129+Half2/128, "#0xB0F000FF")
  85.       afix2 = 2*Ammo2-129+Half2/128
  86.     else
  87.       if afix2 == nil then
  88.         afix2 = 2*Ammo2-129+Half2/128
  89.       else
  90.         gui.text(24,98, " " .. afix2, "#0xB0F000FF")
  91.       end
  92.     end
  93.  
  94.   -- Rolling Shield
  95.  
  96.   elseif Weapon == 6 then
  97.     if Ammo3 < 190 then
  98.       gui.text(24,98, " " .. Ammo3-64, "#0xF880C0FF")
  99.       afix3 = Ammo3-64
  100.     else
  101.       if afix3 == nil then
  102.         afix3 = Ammo3-64
  103.       else
  104.         gui.text(24,98, " " .. afix3, "#0xF880C0FF")
  105.       end
  106.     end
  107.  
  108.   -- Fire Wave
  109.  
  110.   elseif Weapon == 8 then
  111.     if Ammo4 < 190 then
  112.       gui.text(24,98, " " .. 16*Ammo4-1039+Half4/16, "#0xF87870FF")
  113.       afix4 = 16*Ammo4-1039+Half4/16
  114.     else
  115.       if afix4 == nil then
  116.         afix4 = 16*Ammo4-1039+Half4/16
  117.       else
  118.         gui.text(24,98, " " .. afix4, "#0xF87870FF")
  119.       end
  120.     end
  121.  
  122.   -- Storm Tornado
  123.  
  124.   elseif Weapon == 10 then
  125.     if Ammo5 < 190 then
  126.       gui.text(24,98, " " .. Ammo5-64, "#0xC8A0E8FF")
  127.       afix5 = Ammo5-64
  128.     else
  129.       if afix5 == nil then
  130.         afix5 = Ammo5-64
  131.       else
  132.         gui.text(24,98, " " .. afix5, "#0xC8A0E8FF")
  133.       end
  134.     end
  135.  
  136.   -- Electric Spark
  137.  
  138.   elseif Weapon == 12 then
  139.     if Ammo6 < 190 then
  140.       gui.text(24,98, " " .. Ammo6-64, "#0xE0F858FF")
  141.       afix6 = Ammo6-64
  142.     else
  143.       if afix6 == nil then
  144.         afix6 = Ammo6-64
  145.       else
  146.         gui.text(24,98, " " .. afix6, "#0xE0F858FF")
  147.       end
  148.     end
  149.  
  150.   -- Boomerang Cutter
  151.  
  152.   elseif Weapon == 14 then
  153.     if Ammo7 < 190 then
  154.       gui.text(24,98, " " .. Ammo7-64, "#0xA0B0C8FF")
  155.       afix7 = Ammo7-64
  156.     else
  157.       if afix7 == nil then
  158.         afix7 = Ammo7-64
  159.       else
  160.         gui.text(24,98, " " .. afix7, "#0xA0B0C8FF")
  161.       end
  162.     end
  163.  
  164.   -- Shotgun Ice
  165.  
  166.   elseif Weapon == 16 then
  167.     if Ammo8 < 190 then
  168.       gui.text(24,98, " " .. Ammo8-64, "#0x88E0D8FF")
  169.       afix8 = Ammo8-64
  170.     else
  171.       if afix8 == nil then
  172.         afix8 = Ammo8-64
  173.       else
  174.         gui.text(24,98, " " .. afix8, "#0x88E0D8FF")
  175.       end
  176.     end
  177.   end
  178.  
  179. -- Hit Box
  180.  
  181.   cx = memory.readword(0x7E00B4)
  182.   cy = memory.readword(0x7E00B6)
  183.   gui.transparency(2.0)
  184.   gui.drawbox(mmx-cx-7,mmy-cy-19,mmx-cx+7,mmy-cy+15)
  185.  
  186. -- Enemy HP
  187.  
  188.   EID = memory.readbyte(0x7E0E72)
  189.  
  190.   ex1 = memory.readword(0x7E0E8A)
  191.   ey1 = memory.readword(0x7E0E8C)
  192.   ex2 = memory.readword(0x7E0ECA)
  193.   ey2 = memory.readword(0x7E0ECC)
  194.   ex3 = memory.readword(0x7E0F0A)
  195.   ey3 = memory.readword(0x7E0F0C)
  196.   ex4 = memory.readword(0x7E0F4A)
  197.   ey4 = memory.readword(0x7E0F4C)
  198.   ex5 = memory.readword(0x7E0F8A)
  199.   ey5 = memory.readword(0x7E0F8C)
  200.   ex6 = memory.readword(0x7E0FCA)
  201.   ey6 = memory.readword(0x7E0FCC)
  202.   ex7 = memory.readword(0x7E100A)
  203.   ey7 = memory.readword(0x7E100C)
  204.   ex8 = memory.readword(0x7E104A)
  205.   ey8 = memory.readword(0x7E104C)
  206.   ex9 = memory.readword(0x7E108A)
  207.   ey9 = memory.readword(0x7E108C)
  208.   ex10 = memory.readword(0x7E10CA)
  209.   ey10 = memory.readword(0x7E10CC)
  210.   ex11 = memory.readword(0x7E110A)
  211.   ey11 = memory.readword(0x7E110C)
  212.   ex12 = memory.readword(0x7E114A)
  213.   ey12 = memory.readword(0x7E114C)
  214.  
  215.   HP1 = memory.readbyte(0x7E0E8F)
  216.   HP2 = memory.readbyte(0x7E0ECF)
  217.   HP3 = memory.readbyte(0x7E0F0F)
  218.   HP4 = memory.readbyte(0x7E0F4F)
  219.   HP5 = memory.readbyte(0x7E0F8F)
  220.   HP6 = memory.readbyte(0x7E0FCF)
  221.   HP7 = memory.readbyte(0x7E100F)
  222.   HP8 = memory.readbyte(0x7E104F)
  223.   HP9 = memory.readbyte(0x7E108F)
  224.   HP10 = memory.readbyte(0x7E10CF)
  225.   HP11 = memory.readbyte(0x7E110F)
  226.   HP12 = memory.readbyte(0x7E114F)
  227.  
  228.   if HP1 > 0 then
  229.     if HP1 < 128 then
  230.       gui.drawbox(ex1-cx-6,ey1-cy+11,ex1-cx+8,ey1-cy+24)
  231.       gui.transparency(0.5)
  232.       gui.text(ex1-cx-2, ey1-cy+15, HP1)
  233.     end
  234.   end
  235.   if HP2 > 0 then
  236.     if HP2 < 128 then
  237.       gui.transparency(2.0)
  238.       gui.drawbox(ex2-cx-6,ey2-cy+11,ex2-cx+8,ey2-cy+24)
  239.       gui.transparency(0.5)
  240.       gui.text(ex2-cx-2, ey2-cy+15, HP2)
  241.     end
  242.   end
  243.   if HP3 > 0 then
  244.     if HP3 < 128 then
  245.       gui.transparency(2.0)
  246.       gui.drawbox(ex3-cx-6,ey3-cy+11,ex3-cx+8,ey3-cy+24)
  247.       gui.transparency(0.5)
  248.       gui.text(ex3-cx-2, ey3-cy+15, HP3)
  249.     end
  250.   end
  251.   if HP4 > 0 then
  252.     if HP4 < 128 then
  253.       gui.transparency(2.0)
  254.       gui.drawbox(ex4-cx-6,ey4-cy+11,ex4-cx+8,ey4-cy+24)
  255.       gui.transparency(0.5)
  256.       gui.text(ex4-cx-2, ey4-cy+15, HP4)
  257.     end
  258.   end
  259.   if HP5 > 0 then
  260.     if HP5 < 128 then
  261.       gui.transparency(2.0)
  262.       gui.drawbox(ex5-cx-6,ey5-cy+11,ex5-cx+8,ey5-cy+24)
  263.       gui.transparency(0.5)
  264.       gui.text(ex5-cx-2, ey5-cy+15, HP5)
  265.     end
  266.   end
  267.   if HP6 > 0 then
  268.     if HP6 < 128 then
  269.       gui.transparency(2.0)
  270.       gui.drawbox(ex6-cx-6,ey6-cy+11,ex6-cx+8,ey6-cy+24)
  271.       gui.transparency(0.5)
  272.       gui.text(ex6-cx-2, ey6-cy+15, HP6)
  273.     end
  274.   end
  275.   if HP7 > 0 then
  276.     if HP7 < 128 then
  277.       gui.transparency(2.0)
  278.       gui.drawbox(ex7-cx-6,ey7-cy+11,ex7-cx+8,ey7-cy+24)
  279.       gui.transparency(0.5)
  280.       gui.text(ex7-cx-2, ey7-cy+15, HP7)
  281.     end
  282.   end
  283.   if HP8 > 0 then
  284.     if HP8 < 128 then
  285.       gui.transparency(2.0)
  286.       gui.drawbox(ex8-cx-6,ey8-cy+11,ex8-cx+8,ey8-cy+24)
  287.       gui.transparency(0.5)
  288.       gui.text(ex8-cx-2, ey8-cy+15, HP8)
  289.     end
  290.   end
  291.   if HP9 > 0 then
  292.     if HP9 < 128 then
  293.       gui.transparency(2.0)
  294.       gui.drawbox(ex9-cx-6,ey9-cy+11,ex9-cx+8,ey9-cy+24)
  295.       gui.transparency(0.5)
  296.       gui.text(ex9-cx-2, ey9-cy+15, HP9)
  297.     end
  298.   end
  299.   if HP10 > 0 then
  300.     if HP10 < 128 then
  301.       gui.transparency(2.0)
  302.       gui.drawbox(ex10-cx-6,ey10-cy+11,ex10-cx+8,ey10-cy+24)
  303.       gui.transparency(0.5)
  304.       gui.text(ex10-cx-2, ey10-cy+15, HP10)
  305.     end
  306.   end
  307.   if HP11 > 0 then
  308.     if HP11 < 128 then
  309.       gui.transparency(2.0)
  310.       gui.drawbox(ex11-cx-6,ey11-cy+11,ex11-cx+8,ey11-cy+24)
  311.       gui.transparency(0.5)
  312.       gui.text(ex11-cx-2, ey11-cy+15, HP11)
  313.     end
  314.   end
  315.   if HP12 > 0 then
  316.     if HP12 < 128 then
  317.       gui.transparency(2.0)
  318.       gui.drawbox(ex12-cx-6,ey12-cy+11,ex12-cx+8,ey12-cy+24)
  319.       gui.transparency(0.5)
  320.       gui.text(ex12-cx-2, ey12-cy+15, HP12)
  321.     end
  322.   end
  323.  
  324. -- Buster Charge
  325.  
  326.   gui.transparency(0.0)
  327.   timer = memory.readbyte(0x7E0BFF)
  328.   stype = memory.readbyte(0x7E0C03)
  329.   table = joypad.get(1)
  330.   if table.Y then
  331.     if stype == 0 then
  332.       gui.text(mmx-cx-18, mmy-cy+17, " " .. timer-151)
  333.     elseif stype == 3 then
  334.       gui.text(mmx-cx-18, mmy-cy+17, " " .. timer-80)
  335.     elseif stype == 2 then
  336.       gui.text(mmx-cx-18, mmy-cy+17, " " .. timer-2)
  337.     elseif stype == 1 then
  338.     end
  339.     if timer <= 1 then
  340.       gui.text(mmx-cx-2, mmy-cy+17, "0", "white", "#0x00E068FF")
  341.       gui.text(mmx-cx+4, mmy-cy+17, "0", "white", "#0x00A0F8FF")
  342.       gui.text(mmx-cx+10, mmy-cy+17, "0", "white", "#0xF850A8FF")
  343.     elseif timer > 1 then
  344.       if timer <= 149 then
  345.         if timer > 79 then
  346.           gui.text(mmx-cx-2, mmy-cy+17, "0", "white", "#0x00E068FF")
  347.         else
  348.           gui.text(mmx-cx-2, mmy-cy+17, "0", "white", "#0x00E068FF")
  349.           gui.text(mmx-cx+4, mmy-cy+17, "0", "white", "#0x00A0F8FF")
  350.         end
  351.       end  
  352.     end                
  353.   end
  354.  
  355. -- Lag Counter
  356.  
  357. --  gui.text(13,188, "Lag: ")
  358. --  gui.text(33,188, lag, "red")
  359.   a = math.abs(xspd+yspd)
  360.   if a > 0 then
  361.     if z == nil then
  362.       z = cx
  363.       y = cy
  364.     else
  365.       x1 = cx-z
  366.       y1 = cy-y
  367.       if x1 == 0 and y1 == 0 then
  368.         lag = lag+1
  369.         z = cx
  370.         y = cy
  371.       else
  372.         z = cx
  373.         y = cy
  374.       end
  375.     end
  376.   end
  377.  
  378. -- Upgrade Progress
  379.  
  380.   Hearts = memory.readbytesigned(0x7E1F9A)
  381.   TankPod = memory.readbytesigned(0x7E1F99)
  382.   Parts1 = popcount(memory.readbyte(0x7E1F99))*4
  383.   Parts2 = Hearts*2 - 32
  384.   if Ammo1 > 0 then
  385.     W1 = 4
  386.   else W1 = 0
  387.   end
  388.   if Ammo2 > 0 then
  389.     W2 = 4
  390.   else W2 = 0
  391.   end
  392.   if Ammo3 > 0 then
  393.     W3 = 4
  394.   else W3 = 0
  395.   end
  396.   if Ammo4 > 0 then
  397.     W4 = 4
  398.   else W4 = 0
  399.   end
  400.   if Ammo5 > 0 then
  401.     W5 = 4
  402.   else W5 = 0
  403.   end
  404.   if Ammo6 > 0 then
  405.     W6 = 4
  406.   else W6 = 0
  407.   end
  408.   if Ammo7 > 0 then
  409.     W7 = 4
  410.   else W7 = 0
  411.   end
  412.   if Ammo8 > 0 then
  413.     W8 = 4
  414.   else W8 = 0
  415.   end
  416.   Parts3 = W1+W2+W3+W4+W5+W6+W7+W8
  417.   Hadoken = memory.readbyte(0x7E1F7E)
  418.   if Hadoken == 133 then
  419.     Parts4 = 4
  420.   else Parts4 = 0
  421.   end
  422.   Parts = Parts1+Parts2+Parts3+Parts4
  423.   gui.text(150,210, Parts, "green")
  424.   if Parts == 100 then
  425.     gui.text(80,210, "UPGRADE PROGRESS:    %")
  426.   else
  427.     if Parts < 10 then
  428.       gui.text(80,210, "UPGRADE PROGRESS:  %")
  429.     elseif Parts >= 10 then
  430.       gui.text(80,210, "UPGRADE PROGRESS:   %")
  431.     end
  432.   end
  433.   gui.drawbox(79,206,161,200,"black")
  434.   gui.drawline(80,201,Parts*.8+80,201,"#0xF54646FF")
  435.   gui.drawline(80,202,Parts*.8+80,202,"#0xC10000FF")
  436.   gui.drawline(80,203,Parts*.8+80,203,"#0x9D0000FF")
  437.   gui.drawline(80,204,Parts*.8+80,204,"#0x6A0000FF")
  438.   gui.drawline(80,205,Parts*.8+80,205,"#0x4F0000FF")
  439.   gui.drawline(80,201,80,201,"#0xF54646FF")
  440.   gui.drawline(80,202,80,202,"#0xF54646FF")
  441.   gui.drawline(80,203,80,203,"#0xC10000FF")
  442.   gui.drawline(80,204,80,204,"#0x9D0000FF")
  443.   gui.drawline(80,205,80,205,"#0x6A0000FF")
  444.  
  445.   emu.frameadvance()
  446. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement