Advertisement
Guest User

GB The Smurfs Luascript for Bizhawk

a guest
Nov 4th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. local ScriptInfo = {"SMURFS Luascript by Mugg1991",
  2.                     "v0.1",
  3.                     "Oct 2017"}
  4.  
  5. memory.usememorydomain("System Bus")
  6.                    
  7. function text(x, y, text, color, backcolor)
  8.     if backcolor==nil then backcolor=0x00000000 end
  9.     gui.drawText(x, y, text,color,backcolor,10,"Arial")
  10. end
  11.  
  12. client.SetGameExtraPadding(80,0,0,0)
  13. console.clear()
  14. for i=1,table.getn(ScriptInfo),1 do
  15.     print(ScriptInfo[i])
  16. end
  17.  
  18. XposBefore=0
  19. nomove=0
  20.  
  21. event.onexit(function()
  22.     client.SetGameExtraPadding(0,0,0,0)
  23. end)
  24.  
  25. event.onloadstate(function()
  26.     nomove=0
  27. end)
  28.  
  29. local dirTable = {
  30.     [16] = 1,
  31.     [32] = 2,
  32.     [48] = 3
  33. }
  34.  
  35. while true do
  36.  
  37.     Xcam = memory.read_u16_le(0xFF97)
  38.     Ycam = memory.read_u16_le(0xFF99)
  39.     Xpos = memory.read_u16_le(0xFFA1)
  40.     Ypos = memory.read_u16_le(0xFFA3)
  41.     Xvelo = memory.read_u8(0xFFCB)
  42.     dir = memory.read_u8(0xFFEF)
  43.    
  44.     timerTen = memory.read_u8(0xF9CD)
  45.     timerOne = memory.read_u8(0xF9CE)
  46.     timerSub = "." .. string.format("%02d",memory.read_u8(0xF93E))
  47.     timer = string.format("%x%x",timerTen,timerOne)
  48.  
  49.     invuln = memory.read_s8(0xF9AA)
  50.     health = memory.read_s8(0xF9B6)
  51.     rng = memory.read_u8(0xFAB1)
  52.     difficulty = memory.read_u8(0xD9DB)
  53.     level = memory.read_u8(0xf9a1)
  54.    
  55.     text(18,24,"velX " .. Xvelo,0xFFFFFF00)
  56.     text(26,33,"dir " .. tostring(dirTable[dir]),0xFFFFFF00)
  57.     text(32,49,"X " .. Xpos,0xFFFFFF00)
  58.     text(32,58,"Y " .. Ypos,0xFFFFFF00)
  59.     text(12,67,"camX " .. Xcam,0xFFFFFF00)
  60.     text(12,76,"camY " .. Ycam,0xFFFFFF00)
  61.     text(8,91,"invuln " .. invuln,0xFFFFFF00)
  62.     text(8,100,"health " .. health,0xFFFFFF00)
  63.     text(18,109,"time " .. timer,0xFFFFFF00)
  64.     text(54,109,timerSub,0xFFFFFF00)
  65.     text(24,118,"rng " .. rng,0xFFFFFF00)
  66.     text(2,127,"difficulty " .. difficulty,0xFFFFFF00)
  67.  
  68.     if XposBefore ~= Xpos then
  69.         nomove=0
  70.     else
  71.         nomove=nomove+1
  72.     end
  73.    
  74.     text(8,49,nomove,0xFFFF4000)
  75.    
  76.     XposBefore = Xpos
  77.    
  78.     emu.frameadvance()
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement