Advertisement
Kaztalek

Untitled

Jun 1st, 2015
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. --"BAnotify.lua"
  2. --For use in MM (J) on BizHawk 1.9.1
  3. --Starting Address Block 1: 0x1F35A8
  4. --Ending Address Block 1: 0x1F37B7
  5. --Starting Address Block 2: 0x1F3DA0
  6. --Ending Address Block 2: 0x1F3E37
  7.  
  8. local add = 0x1F35A8
  9. local a = {} --bytes
  10. local b = {} --frames
  11. local c = {} --messages
  12. local d = {107,113,121,127,338,339,340,341,342,343,344,349,351,353,355,357,359,369,375,396,398,399,400,406,407} --ignored frames
  13. local file = io.open("Lua/player/data/log.txt", "a")
  14.  
  15. function handle(i)
  16.     skip = 0
  17.     for j=0,table.getn(d) do
  18.         if i == d[j] then
  19.             skip = 1
  20.             break
  21.         end
  22.     end
  23.     if skip == 0 and memory.readbyte(add + i) ~= a[i] then
  24.         local message = emu.framecount() ..": Byte ".. bizstring.hex(add + i) .." changed from ".. a[i] .." to ".. memory.readbyte(add + i) .."!"
  25.         table.insert(b,emu.framecount())
  26.         table.insert(c,message)
  27.         file:write(message .."\n")
  28.         file:flush()
  29.         a[i] = memory.readbyte(add + i)
  30.     end
  31. end
  32.  
  33. for i=0, 131 do
  34.     a[i] = memory.readbyte(add+i)
  35. end
  36. for i=336,527 do
  37.     a[i] = memory.readbyte(add+i)
  38. end
  39. for i = 2040,2191 do
  40.     a[i] = memory.readbyte(add+i)
  41. end
  42.  
  43. while true do
  44.     gui.text(0,50,"Script On")
  45.     if input.get().V == true then
  46.         break
  47.     end
  48.     pic = emu.framecount()-180
  49.     bn = table.getn(b)
  50.     if bn > 0 then
  51.         gui.drawImage("Lua/player/data/knuckles.jpg",300,380)
  52.         for x=1, bn do
  53.             if b[x] and pic > b[x] then
  54.                 table.remove(b,x)
  55.                 table.remove(c,x)
  56.             else
  57.                 gui.text(0,70+20*x,c[x])
  58.             end
  59.         end
  60.     end
  61.     for i=0,131 do
  62.         handle(i)
  63.     end
  64.     for i=336,527 do
  65.         handle(i)
  66.     end
  67.     for i = 2040,2191 do
  68.         handle(i)
  69.     end
  70.     emu.frameadvance()
  71. end
  72. file:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement