Advertisement
Guest User

Bubble Ghost luascript bizhawk 1.11.6 tas

a guest
Aug 28th, 2016
92
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 28th Aug 2016
  3. -- Bubble Ghost (U) [!].gb
  4.  
  5. memory.usememorydomain("System Bus")
  6. client.setwindowsize(2)
  7.  
  8. function text(x, y, text, col1, col2)
  9.     if col2==nil then col2=0x00000000 end
  10.     gui.pixelText(x, y, text,col1,col2)
  11. end
  12.  
  13. function box(x,y,x2,y2,col1,col2)
  14.     gui.drawBox(x,y,x2,y2,col1,col2)
  15. end
  16.  
  17. function line(x,y,x2,y2,col)
  18.     gui.drawLine(x,y,x2,y2,col)
  19. end
  20.  
  21. function pixel(x,y,col)
  22.     gui.drawPixel(x,y,col)
  23. end
  24.  
  25. function img(x,y,path)
  26.     gui.drawImage(path,x,y)
  27. end
  28.  
  29.  
  30. local drawFramecountAndInput = function(x,y)
  31.  
  32.     if movie.mode()=="PLAY" then
  33.         text(x-6, y,emu.framecount().."/"..movie.length(),0xFFFFFFFF)
  34.     else
  35.         text(x-6, y,emu.framecount(),0xFFFFFFFF)
  36.     end
  37.        
  38.     text(x-6, y+7,emu.lagcount(),0xFFF08080)
  39.  
  40.     if emu.islagged() then
  41.         text(x+8, y+7,"*",0xFFF08080)
  42.     end
  43.    
  44.     local inputtable = {}
  45.    
  46.     if movie.mode()=="INACTIVE" then
  47.         inputtable = joypad.getimmediate()
  48.     elseif movie.mode()=="PLAY" or movie.mode()=="RECORD" then
  49.         inputtable = movie.getinput(emu.framecount()-1)
  50.     end
  51.    
  52.     local buttons = {["Up"]="^", ["Down"]="v", ["Left"]="<", ["Right"]=">", ["Select"]="s", ["Start"]="S", ["A"]="A", ["B"]="B", ["L"]="L", ["R"]="R"}
  53.     local s = ""
  54.     for k,v in pairs(inputtable) do
  55.         if v==true then
  56.             s=s..buttons[k]
  57.         end
  58.     end
  59.     text(x+16,y+7,s,0xFFffffff)
  60.  
  61. end
  62.  
  63.  
  64.  
  65. event.onloadstate(function()
  66.  
  67. end)
  68.  
  69. event.onexit(function()
  70.     client.SetGameExtraPadding(0,0,0,0)
  71.     client.SetClientExtraPadding(0,0,0,0)
  72. end)
  73.  
  74. client.SetGameExtraPadding(0,26,0,0)
  75.  
  76. while true do
  77.  
  78.  
  79.     player_xpos=        memory.read_u8(0xe161)
  80.     player_ypos=        memory.read_u8(0xe162)
  81.     ball_xpos=          memory.read_u8(0xe16a)
  82.     ball_ypos=          memory.read_u8(0xe16b)
  83.     ball_speedcounter=  memory.read_u8(0xc16e)
  84.     if ball_speedcounter==0xFF then ball_speedcounter=0 end
  85.     ball_speedcounter=  20-ball_speedcounter
  86.     ball_speed=         memory.read_u8(0xc16f)
  87.     timer=              7-(memory.read_u8(0xc0f2)-1)%8
  88.  
  89.     box(-1,-1,160,26,0xFF1A1A1A,0xFF1A1A1A)
  90.     drawFramecountAndInput(14,6)
  91.    
  92.     text(52,1,"player",0xFFA0A0A0)
  93.     text(86,1,"ball",0xFFA0A0A0)
  94.     text(112,1,"speed",0xFFA0A0A0)
  95.  
  96.    
  97.     text(52,9,player_xpos,0xFFD0A020)
  98.     text(52,16,player_ypos,0xFFD0A020)
  99.     text(86,9,ball_xpos,0xFFD0A020)
  100.     text(86,16,ball_ypos,0xFFD0A020)
  101.     text(112,9,ball_speed,0xFFD0A020)
  102.     text(122,9,"("..ball_speedcounter..")",0xFFD0A020)
  103.     text(122,16,"("..timer..")",0xFFD0A020)
  104.    
  105.    
  106.     emu.frameadvance()
  107.  
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement