Advertisement
Guest User

Untitled

a guest
Apr 11th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. -- Luascript for bizhawk 1.11.6
  2. -- by mugg1991
  3. -- Gremlins 2 The New Batch gb
  4.  
  5. function text(x, y, text, color)
  6.     gui.pixelText(x, y, text,color,0x00000000)
  7. end
  8.  
  9. ----------------------------------------------------------------------
  10. local drawFrameCountAndInput = function(x,y)
  11.  
  12.     if movie.mode()=="PLAY" then
  13.         text(x, y,emu.framecount().."/"..movie.length(),0xFFFFFFFF)
  14.     else
  15.         text(x, y,emu.framecount(),0xFFFFFFFF)
  16.     end
  17.        
  18.     text(x, y+8,emu.lagcount(),0xFFF05050)
  19.  
  20.     if emu.islagged() then
  21.         text(x-5, y+8,"*",0xFFF05050)
  22.     end
  23.    
  24.     local inputtable = {}
  25.    
  26.     if movie.mode()=="INACTIVE" then
  27.         inputtable = joypad.getimmediate()
  28.     elseif movie.mode()=="PLAY" or movie.mode()=="RECORD" then
  29.         inputtable = movie.getinput(emu.framecount()-1)
  30.     end
  31.    
  32.     local buttons = {["Up"]="^", ["Down"]="v", ["Left"]="<", ["Right"]=">", ["Select"]="s", ["Start"]="S", ["A"]="A", ["B"]="B", ["L"]="L", ["R"]="R"}
  33.     local s = ""
  34.     for k,v in pairs(inputtable) do
  35.         if v==true then
  36.             s=s..buttons[k]
  37.         end
  38.     end
  39.     text(x,y+16,s,0xFFffffff)
  40.  
  41. end
  42.  
  43. function hex(num)
  44.    local dig = 2
  45.    local hexstr = '0123456789ABCDEF'
  46.    local s = ''
  47.    --while num > 0 do
  48.    while dig > 0 do -- use digit instead so there is padding
  49.        local mod = math.fmod(num, 16)
  50.        s = string.sub(hexstr, mod+1, mod+1) .. s
  51.        num = math.floor(num / 16)
  52.        dig = dig - 1
  53.    end
  54.    if s == '' then s = '0' end
  55.    return s
  56. end
  57.  
  58. client.SetGameExtraPadding(0,28,0,0)
  59.  
  60. memory.usememorydomain("System Bus")
  61.  
  62.  
  63. while true do
  64.    
  65.     --declare values:
  66.     Xpos = memory.read_u16_be(0xff96)
  67.     Ypos = memory.read_u16_be(0xff98)
  68.     Invinc = 0x40 - memory.read_u8(0xc0cb)
  69.     if Invinc == 0x40 then Invinc = "" end
  70.     SuitcaseHitpoints = memory.read_u8(0xc0ae)
  71.     if SuitcaseHitpoints < 1 then SuitcaseHitpoints="" end
  72.     HP = memory.read_u8(0xc0c6)+1
  73.     if HP > 9 or HP < 1 then HP="Dead" end
  74.     BossHP = memory.read_u8(0xc200)
  75.     if BossHP == 0 then BossHP="" end
  76.    
  77.     --display values:  
  78.     text(43,10,"X",0x80FFFFFF) 
  79.     text(43,18,"Y",0x80FFFFFF) 
  80.     text(50,10,Xpos,0xFFFFFFFF)
  81.     text(50,18,Ypos,0xFFFFFFFF)
  82.    
  83.     text(84,10,"Inv",0x80FFFFFF)
  84.     text(100,10,Invinc,0xFFFFD040) 
  85.    
  86.     text(80,18,"Case",0x80FFFFFF)
  87.     text(100,18,SuitcaseHitpoints,0xFFFFD040)  
  88.  
  89.     text(130,10,"HP",0x80FFFFFF)
  90.     text(140,10,HP,0xFFFFFFFF)
  91.  
  92.     text(114,18,"BossHP",0x80FFFFFF)
  93.     text(140,18,BossHP,0xFFFFFFFF)
  94.    
  95.     drawFrameCountAndInput(10,2)
  96.     emu.frameadvance()
  97.  
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement