--temp swap mode
local winW, winH = get_window_size()
local dFormat = {0,1,2,3,4,5,6,10,7,8,9,11,12,14,16,18,13,15,17,19 }
local jointNS = {"f","b","h","r"}
local gripNS = {[0]="-",[1]="+"}
local r = {1,2}
local js={"",""}
local jsList = {{"4444444444444444444400"}, {"4444444444444444444400"}}
local msList = {{},{}}
local fList = {}
local gfList,mfList = {},{0}
local frame = ""
local fH = {1.8,.72,1,1.2}
local fW = {28,8,11,12}
local swapMode = false
local ftext
local relx, rely
local safeSaveMode = false
local rName = "temp"
local moveMode = false
local adw = .65
local mx, my
local panel = {x = 5,y = winH - 50, w = 55, h = 75, color = {r = .0,g=.0,b=.0,o=1}, VISIBLE =true, dragMode == false, text = "none", font = 1, text2 = "none"}
local ppw = panel.w
local pph = panel.h
panel.w = panel.w *(fW[panel.font+1])
panel.x = winW/2-panel.w/2
panel.h = panel.h *(fH[panel.font+1])
panel.y = winH -(panel.h+35)
local tQuad = {dim = {x = 5, y = 5, w =winW-10, h = 350, r = 0, g = 0, b = 0, o = .99, m =5 },
hColor = {r=.05, g=.0, b=.0, o = 1}, hText = "REPLAY FOLDER:", hFont = 1,
list = {visible = 10, selindex= 1, index=1, elements = {}, indexColor = {r = .1,g =.90,b=.90,o=1}, nonColor = {r=1,g=1,b=1,o=1}}, VISIBLE = false,
menu = {dirList = {"REPLAY", "AUTOSAVE"}}}
local rOrder={"NEWGAME","GAME TYPE","MATCH FRAMES","TURN FRAMES","REACTION TIME",
"","","FLAGS","ENGAGE DISTANCE","DAMAGE",
"SUMO","MOD","","DOJOSIZE","DM TRESHOLD",
"FT TRESHOLD","ENGAGE HEIGHT","","","",
"DOJO TYPE","ENGAGE ROTATION","","ENGAGE SPACE","DQ TIMEOUT",
"","DOJO TYPE","X GRAV","Y GRAV","Z GRAV",
"DQ FLAG","","DRAW WINNER","POINT THRESHOLD","MAX CONTACTS",
"","","","",""}
tQuad.dim.h = (tQuad.list.visible +1)*22
local tReplayInfo = {dim = {x =5, y =tQuad.dim.x+ tQuad.dim.h+5, w = winW-10, h =165, r = 0, g = 0, b = 0, o = .99, m =5 }, hColor = {r=.00, g=.05, b=.0, o = 1}, hText = "SELECTED REPLAY", hFont =1, list = {visible = 10, selindex= 1, index=1, elements = {}, indexColor = {r = 0,g = 1,b=0,o=1}, nonColor = {r=0,g=1,b=0,o=1}}, VISIBLE = true,
buttons = {{text = "Load Replay", x=5, y =1, w = get_string_length("Load Replay", 1)+10, h=25},{ text = "Load Moves", x=5, y =1, w = get_string_length("Load Moves", 1)+10, h =25},{text = "Start SafeSave", x=5, y =1, w = get_string_length("Start SafeSave", 1)+10, h=25},{text = "Unload Script", x=5, y =1, w = get_string_length("Unload Script", 1)+10, h=25}}}
local function brCorner(dim)
local xaxis, yaxis = dim.x + dim.w, dim.y+dim.h
return xaxis, yaxis
end
local function getReplayInfo(rFile)
local f = io.open("./"..tQuad.menu.dirList[1].."/".. rFile, "r", 1)
local wwords = {}
tReplayInfo.list.elements = {}
repeat
line = f:read()
table.insert(tReplayInfo.list.elements, line)
until string.sub(line, 1, 7) == "NEWGAME"
end
local function getDirInfo()
fList = get_files(tQuad.menu.dirList[1], "rpl")
if #fList < tQuad.list.visible then tQuad.list.visible = #fList end
for i = 1,#fList+1 do
tQuad.list.elements[i] = fList[i]
end
tQuad.dim.h = (tQuad.list.visible +1)*22
tReplayInfo.dim.y =tQuad.dim.x+ tQuad.dim.h+5
tReplayInfo .dim.h = ( tReplayInfo .list.visible +1)*22
bottom = {x = 1, y = 1}
tReplayInfo .dim.h = ( tReplayInfo .list.visible +1)*22
bottom.x,bottom.y = brCorner(tReplayInfo.dim)
tReplayInfo. buttons[1].y =bottom.y+5
tReplayInfo.buttons[2].y = bottom.y+5
tReplayInfo.buttons[3].y = bottom.y+5
tReplayInfo. buttons[4].y =bottom.y+5
bottom.x,bottom.y = brCorner(tReplayInfo.buttons[1])
tReplayInfo.buttons[2].x = bottom.x+5
bottom.x,bottom.y = brCorner(tReplayInfo.buttons[2])
tReplayInfo.buttons[3].x = bottom.x+5+20
tReplayInfo.buttons[4].x = tReplayInfo.dim.x + tReplayInfo.dim.w-(tReplayInfo.buttons[4].w +10)
local sort_func = function( a,b ) return a < b end
table.sort( tQuad.list.elements, sort_func )
end
getDirInfo()
local autoMode = true
function formatJointString(s, m)
if string.match(string.sub(s,1,22), "([fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][fbhr][-+][-+])") then
local fbhr=string.sub(s,1,22)
if m== "standard" or m == nil then
fbhr = string.sub(fbhr, 1, 4).." "..string.sub(fbhr, 5, 7).." "..string.sub(fbhr, 8, 10).."("..string.sub(fbhr, 11, 12)..")"..string.sub(fbhr, 13, 14).." "..string.sub(fbhr, 15, 16).." "..string.sub(fbhr, 17, 1
.." "..string.sub(fbhr, 19, 20).." "..string.sub(fbhr, 21, 22)
return fbhr
elseif m == "d" then
local fstring = ""
local ind = 0
for i = 1,5 do
for j = 1, 4 do
ind = ind+1
fstring = fstring..string.sub(fbhr, dFormat[ind]+1, dFormat[ind]+1)
end
if ind == 50 then fstring = fstring .. " ".. string.sub(fbhr, 21,22) .. " " else fstring = fstring .." " end
end
fstring = string.sub(fstring, 1,9).. string.sub(fbhr, 22,22).. string.sub(fstring, 10,14).. string.sub(fbhr, 21,21).. string.sub(fstring, 15,-1)
return fstring
end
end
end
local function hampaFormat(s)
local nstr = ""
for i = 1, 20 do
nstr = nstr .. jointNS[tonumber(string.sub(s, i,i))]
end
nstr = nstr .. gripNS[tonumber(string.sub(s, 21,21))]
nstr = nstr .. gripNS[tonumber(string.sub(s, 22,22))]
return formatJointString(nstr,"d")
end
local function getJS(pl)
local cjs = ""
for i = 0,19 do
cjs = cjs.. get_joint_info(pl,i).state
end
cjs = cjs .. (get_grip_info(pl,12))
cjs = cjs .. (get_grip_info(pl,11))
return cjs
end
local function contains(list, element)
for k,v in pairs(list) do
if v == element then
return true, k
end
end
return false
end
local function handleCommands(cmd)
local wwords = {}
for wword in cmd:gmatch("%S+") do
table.insert(wwords, string.lower(wword))
end
echo("flag")
if wwords[1]=="rem" or wwords[1]=="replaymoves" then
if swapMode == true then r[1]= 2;r[2]= 1 else r[1]= 1; r[2]= 2 end
local toriname, ukename, gmod
local pframe = 0
gfList = {}
mfList = {0}
ftext = selFile
if ftext:sub(-3,-1) ~= "rpl" then ftext = ftext .. ".rpl" end
file = io.open("./".. tQuad.menu.dirList[1].."/"..ftext, "r+",1)
js={"",""}
jsList = {{"4444444444444444444400"}, {"4444444444444444444400"}}
msList = {{},{}}
msList[1][0] = "4444444444444444444400"
msList[2][0] = "4444444444444444444400"
fList = {}
frame = ""
for line in file:lines() do
local words = {}
local c = 1
for word in line:gmatch("%S+") do
table.insert(words, word)
end
if words[1] == "BOUT" and words[2]=="0;" then toriname = words[3] end
if words[1] == "BOUT" and words[2]=="1;" then ukename = words[3] end
if words[1]=="NEWGAME" then
gmod = words[11]
gmf = tonumber(words[2]:sub(3,-1))
for fr in words[3]:gmatch("%d*") do
table.insert(gfList, tonumber(fr))
end
while mfList[#mfList] < gmf do
msList[1][mfList[#mfList]]="xxx"
msList[2][mfList[#mfList]]="xxx"
table.insert(mfList, mfList[#mfList]+gfList[c])
c = c+1
if c > #gfList then c = 1 end
end
end
if words[1]=="FRAME" then
frame = tostring(string.sub(string.match(line, "%d+%;"),1,-2))
if contains(mfList, tonumber(frame))==true then
frame = frame..string.rep(" ", 5-#frame)
table.insert(fList, frame)
js[1] =jsList[1][#jsList[1]]
js[2] =jsList[2][#jsList[2]]
msList[r[1]][pframe] = js[1]
msList[r[2]][pframe] = js[2]
pframe = tonumber(frame)
if tonumber(frame) > 0 then
table.insert(jsList[1], js[1])
table.insert(jsList[2], js[2])
end
end
end
if words[1]=="JOINT" then
p = tostring(words[2]:sub(1,1))+1
for i = 3, #words, 2 do
js[p] = string.sub(js[p], 1, words[i]).. words[i+1] .. string.sub(js[p], words[i]+2,22)
end
jsList[p][#jsList[p]]=js[p]
end
if words[1]=="GRIP" then
p = tostring(words[2]:sub(1,1))+1
local t2 = ""
if words[3] == "1" then t2="1" end
if words[3] == "2" then t2="0" end
if words[3] == "0" then t2 = string.sub(js[p],21,21) end
if words[4] == "1" then t2=t2.."1" end
if words[4] == "2" then t2=t2.."0" end
if words[4] == "0" then t2 = t2..string.sub(js[p],22,22) end
js[p] = string.sub(js[p], 1,20) .. t2
jsList[p][#jsList[p]]=js[p]
end
end
msList[r[1]][pframe] = js[1]
msList[r[2]][pframe] = js[2]
for k,v in pairs(msList[1]) do
if v == "xxx" then
if k>pframe then
table.remove(msList[1], k)
else
local ttt,ix = contains(mfList, k)
msList[1][k] = msList[1][mfList[ix-1]]
end
end
end
for k,v in pairs(msList[2]) do
if v == "xxx" then
if k>pframe then
table.remove(msList[2], k)
else
local ttt,ix = contains(mfList, k)
msList[2][k] = msList[2][mfList[ix-1]]
end
end
end
--echo(gmod)
if gmod:sub(-3,-1) ~= "tbm" then gmod = gmod .. ".tbm" end
run_cmd("lm " .. gmod)
panel.VISIBLE = true
mt =get_world_state().match_turn+1
maf = get_world_state().match_frame
moveMode =true
panel.text = hampaFormat(msList[2][0]).. " " .. hampaFormat(msList[1][0])
if autoMode== true then
pl = get_world_state().selected_player
if get_world_state().game_type == 0 then p1 = 0; p2 = 1 else p1=pl;p2=pl end
for pll = p1, p2 do
for i = 0, 19 do
set_joint_state(pll,i,msList[pll+1][0]:sub(i+1,i+1))
end
set_grip_info(pll, 11, msList[pll+1][0]:sub(22,22))
set_grip_info(pll, 12, msList[pll+1][0]:sub(21,21))
end
end
echo("Moves loaded from a ^08" .. gmod .. " ^03game: ^02" .. toriname .. "^03 vs ^04" .. ukename)
set_ghost(2)
return 1
end
if wwords[1]=="ssa" or wwords[1]=="safesave" then
safeSaveMode = true
if wwords[2] then rName =wwords[2] else rName = "SafeSave" end
echo("Safesaving game as ".. rName .. ".rpl")
return 1
end
end
local function draw_text_al(t, x, y, f, tt,cc)
local xx = x
local tt1, tt2
for i = 0, #t do
if tt then
if moveMode == true then
tt1, tt2 =string.sub(t,i+1,i+1),string.sub(tt,i+1,i+1)
if tt1 == tt2 then set_color(cc[1],cc[2],cc[3],cc[4]) else set_color(.65,0.55,.530,.89) end
end
end
draw_text(string.sub(t,i+1,i+1),xx, y, f)
xx=xx+fW[f+1]
end
end
local function checkClick(x,y, dx,dy,dw,dh)
if x >= dx and x <= dx+dw and y >= dy and y <=dy+dh then return true else return false end
end
local function sc(c)
set_color(c.r, c.g, c.b, c.o)
end
local function drawQuadColor(quad)
local list = quad.list
set_color(quad.dim.r,quad.dim.g,quad.dim.b,quad.di m.o)
draw_quad(quad.dim.x,quad.dim.y,quad.dim.w,quad.di m.h)
set_color(0.75,.75,.75,.99)
draw_quad(quad.dim.x,quad.dim.y,quad.dim.w,22)
set_color(quad.hColor.r, quad.hColor.g,quad.hColor.b, quad.hColor.o)
draw_text(quad.hText, quad.dim.x+quad.dim.m,quad.dim.y+quad.dim.m,quad.h Font)
if quad.menu ~= nil then
set_color(.16, .16,.05,.
draw_text(quad.menu.dirList[1],quad.dim.x+get_string_length(quad.hText, quad.hFont)+quad.dim.m+10, quad.dim.y+quad.dim.m-1, quad.hFont)
end
local count = 22
local sel = 1
for i = list.index, list.index+list.visible-1 do
if list.selindex == sel then
sc(list.indexColor)
draw_text(list.elements[i], quad.dim.x +quad.dim.m, quad.dim.y+count, quad.hFont)
if quad.hText == "REPLAY FOLDER:" then
set_color(.1,.9,.8,.1);
draw_quad(quad.dim.x +quad.dim.m, quad.dim.y+count,winW-10,22)
set_color(.85,.85,.85, 1)
draw_quad(tReplayInfo.buttons[1].x+5, tReplayInfo.buttons[1].y,tReplayInfo.buttons[1].w,tReplayInfo.buttons[1].h)
draw_quad(tReplayInfo.buttons[2].x+5, tReplayInfo.buttons[2].y,tReplayInfo.buttons[2].w,tReplayInfo.buttons[2].h)
draw_quad(tReplayInfo.buttons[3].x+5, tReplayInfo.buttons[3].y,tReplayInfo.buttons[3].w,tReplayInfo.buttons[3].h)
set_color(.85,.05,.05, .65)
draw_quad(tReplayInfo.buttons[4].x+5, tReplayInfo.buttons[4].y,tReplayInfo.buttons[4].w,tReplayInfo.buttons[4].h)
set_color(.05,.05,.05, 1)
draw_text(tReplayInfo.buttons[2].text,tReplayInfo.buttons[2].x+10, tReplayInfo.buttons[2].y+5,1)
draw_text(tReplayInfo.buttons[1].text,tReplayInfo.buttons[1].x+10, tReplayInfo.buttons[1].y+5,1)
draw_text(tReplayInfo.buttons[3].text,tReplayInfo.buttons[3].x+10, tReplayInfo.buttons[3].y+5,1)
set_color(.85,.85,.85, .85)
draw_text(tReplayInfo.buttons[4].text,tReplayInfo.buttons[4].x+10, tReplayInfo.buttons[4].y+5,1)
end
else
sc(list.nonColor)
draw_text(list.elements[i], quad.dim.x +quad.dim.m, quad.dim.y+count, quad.hFont)
end
sel= sel+1
count=count+22
end
end
local function handle2D()
if tQuad.VISIBLE==true then
set_color(tReplayInfo.dim.r,tReplayInfo.dim.g,tRep layInfo.dim.b,tReplayInfo.dim.o)
draw_quad(tReplayInfo.dim.x,tReplayInfo.dim.y,tRep layInfo.dim.w,tReplayInfo.dim.h+40)
drawQuadColor(tQuad)
drawQuadColor(tReplayInfo)
end
if moveMode ~= true then
panel.text2 = hampaFormat(getJS(1)).. " " .. hampaFormat(getJS(0))
elseif moveMode == true then
panel.text2 = hampaFormat(getJS(1)).. " " .. hampaFormat(getJS(0))
end
if panel.VISIBLE == true then
local c=panel.color
local d = panel
set_color(c.r,c.g,c.b,c.o)
if moveMode == true then adw=.99 ;adh = 0 else adw = .65;adh = 12 end
draw_quad(d.x,d.y+adh,d.w,d.h*adw)
set_color(.5,.5,.5,1)
draw_quad(d.x+2,d.y+2+adh,d.w-4,10)
if panel.dragMode == true then set_color(.9,.8,0,1) else set_color(.5,0.5,0.5,.
end
draw_quad(d.x+2,d.y+2+adh,10,10)
if moveMode ~= true then
ad = 20 *(fH[panel.font+1])
set_color(0.45,.45,0.9,.9)
draw_text_al(d.text2:sub(1,#d.text2/2), d.x+2,d.y+ad+adh,panel.font)
set_color(1,0.25,.25,1)
draw_text_al(d.text2:sub(#d.text2/2+1,-1), d.x+d.w/2,d.y+ad+adh,panel.font)
elseif moveMode == true then
ad = 20 *(fH[panel.font+1])
set_color(0.45,.45,0.9,.9)
draw_text_al(d.text:sub(1,#d.text/2), d.x+2,d.y+ad+adh,panel.font)
set_color(1,0.25,.25,1)
draw_text_al(d.text:sub(#d.text/2+1,-1), d.x+d.w/2,d.y+ad+adh,panel.font)
ad = 24*2* (fH[panel.font+1])
draw_text_al(d.text2:sub(1,#d.text2/2), d.x+2,d.y+ad+adh,panel.font, d.text:sub(1,#d.text/2) ,{.35,.35,1,1})
draw_text_al(d.text2:sub(#d.text2/2,-1), d.x+d.w/2,d.y+ad+adh,panel.font, d.text:sub(#d.text/2,-1),{1,0.35,.35,1})
end
if checkClick(mx, my, d.x-25,d.y+12+adh,d.w/2+25,d.h) then
set_color(0,0,0.9,.9)
draw_quad(d.x-25,d.y+adh,25,d.h*adw)
end
set_color(.69,0,0,.9)
if checkClick(mx, my, d.x+d.w/2,d.y+12+adh,d.w/2+25,d.h) then
draw_quad(d.x+d.w,d.y+adh,25,d.h*adw)
end
end
end
function unload()
run_cmd("clear")
echo("Respar.lua is unloaded.")
--save any data
--remove any overrides
end
--called when the game loads another script.
local function handleMouseDown(b,x,y)
if tQuad.VISIBLE == true then
if b == 1 then
local b1, b2,b3,b4 = tReplayInfo.buttons[1],tReplayInfo.buttons[2] ,tReplayInfo.buttons[3] ,tReplayInfo.buttons[4]
if x > b1.x and x < b1.x+b1.w and y > b1.y and y < b1.y+b1.h then
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
--echo(selFile)
tQuad.VISIBLE = false
set_option("timer", 1)
if tQuad.menu.dirList[1] == "REPLAY" then
moveMode = false
run_cmd("lr "..selFile)
end
elseif x > b2.x and x < b2.x+b2.w and y > b2.y and y < b2.y+b2.h then
local shiftState = get_shift_key_state()
if shiftState == 1 or shiftState == 2 then swapMode = true else swapMode = false end
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
--echo(selFile)
tQuad.VISIBLE = false
set_option("timer", 1)
handleCommands("rem " .. selFile)
return 1
elseif x > b3.x and x < b3.x+b2.w and y > b3.y and y < b3.y+b3.h then
handleCommands("ssa safesave")
tQuad.VISIBLE = false
set_option("timer", 1)
return 1
elseif x > b4.x and x < b4.x+b4.w and y > b4.y and y < b4.y+b4.h then
set_option("timer", 1)
run_cmd("ls unloadscripts.lua")
end
end
if mx>tQuad.dim.x and mx<tQuad.dim.x+tQuad.dim.w and my > tQuad.dim.y and my<tQuad.dim.y+tQuad.dim.h then
--echo(mx .. " " .. my)
if b==4 then
if tQuad.list.selindex > 1 then
tQuad.list.selindex = tQuad.list.selindex -1
elseif tQuad.list.index > 1 then
tQuad.list.index = tQuad.list.index -1
end
elseif b==5 then
if tQuad.list.selindex < tQuad.list.visible then
tQuad.list.selindex = tQuad.list.selindex+1
elseif tQuad.list.index+tQuad.list.selindex < #tQuad.list.elements+1 then
tQuad.list.index = tQuad.list.index +1
end
end
local selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
end
end
if panel.VISIBLE == true then
local p = panel
if b == 1 and checkClick(x,y, p.x, p.y+adh, 10,10)==true then
elseif b == 1 and checkClick(x,y, p.x, p.y+adh, p.w,10)==true then
panel.dragMode = true
relx = x - p.x
rely = y - p.y
elseif b == 1 and checkClick(x, y, panel.x-25,panel.y+12+adh,panel.w/2+25,panel.h) then
local ppl = 1
for i = 0, 19 do
set_joint_state(ppl,i,msList[ppl+1][maf]:sub(i+1,i+1))
end
set_grip_info(ppl, 11, msList[ppl+1][maf]:sub(22,22))
set_grip_info(ppl, 12, msList[ppl+1][maf]:sub(21,21))
set_ghost(2)
elseif b == 1 and checkClick(x, y, panel.x+panel.w/2,panel.y+12+adh,panel.w/2+25,panel.h) then
local ppl = 0
for i = 0, 19 do
set_joint_state(ppl,i,msList[ppl+1][maf]:sub(i+1,i+1))
end
set_grip_info(ppl, 11, msList[ppl+1][maf]:sub(22,22))
set_grip_info(ppl, 12, msList[ppl+1][maf]:sub(21,21))
set_ghost(2)
end
end
end
local function handleMouseUp(b,x,y)
if b == 1 and panel.dragMode == true then panel.dragMode =false end
local p = panel
--echo(b .. " " .. x .. " " .. y)
if b == 3 and checkClick(x,y, p.x, p.y+adh, p.w,p.h)==true then
if tQuad.VISIBLE==false then
getDirInfo()
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
tQuad.VISIBLE = true
set_option("timer", 0)
else
tQuad.VISIBLE = false
set_option("timer", 1)
end
end
end
local function handleMouseMove(x,y)
mx, my = x, y
if panel.dragMode == true then panel.x = x - relx; panel.y = y - rely end
end
local function handleFreeze()
mt =get_world_state().match_turn +1
maf = get_world_state().match_frame
if moveMode == true then
if msList[1][maf]== nil or msList[1][maf]=="xxx" then moveMode = false;echo("All recorded moves have been played.") end
if moveMode == true then
set_ghost(0)
pl = get_world_state().selected_player
if get_world_state().game_type == 0 then p1 = 0; p2 = 1 else p1=pl;p2=pl end
for ppl = p1, p2 do
for i = 0, 19 do
set_joint_state(ppl,i,msList[ppl+1][maf]:sub(i+1,i+1))
end
set_grip_info(ppl, 11, msList[ppl+1][maf]:sub(22,22))
set_grip_info(ppl, 12, msList[ppl+1][maf]:sub(21,21))
end
panel.text = hampaFormat(msList[2][maf]).. " " .. hampaFormat(msList[1][maf])
panel.text2 = hampaFormat(getJS(1)).. " " .. hampaFormat(getJS(0))
end
set_ghost(2)
end
if safeSaveMode == true then run_cmd("savereplay".. " " .. rName) end
end
function handleKeyUp(key)
local shiftState = get_shift_key_state()
if shiftState == 2 then
echo(key)
else
if key == 283 then
handleCommands("ssa safesave")
end
if key == 282 then
if tQuad.VISIBLE == true then
tQuad.VISIBLE = false
set_option("timer",1)
else
getDirInfo()
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
tQuad.VISIBLE = true
set_option("timer",0)
end
elseif tQuad.VISIBLE == true then
if key == 269 or key == 273 then
if tQuad.list.selindex > 1 then
tQuad.list.selindex = tQuad.list.selindex -1
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
elseif tQuad.list.index > 1 then
tQuad.list.index = tQuad.list.index -1
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
end
return 1
elseif key == 270 or key == 274 then
if tQuad.list.selindex < tQuad.list.visible then
tQuad.list.selindex = tQuad.list.selindex+1
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
return 1
elseif tQuad.list.index+tQuad.list.visible < #tQuad.list.elements then
tQuad.list.index = tQuad.list.index +1
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
getReplayInfo(selFile)
end
return 1
elseif key == 92 then
selFile = tQuad.list.elements[tQuad.list.index + tQuad.list.selindex -1]
--echo(selFile)
tQuad.VISIBLE = false
set_option("timer", 1)
handleCommands("rem " .. selFile)
return 1
end
end
end
end
local function handleKeyDown(key)
if key == 273 or key == 274 then
if tQuad.VISIBLE == true then
return 1
end
end
end
local function console(s, t)
end
local function handleEnd()
if moveMode == true then moveMode = false end
if safeSaveMode == true then
safeSaveMode = false
echo(rName .. ".rpl saved in your replay folder.")
echo("____________________________")
echo("Press F1, or right click the Joint Panel for more options.")
--echo("reSpar.lua by Daanando")
end
end
local function new()
if safeSaveMode == true then
safeSaveMode = false
echo(rName .. ".rpl saved in your replay folder.")
echo("____________________________")
echo("Press F1, or right click the Joint Panel for more options.")
--echo("reSpar.lua by Daanando")
end
end
run_cmd("clear")
echo("Press F1, or right click the Joint Panel for more options.")
echo("reSpar.lua by ^30Daanando.")
add_hook("command", "userCommands", handleCommands)
add_hook("draw2d", "userGraphics", handle2D )
add_hook("mouse_button_down", "userInput", handleMouseDown)
add_hook("mouse_button_up", "userInput", handleMouseUp)
add_hook("mouse_move", "userInput", handleMouseMove)
add_hook("enter_freeze", "updateStuff", handleFreeze)
add_hook("enter_frame", "updateStuff", handleFrames)
add_hook("joint_select", "updateStuff", handleJointSelect)
add_hook("key_up", "updateStuff", handleKeyUp)
add_hook("key_down", "updateStuff", handleKeyDown)
add_hook("console","cleanup", console)
add_hook("end_game", "cleanup", handleEnd)
add_hook("match_begin", "init", new)
add_hook("unload", "", unload)