//pseudo demo editor by Salatiel#5274 //many of these ideas were given by members from Sauerworld Discord ( https://discord.gg/012c19bkwljlWsh3y ) //V 15/10/2019 guiitemmove = [ guialign $arg1 [ guistrut @arg2 guilist [ guistrut @arg3 @arg4 ] ] ] demoeditor = [ showgui demomanage ] //valid numbers from 0-60 dmm_valids = 0 loop validn 60 [ dmm_valids = (concatword $dmm_valids $validn) ] //remove special characters dmm_fixstr = [ $arg1 = (strreplace $dmm_projectname "^"" \"") //don't ask me why $arg1 = (strreplace $dmm_projectname " " "-") $arg1 = (strreplace $dmm_projectname "^n" "") $arg1 = (strreplace $dmm_projectname "^t" "") ] if (=s (getalias dmm_minutes) "")[dmm_minutes = 9] if (=s (getalias dmm_seconds) "")[dmm_seconds = 35] if (=s (getalias dmm_demoname) "")[dmm_demoname = ""] dmm_goto = [ gamespeed 1000 if (!= $arg1 "")[dmm_goingto = $arg1] if (> $dmm_goingto $timeremaining)[ if (=s $dmm_demoname "")[ echo "^f7You can't travel backwards without setting the demo name." clearsleep gamespeed 100 pausegame 1 ] [ demo $dmm_demoname clearsleep sleep 1 [dmm_goto] ] ] [ if (!= $timeremaining $dmm_goingto)[ sleep 1 [dmm_goto] ] [ pausegame 1 echo "^f7Done, game paused." gamespeed 100 ] ] ] dmm_showlist = 1 dmm_gettimeline = [ dmm_ct = 0 dmm_ct2 = 0 guitab "^f7Timeline" guititle ""; guiitemmove -1 0 -1 [guitext "^f4[-----------------------------------]" 0] looplist curcmd $(concatword $dmm_projectname "_dmm_actionslistCMD") [ curtime = (at $(concatword $dmm_projectname "_dmm_actionslistTIME") $dmm_ct) if (> $curtime $timeremaining)[dmm_statecolor = "^f0"] if (< $curtime $timeremaining)[dmm_statecolor = "^f4"] if (= $curtime $timeremaining)[dmm_statecolor = "^f6"] guiitemmove -1 (divf $curtime 30) -1 [ guibutton (concatword $dmm_statecolor "|") [] 0 ] dmm_ct = (+ $dmm_ct 1) ] guiitemmove -1 (-f (divf $timeremaining 30) 0.95) -1 [guitext "^f5<]" 0] guiitemmove -1 (-f (divf $timeremaining 30) 1.5) -1.7 [guititle (concatword "^f5" (timeremaining 1))] guialign 0 [ if (!= $dmm_actionrun 1)[ if (> (strlen (getalias (concatword $dmm_projectname "_dmm_actionslistCMD"))) 0)[ guibutton "Run actions" [clearsleep; dmm_actionexec; pausegame 0] checkbox_off ] [ guibutton "^f4Run actions" [echo "^f7Add some actions."] ] ] [ guibutton "^f2Stop actions" [dmm_actionrun = 0; clearsleep; pausegame 1] checkbox_on; ] ] if (&& (= $paused 0) (= $dmm_actionrun 0))[ guitextbox "the game is running but actions are disabled..." 20 ] if (&& (= $paused 1) (= $dmm_actionrun 1))[ guitextbox "the actions are enabled but the game is paused..." 20 ] guibar guialign 1 [guibitfield "^f7Show list" dmm_showlist 1] if (dmm_showlist)[ looplist curcmd $(concatword $dmm_projectname "_dmm_actionslistCMD") [ curtime = (at $(concatword $dmm_projectname "_dmm_actionslistTIME") $dmm_ct2) if (> $curtime $timeremaining)[dmm_statecolor = "^f0"] if (< $curtime $timeremaining)[dmm_statecolor = "^f4"] if (= $curtime $timeremaining)[dmm_statecolor = "^f6"] guialign 1 [ guitext (format "^f7[%1%2^f7] ^f1%3:%4" $dmm_statecolor $curcmd (div $curtime 60) (mod $curtime 60)) 0 guibar guibutton "" [ (concatword $dmm_projectname "_dmm_actionslistTIME") = (listsplice $(concatword $dmm_projectname "_dmm_actionslistTIME") "" @dmm_ct2 1) (concatword $dmm_projectname "_dmm_actionslistCMD") = (listsplice $(concatword $dmm_projectname "_dmm_actionslistCMD") "" @dmm_ct2 1) ] exit ] dmm_ct2 = (+ $dmm_ct2 1) ] ] ] dmm_actionexec = [ if (=s $dmm_projectname "")[echo "^f7Insert a project name first."] [ dmm_actionrun = 1 loop cmd (listlen $(concatword $dmm_projectname "_dmm_actionslistCMD")) [ if (= $cmd (- (listlen $(concatword $dmm_projectname "_dmm_actionslistCMD")) 1))[ sleep 1000 [dmm_actionexec] ] if (= $timeremaining (at $(concatword $dmm_projectname "_dmm_actionslistTIME") $cmd))[ dmm_lastusedframe = $timeremaining do (at $(concatword $dmm_projectname "_dmm_actionslistCMD") $cmd) ] ] ] ] dmm_actionrun = 0 if (=s (getalias mymovie_dmm_actionslistCMD) "") [mymovie_dmm_actionslistCMD = ""] if (=s (getalias mymovie_dmm_actionslistTIME) "") [mymovie_dmm_actionslistTIME = ""] if (=s (getalias demomanage_actions) "") [demomanage_actions = ""]; if (=s (getalias dmm_projectname) "")[ dmm_projectname = "mymovie"; ] if (=s (getalias (concatword $dmm_projectname "_dmm_actionslistCMD")) "")[ (concatword $dmm_projectname "_dmm_actionslistCMD") = "" ] dmm_addactionlist = [ if (=s $dmm_projectname "")[echo "^f7Insert a project name first."] [ (concatword $dmm_projectname "_dmm_actionslistCMD") = (concatword $(concatword $dmm_projectname "_dmm_actionslistCMD") " ^"" $arg1 "^"") (concatword $dmm_projectname "_dmm_actionslistTIME") = (concatword $(concatword $dmm_projectname "_dmm_actionslistTIME") " ^"" $arg2 "^"") echo (concatword "^f7new action set to ^f0" $dmm_projectname " ^f7in ^f0" $dmm_minutes ":" $dmm_seconds "^n^f7>" $(concatword $dmm_projectname "_dmm_actionslistCMD")) //echo $(concatword $dmm_projectname "_dmm_actionslistTIME") ] ] newgui demomanage [ guilist [guistrut 25] guistayopen [ if (|| (= $timeremaining 0) (= $isconnected 0))[ clearsleep; guitext "timeline unavailable^nin this mode" ] [ guititle (concatword "^f0" (timeremaining 1)) ] guititle "" guialign 0 [ guifield dmm_minutes -5 [ if (> $dmm_minutes 9)[dmm_minutes = 9] if (|| (< $dmm_minutes 0) (=s $dmm_minutes ""))[dmm_minutes = 0] if (= (strstr 0123456789 $dmm_minutes) -1)[echo "^f7Only numbers from 0 to 9 are allowed here."; dmm_minutes = 0] ] guibar guifield dmm_seconds -5 [ if (> $dmm_seconds 59)[dmm_seconds = 0 ; if (< $dmm_minutes 9)[dmm_minutes = (+ $dmm_minutes 1)][dmm_minutes = 9 ; dmm_seconds = 59]] if (|| (< $dmm_seconds 0) (=s $dmm_seconds ""))[dmm_seconds = 0] if (= (strstr $dmm_valids $dmm_seconds) -1)[echo "^f7Only numbers from 0 to 60 are allowed here."; dmm_seconds = 0] ] ] guialign 0 [guibutton (concatword "jump to " $dmm_minutes ":" $dmm_seconds) [pausegame 0; dmm_goto (+ (* $dmm_minutes 60) $dmm_seconds)] 0] guibar guialign -1 [guitext "Project name^f7* " 0] guifield dmm_projectname -15 [ dmm_fixstr dmm_projectname if (> (strlen $dmm_projectname) 0)[ if (=s (getalias (concatword $dmm_projectname "_dmm_actionslistCMD")) "")[ echo (concat "^f7A new project has been created:^f0" $dmm_projectname) (concatword $dmm_projectname "_dmm_actionslistCMD") = ""; (concatword $dmm_projectname "_dmm_actionslistTIME") = ""; ] [ echo (concat "^f7A previous project was loaded:^f0" $dmm_projectname) ] ] ] guialign -1 [guitext "Demo name^f7* " 0] guifield dmm_demoname -15 [] guialign -1 [ if (> (strlen (getalias (concatword $dmm_projectname "_dmm_actionslistCMD"))) 0)[ guibutton "^f7clear all actions" [ echo (concatword "^f7" (listlen $(concatword $dmm_projectname "_dmm_actionslistCMD")) " action(s) have been cleared from the project: ^f0" $dmm_projectname) (concatword $dmm_projectname "_dmm_actionslistCMD") = [] (concatword $dmm_projectname "_dmm_actionslistTIME") = [] ] exit ] [ guibutton "^f4clear all actions" [echo "^f7There is no actions to clear."] exit ] guibar guibutton "^f7Save/Load" [showgui dmm_share] arrow_fw ] guialign -1 [guitext "Action: " 0] guialign 0 [guieditor $demomanage_actions 20 5] guialign 0 [ guibutton (concatword "^f0> ^f7add action to " $dmm_minutes ":" $dmm_seconds)[ textfocus $demomanage_actions; if (=s $textshow "")[echo "^f7Missing action."] [ dmm_addactionlist $textshow (+ (* $dmm_minutes 60) $dmm_seconds) ] ] 0 ] if (> (strlen $dmm_projectname) 0)[ if (> (listlen $(concatword $dmm_projectname "_dmm_actionslistCMD")) 0)[ if (|| (= $timeremaining 0) (= $isconnected 0))[][ dmm_gettimeline ] ] ] ] ] "^f7Demo Editor" newgui dmm_share [ if (=s (getalias dmm_share_name) "")[dmm_share_name = (concatword $dmm_projectname ".cfg")] guistayopen [ guialign -1 [ guititle "^f7File: " guifield dmm_share_name -15 [ if (> (strlen $dmm_share_name) 0)[if (= (strstr $dmm_share_name ".") -1)[dmm_share_name = (concatword $dmm_share_name ".cfg")]] ] ] guialign -1 [ guibutton "^f0> ^f7Import actions" [ if (= (strstr $dmm_share_name "/") -1)[ exec (concatword "demoeditor/" $dmm_share_name) ] [exec $dmm_share_name] ] 0 ] guialign -1 [ guibutton "^f0> ^f7Export actions" [ textfocus dmm_share_project if (=s $textshow "")[ echo "^f7Could not save your actions, try again" ] [ textsave (concatword "demoeditor/" $dmm_share_name) echo (concatword "^f7Project saved in demoeditor/" $dmm_share_name) ] ] 0 ] guialign -1 [ guibutton "^f0> ^f7Send to maptitle" [ textfocus dmm_share_project maptitle $textshow ] 0 ] guialign -1 [guibutton "^f7back" [showgui demomanage] arrow_bw] dmm_share_cmd = $(concatword $dmm_projectname "_dmm_actionslistCMD") dmm_share_time = $(concatword $dmm_projectname "_dmm_actionslistTIME") dmm_share_project = (concatword "echo [^f7new project imported: ^f0" $dmm_projectname " ^f7with " (listlen $dmm_share_cmd) " actions.]^n" (concatword $dmm_projectname "_dmm_actionslistCMD") " = [" $dmm_share_cmd "]^n" (concatword $dmm_projectname "_dmm_actionslistTIME") " = [" $dmm_share_time "]") guiitemmove -1 -500 0 [guifield dmm_share_project 1] ] ] "^f7Import & Export"