Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local speed=-512
- local z=0
- local memorys={}
- local RPD = 0.0174532925 -- radians per degree
- function MSearch()
- for i=0,53000 do
- memorys[i]=memory.readwordsigned(0x02000000+2*i)
- if memorys[i]==speed then
- z=2*i
- break
- end
- end
- end
- ------------------------------------
- local function convert(frames,fps)
- local mins = math.floor((frames/fps)/60)
- local secs = math.floor((frames/fps-mins*60)*100+0.5)/100
- return string.format("%02d:%05.2f",mins,secs)
- end
- -----------------------------------
- function fn()
- --lag and time
- if emu.lagged() then
- gui.drawbox(2,2,237,157,0xff000000,"red")
- gui.text(190,19,"*********",0x00ffffcc,0xff000000)
- end
- gui.text(194,1,convert(emu.framecount(),60),0x00ffffcc,0xff000000)
- gui.text(194,8,emu.framecount().." "..emu.lagcount(),0x00ffffcc,0xff000000)
- --memory searching
- key = input.get()
- mouse = { x = key.xmouse, y = key.ymouse }
- key.xmouse, key.ymouse = nil, nil
- local x, y = mouse.x, mouse.y
- if key.leftclick and not keyprev.leftclick then
- if x>=70 and y>=0 and x<=113 and y<=15 then
- MSearch()
- end
- end
- keyprev = key
- mouseprev = mouse
- end
- gui.register(fn)
- -------------------------------------
- LevelObjectives = {
- [-1] = {"-",""},
- -- world1
- [0] = {"7 Apples",""},
- [1] = {"9 Apples",""},
- [2] = {"9 Apples",""},
- -- world2
- [3] = {"70 Coins",""},
- [4] = {"5 Apples",""},
- [5] = {"85 Coins",""},
- [6] = {"80 Coins",""},
- [7] = {"8 Apples",""},
- [8] = {"90 Coins",""},
- -- world3
- [9] = {"10 Shy Guys",""},
- [10] = {"55 Coins",""},
- [11] = {"10 Rockies",""},
- [12] = {"50 Coins",""},
- [13] = {"20 Ducks",""},
- [14] = {"85 Coins",""},
- [15] = {"9 Apples",""},
- [16] = {"65 Coins","12 Piranhas"},
- -- world4
- [17] = {"15 Sec Left+",""},
- [18] = {"45 Coins",""},
- [19] = {"20 Sec Left+",""},
- [20] = {"22 Ducks",""},
- [21] = {"20 Sec Left+",""},
- [22] = {"10 Apples","80 Coins"},
- [23] = {"14 Piranhas",""},
- [24] = {"25 Sec Left+",""},
- [25] = {"86 Coins",""},
- [26] = "4-10",
- -- boss
- [27] = {"",""},
- -- world5
- [28] = "5-1",
- [29] = "5-2",
- [30] = "5-3",
- [31] = "5-4",
- [32] = "5-5",
- [33] = "5-6",
- [34] = "5-7",
- [35] = "5-8",
- [36] = "5-9",
- [37] = "5-10",
- [38] = "5-11",
- -- world6
- [39] = "6-1",
- [40] = "6-2",
- [41] = "6-3",
- [42] = "6-4",
- [43] = "6-5",
- [44] = "6-6",
- [45] = "6-7",
- [46] = "6-8",
- [47] = "6-9",
- [48] = "6-10",
- [49] = "6-11",
- [50] = "6-12",
- --finalboss
- [51] = {"",""}
- }
- LevelNames = {
- [-1] = "-",
- [0] = "1-1",
- [1] = "1-2",
- [2] = "1-3",
- [3] = "2-1",
- [4] = "2-2",
- [5] = "2-3",
- [6] = "2-4",
- [7] = "2-5",
- [8] = "2-6",
- [9] = "3-1",
- [10] = "3-2",
- [11] = "3-3",
- [12] = "3-4",
- [13] = "3-5",
- [14] = "3-6",
- [15] = "3-7",
- [16] = "3-8",
- [17] = "4-1",
- [18] = "4-2",
- [19] = "4-3",
- [20] = "4-4",
- [21] = "4-5",
- [22] = "4-6",
- [23] = "4-7",
- [24] = "4-8",
- [25] = "4-9",
- [26] = "4-10",
- [27] = "Boss",
- [28] = "5-1",
- [29] = "5-2",
- [30] = "5-3",
- [31] = "5-4",
- [32] = "5-5",
- [33] = "5-6",
- [34] = "5-7",
- [35] = "5-8",
- [36] = "5-9",
- [37] = "5-10",
- [38] = "5-11",
- [39] = "6-1",
- [40] = "6-2",
- [41] = "6-3",
- [42] = "6-4",
- [43] = "6-5",
- [44] = "6-6",
- [45] = "6-7",
- [46] = "6-8",
- [47] = "6-9",
- [48] = "6-10",
- [49] = "6-11",
- [50] = "6-12",
- [51] = "Final"
- }
- ---------------------------------
- while true do
- CurrentLevel = memory.readbyteunsigned(0x030003d9)
- if CurrentLevel > 51 or CurrentLevel < 0 then CurrentLevel = -1 end
- Xpos = memory.readbyteunsigned(0x030004C1) + 256*memory.readbyteunsigned(0x030004C2)
- Ypos = memory.readbyteunsigned(0x030004C5) + 256*memory.readbyteunsigned(0x030004C6)
- Xsub = memory.readbyteunsigned(0x030004C0)/256 .. "0000"
- Ysub = memory.readbyteunsigned(0x030004C4)/256 .. "0000"
- Xspeed = memory.readwordsigned(0x02000000+z)
- Yspeed = memory.readwordsigned(0x02000000+z+4)
- XonScreen = Xpos - memory.readwordunsigned(0x03001e00) -- used to draw angle line
- YonScreen = Ypos - memory.readwordunsigned(0x03001e02)
- Angle = memory.readbyteunsigned(0x02000000+z-22) -- 0 ~ 256
- AngleDegree = Angle * 1.40625 -- 0° ~ 360°
- -- movie not active warning
- if movie.active() == false then
- gui.opacity(0.5)
- gui.drawbox(0,124,260,136,"red",0x00000000)
- gui.opacity(1)
- gui.text(68,127,"!! MOVIE NOT RECORDING !!")
- gui.opacity(0.85)
- end
- --draw angle line (after memory search was done)
- if z ~= 0 then
- des1 = math.sin(AngleDegree*RPD)*-80 -- draw line yoshi to here
- des2 = math.cos(-AngleDegree*RPD)*80
- des3 = math.sin((AngleDegree+90)*RPD)*-80
- des4 = math.cos(-(AngleDegree+90)*RPD)*80
- gui.drawline(XonScreen,YonScreen,XonScreen+des1,YonScreen+des2,"white") -- below yoshi
- gui.drawline(XonScreen,YonScreen,XonScreen-des1,YonScreen-des2,"white") -- above yoshi
- gui.drawline(XonScreen,YonScreen,XonScreen+des3,YonScreen+des4,"white") -- left of yoshi
- gui.drawline(XonScreen,YonScreen,XonScreen-des3,YonScreen-des4,"white") -- right of yoshi
- end
- --draw box
- gui.opacity(0.65)
- gui.drawbox(28,-1,250,16,"black","grey")
- --draw seperation lines
- gui.opacity(0.45)
- gui.drawline(66,3,66,13,"white")
- gui.drawline(189,3,189,13,"white")
- gui.drawline(117,3,117,13,"white")
- gui.opacity(0.85)
- -- draw info
- gui.text(121,1,LevelNames[CurrentLevel],"white",0xff000000)
- gui.text(140,1, LevelObjectives[CurrentLevel][1], "yellow" ,0xff000000)
- gui.text(140,8, LevelObjectives[CurrentLevel][2], "yellow" ,0xff000000)
- gui.text(22,1, string.format("%6d",Xpos) ..".".. string.sub(Xsub,3,5), "white",0xff000000)
- gui.text(22,8, string.format("%6d",Ypos) ..".".. string.sub(Ysub,3,5), "white",0xff000000)
- if z == 0 then
- gui.drawbox(70, 1, 113, 14, "grey")
- gui.text(72,1,"Click here\nto Search", "white",0xff000000)
- else
- gui.text(70,1,string.format("%5d",Xspeed), "white",0xff000000)
- gui.text(70,8,string.format("%5d",Yspeed), "white",0xff000000)
- gui.text(97,1,string.format("%3d",AngleDegree) .. '"', "white",0xff000000)
- gui.text(97,8,string.format("%3d",Angle),"white",0xff000000)
- end
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement