Advertisement
Cronokirby

CT rng visualiser (bizhawk 1.11)

Jun 18th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.72 KB | None | 0 0
  1. while true do
  2.  
  3. --Defining the colors, ported from Googlesheets.
  4.     Crono=0xB0ebc266
  5.     Frog=0xB077d766
  6.     Marle=0xb000ffff
  7.     Lucca=0xb0eb2121
  8.     Robo=0xb0abb4c0
  9.     Ayla=0xb0e29deb
  10.     Black=0xFF000000
  11.     Transparent=0x00000000
  12.    
  13. --Defining the colors that will be used for the RNG visualiser
  14.     Oneminus=0xFFba0000
  15.         OneminusLow=0x55ba0000
  16.     Oneplus=0xFFff7979
  17.         OneplusLow=0x55ff7979
  18.     Twominus=0xFF009318
  19.         TwominusLow=0x55009318
  20.     Twoplus=0xFF47e778
  21.             TwoplusLow=0x5547e778
  22.     Threeminus=0xFF0036ff
  23.         ThreeminusLow=0x550036ff
  24.     Threeplus=0xFF00c4ff
  25.             ThreeplusLow=0x5500c4ff
  26.     Fourminus=0xFF666666
  27.             FourminusLow=0x55666666
  28.     Fourplus=0xFFcccccc
  29.         FourplusLow=0x55cccccc
  30.     Fiveminus=0xFF9432ff
  31.         FiveminusLow=0x559432ff
  32.     Fiveplus=0xFFc436ff
  33.         FiveplusLow=0x55c436ff
  34.     Sixminus=0xFFffa536
  35.         SixminusLow=0x55ffa536
  36.     Sixplus=0xFFe9ff36
  37.         SixplusLow=0x55e9ff36
  38.     Sevenminus=0xFF38a0ab
  39.         SevenminusLow=0x5538a0ab
  40.     Sevenplus=0xFF4cd8e7
  41.         SevenplusLow=0x554cd8e7
  42.     Eightminus=0xFFb185af
  43.         EightminusLow=0x55b185af
  44.     Eightplus=0xFFffc0fd
  45.         EightplusLow=0x55ffc0fd
  46.        
  47. --RNG visualiser   
  48. if mainmemory.readbyte(0x0117)==01
  49. then
  50. RNGpos=218
  51. else
  52. RNGpos=218
  53.         end
  54.        
  55. if mainmemory.readbyte(0x0117)==01
  56. then
  57. RNGpos2=225
  58. else
  59. RNGpos2=225
  60.     end
  61.    
  62.         --determination of which address to check for RNG
  63.      StoredRNG=mainmemory.readbyte(0x29ad)
  64.      NumStored=tonumber (StoredRNG)
  65.     RawBatRNG=mainmemory.readbyte(0x0026)
  66.     BatRNG=tonumber(RawBatRNG)
  67.    
  68. if mainmemory.readbyte(0x0117)==01
  69. then
  70. RNG=BatRNG
  71. else
  72. RNG=NumStored
  73.         end
  74.        
  75. --Color definition
  76.         --1- section
  77.         gui.drawBox(0,RNGpos,8,RNGpos2,OneminusLow,OneminusLow)
  78.         --1+ section
  79.         gui.drawBox(9,RNGpos,12,RNGpos2,OneplusLow,OneplusLow)
  80.         --2- section
  81.         gui.drawBox(13,RNGpos,28,RNGpos2,TwominusLow,TwominusLow)
  82.         --2+ section
  83.         gui.drawBox(29,RNGpos,45,RNGpos2,TwoplusLow,TwoplusLow)
  84.         --3- section
  85.         gui.drawBox(46,RNGpos,54,RNGpos2,ThreeminusLow,ThreeminusLow)
  86.         --3+ section
  87.         gui.drawBox(55,RNGpos,61,RNGpos2,ThreeplusLow,ThreeplusLow)
  88.         --4- section
  89.         gui.drawBox(62,RNGpos,87,RNGpos2,FourminusLow,FourminusLow)
  90.         --4+ section
  91.         gui.drawBox(88,RNGpos,96,RNGpos2,FourplusLow,FourplusLow)
  92.         --5- section
  93.         gui.drawBox(97,RNGpos,135,RNGpos2,FiveminusLow,FiveminusLow)
  94.         --5+ section
  95.         gui.drawBox(136,RNGpos,151,RNGpos2,FiveplusLow,FiveplusLow)
  96.         --6- section
  97.         gui.drawBox(152,RNGpos,170,RNGpos2,SixminusLow,SixminusLow)
  98.         --6+ section
  99.         gui.drawBox(171,RNGpos,184,RNGpos2,SixplusLow,SixplusLow)
  100.         --7- section
  101.         gui.drawBox(185,RNGpos,219,RNGpos2,SevenminusLow,SevenminusLow)
  102.         --7+ section
  103.         gui.drawBox(220,RNGpos,224,RNGpos2,SevenplusLow,SevenplusLow)
  104.         --8- section
  105.         gui.drawBox(225,RNGpos,250,RNGpos2,EightminusLow,EightminusLow)
  106.         --8+ section
  107.         gui.drawBox(251,RNGpos,255,RNGpos2,EightplusLow,EightplusLow)
  108.  
  109.         --Color Determination
  110.         if RNG < 9
  111.         then
  112.         VisColor=Oneminus
  113.         elseif RNG < 13
  114.         then
  115.         VisColor=Oneplus
  116.         elseif  RNG < 29
  117.         then
  118.         VisColor=Twominus
  119.         elseif  RNG < 46
  120.         then
  121.         VisColor=Twoplus
  122.         elseif  RNG < 55
  123.         then
  124.         VisColor=Threeminus
  125.         elseif RNG < 62
  126.         then
  127.         VisColor=Threeplus
  128.         elseif RNG < 88
  129.         then
  130.         VisColor=Fourminus
  131.         elseif RNG < 97
  132.         then
  133.         VisColor=Fourplus
  134.         elseif RNG < 136
  135.         then
  136.         VisColor=Fiveminus
  137.         elseif RNG < 152
  138.         then
  139.         VisColor=Fiveplus
  140.         elseif RNG < 171
  141.         then
  142.         VisColor=Sixminus
  143.         elseif RNG < 185
  144.         then
  145.         VisColor=Sixplus
  146.         elseif RNG < 220
  147.         then
  148.         VisColor=Sevenminus
  149.         elseif RNG < 225
  150.         then
  151.         VisColor=Sevenplus
  152.         elseif RNG < 251
  153.         then
  154.         VisColor=Eightminus
  155.         else VisColor=Eightplus
  156. end    
  157.    
  158.     --the box  
  159. gui.drawBox(0,RNGpos,RNG,RNGpos2,VisColor,VisColor)
  160.         --the text
  161. numRNGpos = tonumber(RNGpos)
  162. gui.drawText(RNG-8,RNGpos-15,bizstring.hex(RNG), 0xFFFFFFFF,10,"arial")
  163.  
  164.         --Currentwindow
  165.             if RNG < 9
  166.         then
  167.         CurrentWindow="[1-]"
  168.         elseif RNG < 13
  169.         then
  170.         CurrentWindow="[1+]"
  171.         elseif  RNG < 29
  172.         then
  173.         CurrentWindow="[2-]"
  174.         elseif  RNG < 46
  175.         then
  176.         CurrentWindow="[2+]"
  177.         elseif  RNG < 55
  178.         then
  179.         CurrentWindow="[3-]"
  180.         elseif RNG < 62
  181.         then
  182.         CurrentWindow="[3+]"
  183.         elseif RNG < 88
  184.         then
  185.         CurrentWindow="[4-]"
  186.         elseif RNG < 97
  187.         then
  188.         CurrentWindow="[4+]"
  189.         elseif RNG < 136
  190.         then
  191.         CurrentWindow="[5-]"
  192.         elseif RNG < 152
  193.         then
  194.         CurrentWindow="[5+]"
  195.         elseif RNG < 171
  196.         then
  197.         CurrentWindow="[6-]"
  198.         elseif RNG < 185
  199.         then
  200.         CurrentWindow="[6+]"
  201.         elseif RNG < 220
  202.         then
  203.         CurrentWindow="[7-]"
  204.         elseif RNG < 225
  205.         then
  206.         CurrentWindow="[7+]"
  207.         elseif RNG < 251
  208.         then
  209.         CurrentWindow="[8-]"
  210.         else CurrentWindow="[8+]"
  211. end
  212.             if RNG < 127
  213.             then
  214.             gui.drawText(RNG+8,RNGpos-16,CurrentWindow,VisColor,8)
  215.                 else
  216.                     gui.drawText(RNG-26,RNGpos-16,CurrentWindow,VisColor,8)
  217.             end
  218.        
  219.  
  220. emu.frameadvance()
  221. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement