Advertisement
Guest User

mario & luigi Bizhawk lua script

a guest
Oct 6th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.89 KB | None | 0 0
  1.  
  2. local pixel= gui.drawPixel
  3. local line = gui.drawLine
  4. local box  = gui.drawBox
  5.  
  6. local ismovie= movie.isloaded
  7.  
  8.  
  9. local TblNextM= { -- Mario experience needed
  10.      7,   32,   68,  108,  218,  336,  470,  694,  962, 1254,  -- 1-10
  11.   1578, 1924, 2306, 2756, 3256, 3830, 4480, 5195, 5975, 6845   --11-20
  12. }
  13.  
  14. local TblNextL= { -- Luigi experience needed
  15.     10,   37,   77,  123,  233,  353,  493,  699,  969, 1272,  -- 1-10
  16.   1552, 1898, 2280, 2730, 3239, 3813, 4463, 5178, 5958, 6858   --11-20
  17. }
  18.  
  19. --** variables to move everything around if needed **--
  20. x =0
  21. y = 0
  22.  
  23. --*****************************************************************************
  24. while true do
  25. --*****************************************************************************
  26.  
  27. memory.usememorydomain("EWRAM")
  28.  
  29. --** design **--
  30. -- box
  31. box(0+x, -1+y, 181+x ,29+y, 0x00000000, 0xD5000000)
  32.  
  33. -- mushroom graphic
  34. line( 3+x,2+y ,7+x,2+y, 0xC4FF0000)
  35. line(  2+x,3+y ,8+x,3+y, 0xC4FF0000)
  36. line(  2+x,4+y ,8+x,4+y, 0xC4FF0000)
  37. line( 4+x,5+y, 6+x,5+y, 0xC4F5D0A9)
  38. line( 4+x,6+y, 6+x,6+y, 0xC4F5D0A9)
  39. pixel(3+x,3+y, 0xC4FFFFFF)
  40. pixel(5+x,2+y, 0xC4FFFFFF)
  41. pixel(7+x,3+y, 0xC4FFFFFF)
  42.  
  43. -- syrup graphic
  44. line(4+x, 8+y, 5+x, 8+y, 0xC4FF9900)
  45. line(4+x, 9+y, 5+x, 9+y, 0xC4FF9900)
  46. line( 2+x, 10+y, 7+x, 10+y, 0xC4FF9900)
  47. line( 2+x, 11+y, 7+x, 11+y, 0xC4FF9900)
  48. line(3+x, 12+y, 6+x, 12+y, 0xC4FF9900)
  49.  
  50. -- seperation line
  51. line(41+x, 15+y, 41+x, 25+y, 0x55FFFFFF)
  52. line(42+x, 15+y,42+x, 25+y, 0x55FFFFFF)
  53.  
  54. line(83+x, 14+y, 83+x, 25+y, 0x55FFFFFF)
  55. line(84+x, 14+y,84+x, 25+y, 0x55FFFFFF)
  56.  
  57. line(67+x, 2+y, 67+x, 13+y, 0x55FFFFFF)
  58. line(68+x, 2+y, 68+x, 13+y, 0x55FFFFFF)
  59.  
  60. line(144+x, 2+y, 144+x, 25+y, 0x55FFFFFF)
  61. line(145+x, 2+y, 145+x, 25+y, 0x55FFFFFF)
  62.  
  63. line(0+x,14+y,82+x,14+y,0x55FFFFFF)
  64.  
  65.  
  66. --** ADDRESS VALUES **--
  67. mushrooms      = memory.read_s8(0x48e2)
  68. supermushrooms = memory.read_s8(0x48e3)
  69. ultramushrooms = memory.read_s8(0x48e4)
  70. maxmushrooms   = memory.read_s8(0x48e5)
  71. nuts           = memory.read_s8(0x48e6)
  72. supernuts      = memory.read_s8(0x48e7)
  73. ultranuts      = memory.read_s8(0x48e8)
  74. maxnuts        = memory.read_s8(0x48e9)
  75. syrups         = memory.read_s8(0x48ea)
  76. supersyrups    = memory.read_s8(0x48eb)
  77. ultrasyrups    = memory.read_s8(0x48ec)
  78. maxsyrups      = memory.read_s8(0x48ed)
  79. ONEups         = memory.read_s8(0x48ee)
  80. ONEupDXs       = memory.read_s8(0x48ef)
  81. goldmushrooms  = memory.read_s8(0x48f0)
  82. herbs          = memory.read_s8(0x48f1)
  83. redpeppers     = memory.read_s8(0x48f2)
  84. greenpeppers   = memory.read_s8(0x48f3)
  85. ahastraights   = memory.read_s8(0x48f4)
  86. ufustraights   = memory.read_s8(0x48f5)
  87. gerastraights  = memory.read_s8(0x48f6)
  88. dehestraights  = memory.read_s8(0x48f7)
  89. ufumanjaros    = memory.read_s8(0x48f8)
  90. gerapuccinos   = memory.read_s8(0x48f9)
  91. dehepressos    = memory.read_s8(0x48fa)
  92.  
  93. ahabeans  = memory.read_s8(0x4902)
  94. ufubeans  = memory.read_s8(0x4903)
  95. gerabeans = memory.read_s8(0x4904)
  96. dehebeans = memory.read_s8(0x4905)
  97.  
  98.  
  99.  
  100. --TODO: CLOTHES
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. --Mario
  109. HPM    = memory.read_s16_le(0x4866)
  110. HPmaxM = memory.read_s16_le(0x486A)
  111. BPM    = memory.read_s16_le(0x486c)
  112. BPmaxM = memory.read_s16_le(0x4870)
  113. PowM   = memory.read_s16_le(0x4874)
  114. DefM   = memory.read_s16_le(0x487c)
  115. SpeedM = memory.read_s16_le(0x4878)
  116. HigeM  = memory.read_s16_le(0x4880)
  117. levelM = memory.read_s8(0x4888)
  118. ExpM   = memory.read_s16_le(0x485c)
  119.  
  120.  
  121. -- This calculates how much experience you have to get for the next level.
  122. -- The NextM/NextL values seem to be hardcoded into the game.
  123. NextM = TblNextM[levelM] or 0
  124. NextexpM = NextM - ExpM
  125.  
  126. --Luigi
  127. HPL    = memory.read_s16_le(0x48a2)
  128. HPmaxL = memory.read_s16_le(0x48a6)
  129. BPL    = memory.read_s16_le(0x48a8)
  130. BPmaxL = memory.read_s16_le(0x48ac)
  131. PowL   = memory.read_s16_le(0x48b0)
  132. DefL   = memory.read_s16_le(0x48b8)
  133. SpeedL = memory.read_s16_le(0x48b4)
  134. HigeL  = memory.read_s16_le(0x48bc)
  135. levelL = memory.read_s8(0x48c4)
  136. ExpL   = memory.read_s16_le(0x4898)
  137.  
  138. -- 'Next' calculator
  139. NextL = TblNextL[levelL] or 0
  140. NextexpL = NextL - ExpL
  141.  
  142.  
  143. -- display
  144.  if mushrooms      == -1 then mushrooms      = 0 end
  145.  if supermushrooms == -1 then supermushrooms = 0 end
  146.  if ultramushrooms == -1 then ultramushrooms = 0 end
  147.  if maxmushrooms   == -1 then maxmushrooms   = 0 end
  148.  if nuts           == -1 then nuts           = 0 end
  149.  if supernuts      == -1 then supernuts      = 0 end
  150.  if ultranuts      == -1 then ultranuts      = 0 end
  151.  if maxnuts        == -1 then maxnuts        = 0 end
  152.  if syrups         == -1 then syrups         = 0 end
  153.  if supersyrups    == -1 then supersyrups    = 0 end
  154.  if ultrasyrups    == -1 then ultrasyrups    = 0 end
  155.  if maxsyrups      == -1 then maxsyrups      = 0 end
  156.  if ONEups         == -1 then ONEups         = 0 end
  157.  if ONEupDXs       == -1 then ONEupDXs       = 0 end
  158.  if redpeppers     == -1 then redpeppers     = 0 end
  159.  if greenpeppers   == -1 then greenpeppers   = 0 end
  160.  if herbs          == -1 then herbs          = 0 end
  161.  if goldmushrooms  == -1 then goldmushrooms  = 0 end
  162.  if ahastraights   == -1 then ahastraights   = 0 end
  163.  if ufustraights   == -1 then ufustraights   = 0 end
  164.  if gerastraights  == -1 then gerastraights  = 0 end
  165.  if dehestraights  == -1 then dehestraights  = 0 end
  166.  if ufumanjaros    == -1 then ufumanjaros    = 0 end
  167.  if gerapuccinos   == -1 then gerapuccinos   = 0 end
  168.  if dehepressos    == -1 then dehepressos    = 0 end
  169.  if ahabeans       == -1 then ahabeans       = 0 end
  170.  if ufubeans       == -1 then ufubeans       = 0 end
  171.  if gerabeans      == -1 then gerabeans      = 0 end
  172.  if dehebeans      == -1 then dehebeans      = 0 end
  173.  
  174.  
  175. gui.text(23+x,12+y, syrups, 0x000000)
  176. gui.text(49+x,12+y, supersyrups, 0x000000)
  177. gui.text(75+x,12+y, ultrasyrups, 0x000000)
  178. gui.text(101+x,12+y, maxsyrups, 0x000000)
  179.  
  180. gui.text(23+x,0+y, mushrooms, 0x000000)
  181. gui.text(49+x,0+y, supermushrooms, 0x000000)
  182. gui.text(75+x,0+y, ultramushrooms, 0x000000)
  183. gui.text(101+x,0+y, maxmushrooms, 0x000000)
  184.  
  185.  
  186. --Mushpower + Cash
  187. gui.text(96+x,29+y,  mushrooms*0.078 + supermushrooms*0.098 + ultramushrooms*0.117 + maxmushrooms*0.199 , 0x00000000, "yellow")
  188. gui.text( 96+x, 41+y, "$ ".. memory.read_s16_le(0x48e0), 0x00000000,"yellow")
  189.  
  190. --stats
  191. gui.text( 146+x, 0+y, "Lv" .. levelM, 0x00000000,0xffEE9595)
  192. gui.text(232+x, 0+y, "Lv" .. levelL,0x00000000,0xff77EE77)
  193. gui.text( 146+x, 12+y, "BP ", 0x00000000,0xff777777)
  194. gui.text( 174+x, 25+y, "POW ", 0x00000000,0xff777777)
  195. gui.text( 174+x, 38+y, "HIGE ", 0x00000000,0xff777777)
  196.  
  197. gui.text( 168+x, 12+y, BPM .. "/" .. BPmaxM, 0x000000)
  198. gui.text( 231+x, 12+y, BPL .. "/" .. BPmaxL, 0x000000)
  199. ----gui.text( 86+x,25+y, "NEXT ", "#A9D0F5")
  200. gui.text(204+x,25+y, PowM, 0x00000000,0xffffffff)
  201. gui.text(252+x,25+y, PowL, 0x00000000,0xffffffff)
  202. gui.text(216+x,37+y, HigeM,0x00000000,0xffffffff)
  203. gui.text(252+x,37+y, HigeL,0x00000000,0xffffffff)
  204. ----gui.text(107+x,25+y, NextexpM .. "   " .. NextexpL)
  205.  
  206.  
  207. --Bros Attacks counters
  208. gui.text( 6+x,29+y, "S".. math.max(20 - memory.read_s8(0x4684),0),0x000000,0xffEE9595)
  209. gui.text(-14+x,41+y,"  B".. math.max( 8 - memory.read_s8(0x468c),0),0x000000,0xff77EE77)
  210. gui.text(25+x,29+y,"  C".. math.max(32 - memory.read_s8(0x4686),0),0x000000,0xffEE9595)
  211. gui.text(25+x,41+y,"  K".. math.max(43 - memory.read_s8(0x468e),0),0x000000,0xff77EE77)
  212.  
  213. -- RNG
  214. box(0+x, 30+y, 19+x ,45+y, 0x00000000, 0xAF000000)
  215. gui.text(3+x,60+y, memory.read_u8(0x1e60),0x00000000,0xffffffff)  
  216. gui.text(3+x,73+y, memory.read_u8(0x1e64),0x00000000,0xffffffff)
  217.  
  218.  
  219. --Movie active? Lagframe? framecount+lagcount
  220. if ismovie()~=true then box(21,30,140,38, 0x00FF0000, 0xC4FF0000) end
  221. if ismovie()~=true then box(0,0,239,159, 0xFFFF0000) end                           --border around the screen
  222. if ismovie()~=true then gui.text(45,60, "! MOVIE NOT RECORDING !", 0x00000000, 0xFFFFFFFF) end
  223.  
  224. if ismovie() == true then
  225. ----*** when lagging
  226. if emu.islagged()==true then gui.text(90,76, "*****", 0x00000000, 0xFFFFFF33) end
  227.  
  228. ----framecount
  229. gui.text(44,60, emu.framecount(), 0xff000000, 0xFF000000) --stroke
  230. gui.text(47,60, emu.framecount(), 0xff000000, 0xFF000000)
  231. gui.text(46,59, emu.framecount(), 0xff000000, 0xFF000000)
  232. gui.text(46,60, emu.framecount(), 0xff000000, 0xFFFFFFFF) --white framecounttext
  233.  
  234. ----lagcount
  235. gui.text(44,76, emu.lagcount(), 0xff000000, 0xFF000000) --stroke
  236. gui.text(47,76, emu.lagcount(), 0xff000000, 0xFF000000)
  237. gui.text(46,75, emu.lagcount(), 0xff000000, 0xFF000000)
  238. gui.text(46,76, emu.lagcount(), 0xff000000, 0xFFFFFF33) --yellow lagcounttext
  239.  
  240. ----input
  241. t = ""
  242. for key, value in pairs(joypad.get()) do
  243.     if tostring(value) ~= "false" then    t = t .." ".. tostring(key) end
  244. end
  245. gui.text(100,60,tostring(t), 0xff000000, 0xff000000)
  246. gui.text(103,60,tostring(t), 0xff000000, 0xff000000)
  247. gui.text(102,59,tostring(t), 0xff000000, 0xff000000)
  248. gui.text(102,60,tostring(t), 0xff000000, 0xffffffff)
  249. end
  250.  
  251.  
  252. ---- POS
  253. gui.text(300+x,  1+y, memory.read_s24_le(0x6c14), 0x00000000,0xffEE9595)
  254. gui.text(300+x,  13+y, memory.read_s24_le(0x6c18), 0x00000000,0xffEE9595)
  255. gui.text(300+x, 25+y, memory.read_s24_le(0x6fb0), 0x00000000, 0xff77EE77)
  256. gui.text(300+x, 37+y, memory.read_s24_le(0x6fb4), 0x00000000,0xff77EE77)
  257.  
  258. ---- MISC
  259. --gui.text(10, 89, "rookie hp " ..R2u(0x8ce6)-5000, 0xE5FFFF00)
  260. --gui.text(10, 89, "Birdo hp "  ..R2u(0x8fe2), 0xE5FFFF00)
  261. --gui.text(10, 89, "head  "  ..R2u(0xaa42)-5000, 0xE5FFFF00)
  262. --gui.text(10, 98, "heart  " ..R2u(0xa912)-5000, 0xE5FFFF00)
  263. --gui.text(10,107, "left  "  ..R2u(0xab72)-5000, 0xE5FFFF00)
  264. --gui.text(10,116, "right  " ..R2u(0xaca2)-5000, 0xE5FFFF00)
  265.  
  266.  
  267. if     memory.read_s8(0x04f4c) == 0 then box(141,37,181,45, 0x00000000,0xaf000000)
  268. elseif memory.read_s8(0x4f4c) == 1 then box(141,30,181,38, 0x00000000,0xaf000000) end
  269.  
  270. memory.usememorydomain("IWRAM")
  271. gui.text(288+x, 60+y, memory.read_s8(0x2429), 0x00000000,0xffEE9595)
  272. gui.text(324+x, 60+y, memory.read_s8(0x2440), 0x00000000, 0xff77EE77)
  273.  
  274. gui.text(288+x, 73+y, memory.read_s8(0x2441), 0x00000000, 0xff77EE77)
  275. gui.text(324+x, 73+y, memory.read_s8(0x2428), 0x00000000,0xffEE9595)
  276.  
  277.  
  278. emu.frameadvance()
  279. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement