-- Shows Dual RAM -- [ Functions for ClipLua ] -------------- local keys, lastkeys= input.get(), input.get() local function UpdateKeys() lastkeys= keys; keys= input.get() end local function Press(k) return keys[k] and (not lastkeys[k]) end --find out which item is in mario's hands (if doublegrab, then it will use the highest slot) function carry() temp=nil for i = 0,11 do if memory.readbyte(0x7E14C8 + i) == 11 then temp=i end end slot=temp return slot end -- [ Show Main Info ] ------------- function main(slot) local xspeed = memory.readbytesigned(0x7e007b) local xpos = memory.readword(0x7e0094) local xsubpos = memory.readbyte(0x7e13da) local yspeed = memory.readbytesigned(0x7e007d) local ypos = memory.readword(0x7e0096) local ysubpos = memory.readbyte(0x7e13dc) local framecount = memory.readbyte(0x7e0014) local gatheredcoins = memory.readbyte(0x7e0dbf) local itembox = memory.readbyte(0x7e0dc2) local levelnumber = memory.readbyte(0x7e13bf) local playeronground = memory.readbyte(0x7e13ef) local vertiscroll = memory.readbyte(0x7e13f1) local maxscreens = memory.readbyte(0x7e005d) local multicoin = memory.readbyte(0x7e186b) local pmeter = memory.readbyte(0x7e13e4) local takeoff = memory.readbyte(0x7e149f) local bluepow = memory.readbyte(0x7e14ad) local silverpow = memory.readbyte(0x7e14ae) local direction = memory.readbyte(0x7e0076) local joypad1 = memory.readbyte(0x7e0015) local joypad1ff = memory.readbyte(0x7e0016) local joypad2 = memory.readbyte(0x7e0017) local joypad2ff = memory.readbyte(0x7e0018) local ysubpos = memory.readbyte(0x7e13dc) local invinci = memory.readbyte(0x7e1497) local star = memory.readbyte(0x7e1490) local gamemode = memory.readbyte(0x7e0100) display() gui.opacity(.5) gui.text(20,216,"< ^ > v B A Y X L R S s") -- Displays the transparent buttons that are used with the display function ClipLua() smwDrawSpriteInfo() gui.opacity(.75) gui.text(1,130,string.format("%d, %d.%02x",xspeed,xpos,xsubpos)) gui.text(1,138,string.format("%d, %d.%02x",yspeed,ypos,ysubpos)) gui.text(107,44,string.format("Screen: %d/%d",xpos/256 + 1,maxscreens)) gui.text(1,50,string.format("%02d",playeronground)) if vertiscroll == 0 then gui.text(180, 1, "NVS") else gui.text(180, 1, "VS") end gui.text(190,210, string.format("%02x %02x %02x %02x", joypad1, joypad1ff, joypad2, joypad2ff)) gui.text(127,36, itembox) if multicoin > 0 then gui.text(1,90,"MultiCoin: " .. multicoin,"yellow") end gui.text(1,162,string.format("%d, %d",pmeter,takeoff)) if bluepow > 0 then gui.text(1,98,"BluePow: " .. bluepow * 4 - framecount % 4,"#00a0ffff") end if silverpow > 0 then gui.text(1,106,"SilverPow: " .. silverpow * 4 - framecount % 4,"silver") end if invinci > 0 then gui.text(1,114,"Invincibilty: " .. invinci,"#80ff80") end if star > 0 then gui.text(1,196,"Star: " .. star * 4 - (framecount - 3) % 4,"yellow") end if movie.active() then gui.text(1,204,direction) gui.text(1,1,string.format("Frames: %d/%d \nRe-Records: %d", movie.framecount(), movie.length(), movie.rerecordcount())) else gui.text(1,1,"No Movie") end end function smwDrawSpriteInfo() local smwSpriteMaxCount = 12 gui.opacity(.75) local cameraX = memory.readwordsigned(0x7e001a) local cameraY = memory.readwordsigned(0x7e001c) local spriteCount = 0 local colorTable = { "#ffffff", "#ff9090", "#80ff80", "#a0a0ff", "#ffff80", "#ff80ff", "#80ffff" } for id = 0, smwSpriteMaxCount - 1 do local stat = memory.readbyte(0x7e14c8+id) local hOffscreen = (memory.readbyte(0x7e15a0+id) ~= 0) local vOffscreen = (memory.readbyte(0x7e186c+id) ~= 0) local x = memory.readbytesigned(0x7e14e0+id) * 0x100 + memory.readbyte(0x7e00e4+id) local y = memory.readbytesigned(0x7e14d4+id) * 0x100 + memory.readbyte(0x7e00d8+id) local xsub = memory.readbyte(0x7e14f8+id) local ysub = memory.readbyte(0x7e14ec+id) local xspeed = memory.readbyte(0x7e00b6+id) local yspeed = memory.readbyte(0x7e00aa+id) local hOffscreenAlt = (math.abs(cameraX - x + 112) > 176) local vOffscreenAlt = (math.abs(cameraY - y + 88) > 208) if stat ~= 0 then -- not hOffscreen and not vOffscreen then local dispString = string.format("#%02d (%d.%02x, %d.%02x)", id, x, xsub, y, ysub) local colorString = colorTable[1 + id % #colorTable] if not vOffscreenAlt and not hOffscreenAlt then gui.text(math.min(242, math.max(2, 2 + x - cameraX)), math.min(216, math.max(2, -8 + y - cameraY)), string.format("#%02d", id), colorString) end gui.text(172, 36 + spriteCount * 8, dispString, colorString) spriteCount = spriteCount + 1 end end gui.text(254-24, 2, string.format("SPR:%02d", spriteCount)) end function display() -- Shows Input If Keys Are Pressed gui.opacity(1) local table = {} table = joypad.get(1) if table.left then gui.text(20,216,"<") end if table.up then gui.text(28,216,"^") end if table.right then gui.text(36,216,">") end if table.down then gui.text(44,216,"v") end if table.B then gui.text(52,216,"B") end if table.A then gui.text(60,216,"A") end if table.Y then gui.text(68,216,"Y") end if table.X then gui.text(76,216,"X") end if table.L then gui.text(84,216,"L") end if table.R then gui.text(92,216,"R") end if table.start then gui.text(100,216,"S") end if table.select then gui.text(108,216,"s") end end -- [ Cliplua Begins Here ] ---------- local left = true --touching block from left local right = true --touching block from right local bottom = true --for duplicating local walljump = true --walljump help local cornerclip = true --cornerclip help local showbox = true local x1box local y1box local x2box local y2box function ClipLua() UpdateKeys() local xspeed = memory.readbytesigned(0x7E007B) local input=input.get() local lastxcam if xcamc then lastxcam=xcamc else lastxcam=memory.readword(0x7E001A) end local lastycam if ycamc then lastycam=ycamc else lastycam=memory.readword(0x7E001A) end local xcam=memory.readword(0x7E001A) xcamc=memory.readword(0x7E001A) local ycam=memory.readword(0x7E001C) ycamc=memory.readword(0x7E001C) local x1=input.xmouse-(xcam+input.xmouse)%16 local y1=input.ymouse-((ycam+input.ymouse)+1)%16 local x2=x1+15 local y2=y1+15 local nearblock=false local xoffset=lastxcam-xcam local yoffset=lastycam-ycam if Press("rightclick") then if showbox then showbox=false else showbox=true end end gui.transparency(2) if showbox then gui.box(x1-xoffset,y1-yoffset,x2-xoffset,y2-yoffset,"#FFFFFF") else if not y1line then gui.line(0,y1-yoffset,256,y1-yoffset) gui.line(0,y2-yoffset,256,y2-yoffset) end end --This is a grid for the boxes --[[ gui.transparency(2) for i=xcam%16,256,16 do gui.line(256-i,0,256-i,224) gui.line(255-i,0,255-i,224) end for i=ycam%16,224,16 do gui.line(0,223-i,256,223-i) gui.line(0,222-i,256,222-i) end gui.transparency(0) ]]-- if Press("leftclick") then if showbox then if not x1box then x1box=x1 y1box=y1 x2box=x2 y2box=y2 xcambox=xcam ycambox=ycam elseif x1box-xdiff==x1 and y1box-ydiff==y1 then x1box=nil else x1box=x1 y1box=y1 x2box=x2 y2box=y2 xcambox=xcam ycambox=ycam end else if not y1line then y1line=y1 y2line=y2 ycambox=ycam elseif y1line==y1 then y1line=nil else y1line=y1 y2line=y2 ycambox=ycam end end end if showbox==true then y1line=nil else x1box=nil end if y1line then ydiff=ycam-ycambox gui.line(0,y1line-ydiff-yoffset,256,y1line-ydiff-yoffset) gui.line(0,y2line-ydiff-yoffset,256,y2line-ydiff-yoffset) gui.transparency(0) if bottom then gui.text(8,y2line-ydiff+1,y1line+ycambox+15) end end if x1box then xdiff=xcam-xcambox ydiff=ycam-ycambox gui.box(x1box-xdiff-xoffset,y1box-ydiff-yoffset,x2box-xdiff-xoffset,y2box-ydiff-yoffset,"#FFFFFF") gui.transparency(0) --The three values for the box if bottom then gui.text(x2box-xdiff-13-xoffset,y2box-ydiff+1-yoffset,y1box+ycambox+15) end if right then gui.text(x2box-xdiff+2-xoffset,y2box-ydiff-13-yoffset,x1box+xcambox+13) end if left then gui.text(x1box-xdiff-16-xoffset,y2box-ydiff-13-yoffset,x1box+xcambox-14) end end --Duplication help if slot then local yposh=memory.readbyte(0x7E14D4+slot) local xposh=memory.readbyte(0x7E14E0+slot) local yposl=memory.readbyte(0x7E00D8+slot) local xposl=memory.readbyte(0x7E00E4+slot) local ysubpos=memory.readbyte(0x7E14EC+slot) local guiypos=58 local ypositem=yposl+yposh*256 local xpositem=xposl+xposh*256 local all=(ypositem)*16+ysubpos/16 if y1line then nearblock=true elseif x1box and xpositem <= x1box+xcambox+7 and xpositem >= x1box+xcambox+4 then nearblock=true elseif x1box and xpositem >= x1box+xcambox-8 and xpositem <= x1box+xcambox-5 then nearblock=true else nearblock=false end if (bottom and x1box) or (bottom and y1line) then local blockbottom=y1box+ycambox+15 gui.text(210,50,string.format("%d.%02x",ypositem, ysubpos)) j=nil for i = 0,15,3 do all=all-(112-i) if y1box and (all-all%16)/16 == (blockbottom) then j=i end --if y1box then gui.text(100,guiypos+42,string.format("%d %d",(all-all%16)/16,(blockbottom)+1)) end if j==i-3 and (all-all%16)/16 == (blockbottom)-7 and nearblock then if (j/3)%2==0 then if memory.readbyte(0x7E0013)%2==1 then gui.text(236,guiypos,"LEFT","#FF0000") else gui.text(236,guiypos,"RIGHT","#FF0000") end else if memory.readbyte(0x7E0013)%2==0 then gui.text(236,guiypos,"LEFT","#FF0000") else gui.text(236,guiypos,"RIGHT","#FF0000") end end end gui.text(210,guiypos,string.format("%d.%02x",(all-all%16)/16,all%16*16)) guiypos=guiypos+8 end if ypositem > (blockbottom)-8 and ypositem < (blockbottom)+1 and nearblock then if memory.readbyte(0x7E0013)%2==0 then gui.text(236,50,"LEFT","#FF0000") else gui.text(236,50,"RIGHT","#FF0000") end end if ypositem == (blockbottom)-8 and nearblock then if memory.readbyte(0x7E0013)%2==0 then gui.text(236,50,"LEFT","#FF0000") else gui.text(236,50,"RIGHT","#FF0000") end end if ypositem == (blockbottom)-9 and nearblock then if memory.readbyte(0x7E0013)%2==0 then gui.text(236,50,"LEFT","#FF0000") else gui.text(236,50,"RIGHT","#FF0000") end end if ypositem == (blockbottom)-8 and nearblock then if memory.readbyte(0x7E0013)%2==0 then gui.text(236,50,"LEFT","#FF0000") else gui.text(236,50,"RIGHT","#FF0000") end end if ypositem == (blockbottom)-9 and nearblock then if memory.readbyte(0x7E0013)%2==0 then gui.text(236,50,"LEFT","#FF0000") else gui.text(236,50,"RIGHT","#FF0000") end end if ypositem == (blockbottom)-8 or ypositem == (blockbottom)-9 and nearblock then gui.text(236,42,"TOP","#FF0000") end end end if x1box then local xspeed = memory.readbytesigned(0x7E007B) local xsubspeed = memory.readbyte(0x7E007A) local xpos = memory.readword(0x7E0094) local xsubpos = memory.readbyte(0x7E13DA) local allpos = xpos*16 + xsubpos/16 local r = (x1box+xcambox+13)*16 local l = (x1box+xcambox-14)*16 if walljump or cornerclip then gui.text(28,38,xspeed) if xspeed>32 and xpos-8= l+81 and cornerclip then gui.text(8,i*8+50,"CC","#FF0000") end if j==i-1 and tpos-15 >= l+33 and walljump then gui.text(8,i*8+50,"WJ","#FF0000") end gui.text(24,i*8+50,string.format("%d.%02x",(tpos-tpos%16)/16,(tpos%16)*16)) end end if xspeed<(-32) and xpos+8>r/16 then local calpos=allpos while calpos>r do calpos=calpos+xspeed end calpos=calpos+xspeed for i = 0,4 do local tpos=calpos-(4-i)*xspeed if tpos >= r then j=i end if tpos >= r-32 then k=i end if k==i-1 and tpos <= r-81 and cornerclip then gui.text(8,i*8+50,"CC","#FF0000") elseif j==i-1 and tpos <= r-33 and walljump then gui.text(8,i*8+50,"WJ","#FF0000") end gui.text(24,i*8+50,string.format("%d.%02x",(tpos-tpos%16)/16,(tpos%16)*16)) end end end end end gui.register(function() main(slot) end)