Advertisement
Guest User

lua script yoshi's topsy turvy vba v24 2015

a guest
Aug 13th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.31 KB | None | 0 0
  1. local speed=-512
  2. local z=0
  3. local memorys={}
  4. local RPD = 0.0174532925 -- radians per degree
  5.  
  6. function MSearch()
  7. for i=0,53000 do
  8. memorys[i]=memory.readwordsigned(0x02000000+2*i)
  9.  
  10. if memorys[i]==speed then
  11. z=2*i
  12. break
  13. end
  14. end
  15. end
  16.  
  17.  
  18. ------------------------------------
  19.  
  20. local function convert(frames,fps)
  21. local mins = math.floor((frames/fps)/60)
  22. local secs = math.floor((frames/fps-mins*60)*100+0.5)/100
  23. return string.format("%02d:%05.2f",mins,secs)
  24. end
  25.  
  26. -----------------------------------
  27. function fn()
  28. --lag and time
  29.  
  30. if emu.lagged() then
  31. gui.drawbox(2,2,237,157,0xff000000,"red")
  32. gui.text(190,19,"*********",0x00ffffcc,0xff000000)
  33. end
  34.  
  35. gui.text(194,1,convert(emu.framecount(),60),0x00ffffcc,0xff000000)
  36. gui.text(194,8,emu.framecount().." "..emu.lagcount(),0x00ffffcc,0xff000000)
  37.  
  38. --memory searching
  39.  
  40. key = input.get()
  41. mouse = { x = key.xmouse, y = key.ymouse }
  42. key.xmouse, key.ymouse = nil, nil
  43. local x, y = mouse.x, mouse.y
  44.  
  45. if key.leftclick and not keyprev.leftclick then
  46. if x>=70 and y>=0 and x<=113 and y<=15 then
  47. MSearch()
  48. end
  49. end
  50.  
  51. keyprev = key
  52. mouseprev = mouse
  53.  
  54. end
  55.  
  56. gui.register(fn)
  57.  
  58. -------------------------------------
  59. LevelObjectives = {
  60. [-1] = {"-",""},
  61. -- world1
  62. [0] = {"7 Apples",""},
  63. [1] = {"9 Apples",""},
  64. [2] = {"9 Apples",""},
  65. -- world2
  66. [3] = {"70 Coins",""},
  67. [4] = {"5 Apples",""},
  68. [5] = {"85 Coins",""},
  69. [6] = {"80 Coins",""},
  70. [7] = {"8 Apples",""},
  71. [8] = {"90 Coins",""},
  72. -- world3
  73. [9] = {"10 Shy Guys",""},
  74. [10] = {"55 Coins",""},
  75. [11] = {"10 Rockies",""},
  76. [12] = {"50 Coins",""},
  77. [13] = {"20 Ducks",""},
  78. [14] = {"85 Coins",""},
  79. [15] = {"9 Apples",""},
  80. [16] = {"65 Coins","12 Piranhas"},
  81. -- world4
  82. [17] = {"15 Sec Left+",""},
  83. [18] = {"45 Coins",""},
  84. [19] = {"20 Sec Left+",""},
  85. [20] = {"22 Ducks",""},
  86. [21] = {"20 Sec Left+",""},
  87. [22] = {"10 Apples","80 Coins"},
  88. [23] = {"14 Piranhas",""},
  89. [24] = {"25 Sec Left+",""},
  90. [25] = {"86 Coins",""},
  91. [26] = "4-10",
  92. -- boss
  93. [27] = {"",""},
  94. -- world5
  95. [28] = "5-1",
  96. [29] = "5-2",
  97. [30] = "5-3",
  98. [31] = "5-4",
  99. [32] = "5-5",
  100. [33] = "5-6",
  101. [34] = "5-7",
  102. [35] = "5-8",
  103. [36] = "5-9",
  104. [37] = "5-10",
  105. [38] = "5-11",
  106. -- world6
  107. [39] = "6-1",
  108. [40] = "6-2",
  109. [41] = "6-3",
  110. [42] = "6-4",
  111. [43] = "6-5",
  112. [44] = "6-6",
  113. [45] = "6-7",
  114. [46] = "6-8",
  115. [47] = "6-9",
  116. [48] = "6-10",
  117. [49] = "6-11",
  118. [50] = "6-12",
  119. --finalboss
  120. [51] = {"",""}
  121. }
  122.  
  123. LevelNames = {
  124. [-1] = "-",
  125. [0] = "1-1",
  126. [1] = "1-2",
  127. [2] = "1-3",
  128. [3] = "2-1",
  129. [4] = "2-2",
  130. [5] = "2-3",
  131. [6] = "2-4",
  132. [7] = "2-5",
  133. [8] = "2-6",
  134. [9] = "3-1",
  135. [10] = "3-2",
  136. [11] = "3-3",
  137. [12] = "3-4",
  138. [13] = "3-5",
  139. [14] = "3-6",
  140. [15] = "3-7",
  141. [16] = "3-8",
  142. [17] = "4-1",
  143. [18] = "4-2",
  144. [19] = "4-3",
  145. [20] = "4-4",
  146. [21] = "4-5",
  147. [22] = "4-6",
  148. [23] = "4-7",
  149. [24] = "4-8",
  150. [25] = "4-9",
  151. [26] = "4-10",
  152. [27] = "Boss",
  153. [28] = "5-1",
  154. [29] = "5-2",
  155. [30] = "5-3",
  156. [31] = "5-4",
  157. [32] = "5-5",
  158. [33] = "5-6",
  159. [34] = "5-7",
  160. [35] = "5-8",
  161. [36] = "5-9",
  162. [37] = "5-10",
  163. [38] = "5-11",
  164. [39] = "6-1",
  165. [40] = "6-2",
  166. [41] = "6-3",
  167. [42] = "6-4",
  168. [43] = "6-5",
  169. [44] = "6-6",
  170. [45] = "6-7",
  171. [46] = "6-8",
  172. [47] = "6-9",
  173. [48] = "6-10",
  174. [49] = "6-11",
  175. [50] = "6-12",
  176. [51] = "Final"
  177. }
  178. ---------------------------------
  179.  
  180.  
  181. while true do
  182.  
  183. CurrentLevel = memory.readbyteunsigned(0x030003d9)
  184. if CurrentLevel > 51 or CurrentLevel < 0 then CurrentLevel = -1 end
  185.  
  186. Xpos = memory.readbyteunsigned(0x030004C1) + 256*memory.readbyteunsigned(0x030004C2)
  187. Ypos = memory.readbyteunsigned(0x030004C5) + 256*memory.readbyteunsigned(0x030004C6)
  188. Xsub = memory.readbyteunsigned(0x030004C0)/256 .. "0000"
  189. Ysub = memory.readbyteunsigned(0x030004C4)/256 .. "0000"
  190. Xspeed = memory.readwordsigned(0x02000000+z)
  191. Yspeed = memory.readwordsigned(0x02000000+z+4)
  192.  
  193. XonScreen = Xpos - memory.readwordunsigned(0x03001e00) -- used to draw angle line
  194. YonScreen = Ypos - memory.readwordunsigned(0x03001e02)
  195.  
  196. Angle = memory.readbyteunsigned(0x02000000+z-22) -- 0 ~ 256
  197. AngleDegree = Angle * 1.40625 -- 0° ~ 360°
  198.  
  199.  
  200.  
  201. -- movie not active warning
  202.  
  203. if movie.active() == false then
  204. gui.opacity(0.5)
  205. gui.drawbox(0,124,260,136,"red",0x00000000)
  206. gui.opacity(1)
  207. gui.text(68,127,"!! MOVIE NOT RECORDING !!")
  208. gui.opacity(0.85)
  209. end
  210.  
  211. --draw angle line (after memory search was done)
  212.  
  213. if z ~= 0 then
  214.  
  215. des1 = math.sin(AngleDegree*RPD)*-80 -- draw line yoshi to here
  216. des2 = math.cos(-AngleDegree*RPD)*80
  217. des3 = math.sin((AngleDegree+90)*RPD)*-80
  218. des4 = math.cos(-(AngleDegree+90)*RPD)*80
  219.  
  220. gui.drawline(XonScreen,YonScreen,XonScreen+des1,YonScreen+des2,"white") -- below yoshi
  221. gui.drawline(XonScreen,YonScreen,XonScreen-des1,YonScreen-des2,"white") -- above yoshi
  222. gui.drawline(XonScreen,YonScreen,XonScreen+des3,YonScreen+des4,"white") -- left of yoshi
  223. gui.drawline(XonScreen,YonScreen,XonScreen-des3,YonScreen-des4,"white") -- right of yoshi
  224.  
  225. end
  226.  
  227. --draw box
  228. gui.opacity(0.65)
  229. gui.drawbox(28,-1,250,16,"black","grey")
  230.  
  231. --draw seperation lines
  232. gui.opacity(0.45)
  233. gui.drawline(66,3,66,13,"white")
  234. gui.drawline(189,3,189,13,"white")
  235. gui.drawline(117,3,117,13,"white")
  236. gui.opacity(0.85)
  237.  
  238. -- draw info
  239. gui.text(121,1,LevelNames[CurrentLevel],"white",0xff000000)
  240. gui.text(140,1, LevelObjectives[CurrentLevel][1], "yellow" ,0xff000000)
  241. gui.text(140,8, LevelObjectives[CurrentLevel][2], "yellow" ,0xff000000)
  242. gui.text(22,1, string.format("%6d",Xpos) ..".".. string.sub(Xsub,3,5), "white",0xff000000)
  243. gui.text(22,8, string.format("%6d",Ypos) ..".".. string.sub(Ysub,3,5), "white",0xff000000)
  244.  
  245. if z == 0 then
  246. gui.drawbox(70, 1, 113, 14, "grey")
  247. gui.text(72,1,"Click here\nto Search", "white",0xff000000)
  248. else
  249. gui.text(70,1,string.format("%5d",Xspeed), "white",0xff000000)
  250. gui.text(70,8,string.format("%5d",Yspeed), "white",0xff000000)
  251. gui.text(97,1,string.format("%3d",AngleDegree) .. '"', "white",0xff000000)
  252. gui.text(97,8,string.format("%3d",Angle),"white",0xff000000)
  253. end
  254.  
  255. emu.frameadvance()
  256. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement