Advertisement
Cronokirby

CT rng visualiser (bizhawk 1.11) V 2.0

Aug 16th, 2016
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. while true do
  2.  
  3. RNG_ColorsBold = {0xFFba0000, 0xFFff7979, 0xFF009318, 0xFF47e778 ,0xFF0036ff ,0xFF00c4ff , 0xFF666666 ,0xFFcccccc ,0xFF9432ff , 0xFFc436ff, 0xFFffa536, 0xFFe9ff36,0xFF38a0ab,  0xFF4cd8e7,0xFFb185af, 0xFFffc0fd }
  4. RNG_ColorsTrans = {}
  5.  
  6. for i = 1, 16 do
  7.     RNG_ColorsTrans[i] = RNG_ColorsBold[i]-0xAA000000
  8. end
  9.  
  10. RNG_Colors = {RNG_ColorsBold, RNG_ColorsTrans}
  11.  
  12. --Determination of which RNG address to check, depending on whether or not a battle is taking place.
  13. if mainmemory.read_u8(0x0117)==01 then
  14.     RNG = mainmemory.read_u8(0x0026)
  15. else
  16.     RNG = mainmemory.read_u8(0x29AD)
  17. end
  18.  
  19. RNG_Windows = {-1,8,12,28,45,54,61,87,96,135,151,170,184,219,224,250,255}
  20.  
  21. Windows  = {}
  22. for a = 1,16 do
  23.     if a*0.5 == math.floor(a*0.5) then
  24.         neg = "+" else neg = "-"
  25.         end
  26. Windows[a] = "[".. math.ceil(a*0.5) .. neg .. "]"
  27. end
  28.  
  29. --Drawing the overlayed boxes
  30. for n = 1,16 do
  31. gui.drawBox(RNG_Windows[n]+1,218,RNG_Windows[n+1],225,RNG_ColorsTrans[n],RNG_ColorsTrans[n])
  32. end
  33. --Drawing the active box
  34. for g = 1,16 do
  35.     if RNG <= RNG_Windows[g] then
  36.         Window_Color = RNG_ColorsBold[g]
  37.             Current_Window = Windows[g]
  38.     break end
  39. end
  40.  
  41. gui.drawBox(0,218,RNG,225,Window_Color,Window_Color)
  42.     gui.drawText(RNG-8,203,bizstring.hex(RNG),0xFFFFFFFF,10)
  43.    
  44. if RNG < 127 then
  45.     gui.drawText(RNG+8,202,Current_Window,Window_Color,8) else
  46.         gui.drawText(RNG-26,202,Current_Window,Window_Color,8)
  47. end
  48.  
  49. emu.frameadvance()
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement