So if you find this useful or run into any problems, feel free to leave your comment here.
- {l Code}: {l Select All Code}
// playdmo menu by Bonifarz
dmofile = ""
dmospeed = "100"
ffwtime = "10"
dmomark = "0"
dmomarks = "0"
dmomarkm = "0"
time0 = ""
dmotail = "0"
resetdemo = [
demo $dmofile
time0 = (getmillis)
sleep 100 [
showgui dmo
]
]
ffwdemo = [
dmopaused = $sv_gamepaused
sv_gamepaused 0
sv_gamespeed 10000
sleep ( $arg1 ) [
sv_gamespeed $dmospeed
sv_gamepaused $dmopaused
]
]
newgui pickdmo [
guitext "Select a demo file: ^fg"
guibar
loopfiles fn demos dmo [
guibutton $fn [
dmofile = @fn
resetdemo
]
]
]
newgui dmo [
guistayopen [
if (> (strlen $dmofile) 0) [
guibar
guilist [
if (> $sv_gamepaused 0 )[
guitext "^f(textures/checkboxon)"
guibutton " paused " [
sv_gamepaused 0
dmopaused = $sv_gamepaused
]
] [
guitext "^f(textures/checkbox)"
guibutton " paused " [
sv_gamepaused 1
dmopaused = $sv_gamepaused
]
]
guitext " speed "
guifield dmospeed 3 [ sv_gamespeed $dmospeed]
guitext " %"
dmotime = (- (getmillis ) $time0 )
guibutton (concatword " ^f(textures/modes/timetrial) "(timestr $dmotime) ) [
dmomark = $dmotime
dmomarks = (divf $dmotime 1000)
dmomarkm = (div $dmomarks 60)
dmomarks = (-f $dmomarks (* dmomarkm 60) )
]
guibutton " ^f(textures/warning)restart " [
resetdemo
]
guibutton " ^f(textures/menu)browse demos" [
showgui pickdmo
]
]
guibar
guilist [
guibutton "^f(textures/modes/jetpack)skip " [
// ffwdemo (getalias ffwtime)
ffwdemo (*f $ffwtime 1000)
]
guifield ffwtime 3
guitext " seconds "
// debug: guitext (timestr $dmomark)
guibutton "or jump to " [
if (< $dmotime $dmomark) [
ffwdemo (-f $dmomark $dmotime)
]
]
guifield dmomarkm 2 [
dmomark = (*f (+f (*f $dmomarkm 60) $dmomarks ) 1000)
]
guitext " m "
guifield dmomarks 6 [
dmomark = (*f (+f (*f $dmomarkm 60) $dmomarks ) 1000)
]
guitext " s"
if (> $dmotime $dmomark) [
guibutton " (needs restart)" [ resetdemo ]
]
]
guibar
guilist [
guitext "gui options:"
guibutton "^f(textures/player)hide for a second to switch targets" [
cleargui
dmopaused = $sv_gamepaused
sv_gamepaused 0
sleep 1000 [
showgui dmo
sv_gamepaused $dmopaused
]
]
guibutton " ^f(textures/hud/arrow)move up " [
dmotail = (+ $dmotail 3)
]
guibutton " ^f(textures/action)center " [
dmotail = 0
]
]
guibar
// some empty lines to push this gui a bit upwards, such that we can see something ;)
loop i $dmotail [
guilist [ guitext " " ]
]
] [ // else: no dmofile picked yet
showgui pickdmo
]
]
]
showgui dmo