Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dragster lua Stepmania-style script by Kirkq
- ---- Written in haste, so the code looks pretty bad. I got a 5.64 (while cheating, so not legit) with this after a couple hours.
- -- For learning or for a Stepmania chart, up to you.
- -- For practice only, times aren't legit if you're using this script live. The script cheats for practice purposes.
- -- If you want to record a video file to play along with, that seems fine to me at least, others' opinions may vary.
- -- If you want to try the input from a video, I'd recommend turning on the "random frame shifter" 3 lines from the bottom and recording a
- -- long video to play in the background.
- -- Having this running on any emulator while you're also playing even on a separate emulator is pretty shady in my opinion.
- -- If you're gonna post a 5.57, make it legit.
- -- To my understanding, the game only reads input every other frame at 60 fps, correct me if I'm wrong.
- -- This means every button must be held two frames. This is why it seems like inputs drop sometimes.
- -- Buttons need held the frame they are on the line, and the frame after.
- -- The practicing of the start sequence may be more useful via audio cues,
- -- but the feedback here with green and red text on the first three shifts is very useful.
- -- The first three shifts are almost everything in achieving a 5.57 vs a 5.61.
- -- The press of the right button keeps you 1/8 frame aligned while the script is running. Reminder: This is for PRACTICE ONLY.
- -- I slid most of the wider frame windows one frame from the end to make them wider.
- -- The first three shifts are extremely tight, most of the rest is 3-5 frame windows.
- -- You can let go of B slightly early on the last hold of left. If you're a frame late you blow your engine.
- -- Review Omni's sheet for frame windows.
- --Button Array
- --L D U R B
- NUM_BUTTONS=5
- NUM_ROWS=300
- NUM_SHOWN=50
- START_FRAME=120
- SHIFT_OFFSET=0 -- Shift one frame prior to sheet
- LEFT=1
- DOWN=2
- UP=3
- RIGHT=4
- B=5
- function printMemoryDomains(x,y)
- local list = {}
- list = memory.getmemorydomainlist()
- local curr = memory.getcurrentmemorydomain()
- local num = table.getn(list)
- local i
- gui.text(x,y,"Current: " .. curr)
- for i=0,num do
- gui.text(x,y + 15*(i+1),list[i])
- end
- end
- --Init Array - Create and zero the array
- --i is buttons
- --j is frame number
- --0 is no hit, 1 is hit
- array = {}
- for i = 1,NUM_BUTTONS do
- array[i] = {}
- for j = -200,NUM_ROWS+200 do
- array[i][j] = 0
- end
- end
- array[RIGHT][START_FRAME - 79 + SHIFT_OFFSET]=1
- --Left is Shift, B is gas
- -- Shift
- array[LEFT][START_FRAME + 0 + SHIFT_OFFSET]=1
- array[LEFT][START_FRAME +15 + SHIFT_OFFSET]=1 -- 3 Frame Window
- array[LEFT][START_FRAME +33 + SHIFT_OFFSET]=1
- array[LEFT][START_FRAME +52 + SHIFT_OFFSET]=1 -- Frame Perfect
- array[LEFT][START_FRAME +81 + SHIFT_OFFSET-1]=1 -- 5 frame window
- array[LEFT][START_FRAME +92 + SHIFT_OFFSET]=1 -- 2 frame window
- array[LEFT][START_FRAME +105 + SHIFT_OFFSET-1]=1 -- 6 frame window
- array[LEFT][START_FRAME +114 + SHIFT_OFFSET-1]=1 -- 7 frame window
- array[LEFT][START_FRAME +123 + SHIFT_OFFSET-1]=1 -- 6 frame window
- array[LEFT][START_FRAME +137 + SHIFT_OFFSET+2]=1 -- 5 frame window
- -- The earlier you go in the frame windows, the more distance you lose. So you need to at least be generally towards the end of them.
- -- The last clutch 5 frame window doesn't affect distance
- --137 to 167 it is required, holding shift freezes your speed, so you no longer have to maintain TACH at all
- for n = 137+2,167 do
- array[LEFT][START_FRAME+ n + SHIFT_OFFSET]=1
- end
- -- Gas
- for n = -3,139 do
- array[B][START_FRAME + n] = 1
- end
- array[B][START_FRAME + 16] = 0 --3 Frame Window
- array[B][START_FRAME + 34] = 0
- --array[B][START_FRAME + 150] = 1
- --array[B][START_FRAME + 158] = 1
- --array[B][START_FRAME + 166] = 1
- --array[B][START_FRAME + 174] = 1
- --array[B][START_FRAME + 182] = 1
- currframe=0
- even = 0
- odd = 1
- textfile = "DragsterDump2"
- dumpfile = textfile..".txt"
- io.output(dumpfile)
- dumpflag=1
- --memory.writebyte(0x01,2,"Main RAM")
- speed2tachs = 999
- speed2frame = 999
- speed2timerB = 999
- speed3tachs = 999
- speed3frame = 999
- speed3timerB = 999
- speed4tachs = 999
- speed4frame = 999
- speed4timerB = 999
- --savestate.loadslot(1)
- memory.writebyte(0x01,0x02,"Main RAM") -- Set frame rule
- while true do
- --memory.writebyte(0x01,7) --Set optimal start
- --memory.writebyte(0x0D,159) --Set optimal start
- --printMemoryDomains(400,400)
- px=memory.readbyte(0x3A,"Main RAM")
- spx=memory.readbyte(0x42,"Main RAM")
- speed=memory.readbyte(0x40,"Main RAM")
- tach=memory.readbyte(0x28,"Main RAM")
- frame=memory.readbyte(0x01,"Main RAM")
- timerA=memory.readbyte(0x33,"Main RAM")
- timerB=memory.readbyte(0x35,"Main RAM")
- countdown=memory.readbyte(0x0D,"Main RAM")
- frame = frame % 16
- gui.text(400,200,"Currframe:" .. currframe)
- gui.text(400,215,"Countdown:" .. countdown)
- gui.text(400,230,"Speed:" .. speed)
- gui.text(400,245,"Tach:" .. tach)
- gui.text(400,260,"Frame:" .. frame)
- gui.text(400,275,"TimerA:" .. timerA)
- gui.text(400,290,"TimerB:" .. timerB)
- gui.text(400,305,px)
- gui.text(400,320,spx/256)
- if countdown == 158 then
- currframe=43
- memory.writebyte(0x01,0x08,"Main RAM") -- Set frame rule
- speed2tachs = 999
- speed2frame = 999
- speed2timerB = 999
- speed3tachs = 999
- speed3frame = 999
- speed3timerB = 999
- speed4tachs = 999
- speed4frame = 999
- speed4timerB = 999
- end
- if speed == 2 then
- speed2tachs=tach --15 or 18
- speed2frame=frame --14
- speed2timerB=timerB --6
- end
- if speed == 32 or speed == 33 then
- speed3tachs=tach --26 or 24
- speed3frame=frame --10
- speed3timerB=timerB --96
- end
- if speed == 70 or speed == 71 then
- speed4tachs=tach --26 or 24
- speed4frame=frame --2
- speed4timerB=timerB --38
- end
- if speed2tachs ~= 999 then
- if (speed2tachs == 15 or speed2tachs == 18) then
- gui.text(400,160,speed2tachs, "green")
- else
- gui.text(400,160,speed2tachs, "red")
- end
- end
- if speed2frame ~= 999 then
- if speed2frame == 10 then
- gui.text(400,175,speed2frame, "green")
- else
- gui.text(400,175,speed2frame, "red")
- end
- end
- if speed2timerB ~= 999 then
- if speed2timerB == 6 then
- gui.text(400,190,speed2timerB, "green")
- else
- gui.text(400,190,speed2timerB, "red")
- end
- end
- if speed3tachs ~= 999 then
- if (speed3tachs == 26 or speed3tachs == 24 or speed3tachs == 23) then
- gui.text(440,160,speed3tachs, "green")
- else
- gui.text(440,160,speed3tachs, "red")
- end
- end
- if speed3frame ~= 999 then
- if speed3frame == 10 then
- gui.text(440,175,speed3frame, "green")
- else
- gui.text(440,175,speed3frame, "red")
- end
- end
- if speed3timerB ~= 999 then
- if speed3timerB == 96 then
- gui.text(440,190,speed3timerB, "green")
- else
- gui.text(440,190,speed3timerB, "red")
- end
- end
- if speed4tachs ~= 999 then
- if (speed4tachs == 26 or speed4tachs == 24) then
- gui.text(480,160,speed4tachs, "green")
- else
- gui.text(480,160,speed4tachs, "red")
- end
- end
- if speed4frame ~= 999 then
- if speed4frame == 2 then
- gui.text(480,175,speed4frame, "green")
- else
- gui.text(480,175,speed4frame, "red")
- end
- end
- if speed4timerB ~= 999 then
- if speed4timerB == 38 then
- gui.text(480,190,speed4timerB, "green")
- else
- gui.text(480,190,speed4timerB, "red")
- end
- end
- --if dumpflag == 1 then
- -- if speed > 0 then
- -- io.write(speed .. " " .. tach .. " " .. frame)
- -- io.write("\n")
- -- end
- -- end
- --gui.text(30,45,"Currframe: " .. currframe)
- basex=20
- basey=100
- flag = 0
- for n=-10,NUM_SHOWN do
- if n==0 then
- --gui.text(basex+0,basey, "-------------------------------")
- gui.text(basex,basey-8, "========================")
- end
- for m=1,NUM_BUTTONS do
- if array[m][currframe+n] == 1 then
- if m == LEFT then
- if array[m][currframe+n-1] == 1 then
- disp = "|"
- else
- disp = "L"
- if n==0 then
- flag = 1
- end
- end
- elseif m == B then
- if array[m][currframe+n-1] == 1 then
- disp = "|"
- else
- disp = "B"
- if n==0 then
- flag = 1
- end
- end
- elseif m == RIGHT then
- disp = "R"
- if n==0 then
- flag = 1
- end
- end
- if even == 1 then
- offset2 = 0
- else
- offset2 = 8
- end
- --if n==0 then
- -- if flag == 1 and even == 1 then
- -- gui.text(basex+0,basey, "-------------------------------", "green")
- -- end
- --end
- if disp ~= "|" then
- gui.text(basex+m*20,basey+n*16+offset2,disp)
- end
- end
- end
- end
- if flag == 1 then
- --for q=1,60 do
- -- gui.text(270,20+q*16,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
- --end
- if even == 1 then
- even = 1
- --os.execute("echo \7") -- Make windows beep, but steal control of window.
- end
- end
- emu.frameadvance()
- -- 60 fps vs 30 fps
- if even == 1 then
- currframe=currframe+1
- even = 0
- odd = 1
- elseif odd == 1 then
- even = 1
- odd = 0
- end
- if currframe > NUM_ROWS then
- dumpflag=0
- --io.output():close()
- currframe=13
- speed2tachs = 999
- speed2frame = 999
- speed2timerB = 999
- speed3tachs = 999
- speed3frame = 999
- speed3timerB = 999
- speed4tachs = 999
- speed4frame = 999
- speed4timerB = 999
- --currframe = math.random(0, 7) -- Slide frame number
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement