Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DuelScript by Chaos and srbs
- // (C) 2011 David "srbs" Forrest & Chaos, ZLIB license
- // somerandombystander (at) gmail (dot) com
- // sauerchaos (at) gmail (dot) com
- // http://www.opensource.org/licenses/zlib-license.php
- // Key Bind:
- bind L [ showgui duel ]
- // Defaults:
- createine = [ if (=s (getalias $arg1) "") [ $arg1 = $arg2 ] ]
- createine _ds_ifw "Winning by"
- createine _ds_ifl "Losing by"
- createine _ds_ift "Tied!"
- createine _ds_delay 3
- createine _ds_opts 30
- createine _ds_stats_gh 126
- createine _ds_stats_dgh 0
- createine _ds_col_w 0
- createine _ds_col_l 3
- createine _ds_col_t 1
- createine _ds_col_f 1
- createine _ds_col_c 7
- createine _ds_col_txt 1
- createine _ds_col_stats 3
- createine _ds_col_clock 7
- _ds_go = 0
- _ds_color = [ result (concatword "^f" $arg1) ]
- // GUI:
- newgui duel [
- guititle "^f2DuelScript Manager"
- guibar
- guilist [
- guilist [
- guitext (concatword (_ds_color $_ds_col_w) "Text if winning: ") 0
- guitext (concatword (_ds_color $_ds_col_l) "Text if losing: ") 0
- guitext (concatword (_ds_color $_ds_col_t) "Text if tied: ") 0
- ]
- guilist [
- guifield _ds_ifw 20 [ echo "^f7Text if winning set to:" (concatword (_ds_color $_ds_col_w) $_ds_ifw) ]
- guifield _ds_ifl 20 [ echo "^f7Text if losing set to:" (concatword (_ds_color $_ds_col_l) $_ds_ifl) ]
- guifield _ds_ift 20 [ echo "^f7Text if tied set to:" (concatword (_ds_color $_ds_col_t) $_ds_ift) ]
- ]
- ]
- guibar
- guilist [
- guibitfield "Enable Auto-Start" _ds_opts 16
- if (! (& $_ds_opts 16)) [
- guibar
- guistayopen [
- guibutton (concatword "Script is " (? $_ds_go "^f7On/^f~^f4Off" "^f4On^f~^f7/Off")) [ _ds_go = (! $_ds_go) ]
- ]
- ]
- ]
- guitab "Options"
- guilist [
- guitext "^f2Continuous Echo: " 0
- guibitfield "Enable" _ds_opts 1
- ]
- if (& $_ds_opts 1) [
- guilist [
- guitext "Interval (seconds): " 0
- guifield _ds_delay 2 [ echo (concatword "^f7Interval between echos set to^f~ ^f1" $_ds_delay "^f~ ^f7seconds.^f~") ]
- ]
- ]
- guibar
- guilist [
- guitext "^f2Echo on Keystroke: " 0
- newbinds = (searchbinds "echo (_ds_getduelstatus)")
- guikeyfield newbinds -8 [
- looplist i (searchbinds "echo (_ds_getduelstatus)") [ bind $i "" ]
- looplist i $newbinds [ bind $i "echo (_ds_getduelstatus)" ]
- ]
- ]
- guibar
- guilist [
- guitext "^f2Duel Gamehud: " 0
- guibitfield "Enable" _ds_opts 2
- if (& $_ds_opts 2) [
- guibar
- guibutton "Configure" [ showgui dgconfig ]
- ]
- ]
- if (! (& $_ds_opts 16)) [
- guibar
- guilist [
- guitext "^f2Toggle On/Off: " 0
- newerbinds = (searchbinds "_ds_go = (! $_ds_go)")
- guikeyfield newerbinds -8 [
- looplist i (searchbinds "_ds_go = (! $_ds_go)") [ bind $i "" ]
- looplist i $newerbinds [ bind $i "_ds_go = (! $_ds_go)" ]
- ]
- ]
- ]
- guitab "Stats"
- guitext "^f2Normal Gamehud Options: " 0
- guibitfield "Show Time Left" _ds_stats_gh 64
- guibitfield "Show Name" _ds_stats_gh 1
- guibitfield "Show Frags" _ds_stats_gh 2
- guibitfield "Show Deaths" _ds_stats_gh 4
- guibitfield "Show Acc" _ds_stats_gh 8
- guibitfield "Show KpD" _ds_stats_gh 16
- guibitfield "Show Flags" _ds_stats_gh 32
- guibar
- guibutton "_ds_color Configuration" [ showgui _ds_colgui_b ]
- guitab "About"
- guitext "Created and Developed by ^f6Chaos^f~ and ^f6srbs^f~." 0
- guibar
- guialign 0 [
- guitextbox "Questions or Comments? Visit us on IRC at ^f6#sauer-scripts^f~ on gamesurge.net, or post a comment online at ^f6http://quadropolis.us/node/2979^f~." 30
- ]
- ] "Duel"
- newgui dgconfig [
- guitext "^f2Duel Gamehud Options: " 0
- guibitfield "Show Time Left" _ds_opts 8
- guibitfield "Show Difference" _ds_opts 4
- guibitfield "Show Name" _ds_stats_dgh 1
- guibitfield "Show Frags" _ds_stats_dgh 2
- guibitfield "Show Deaths" _ds_stats_dgh 4
- guibitfield "Show Acc" _ds_stats_dgh 8
- guibitfield "Show KpD" _ds_stats_dgh 16
- guibitfield "Show Flags" _ds_stats_dgh 32
- guibar
- guibutton "_ds_color Configuration" [ showgui _ds_colgui_a ]
- ] "Duelhud"
- _ds_colrad = [
- guiradio "Green" $arg1 0
- guiradio "Blue" $arg1 1
- guiradio "Yellow" $arg1 2
- guiradio "Red" $arg1 3
- guiradio "Grey" $arg1 4
- guiradio "Purple" $arg1 5
- guiradio "Orange" $arg1 6
- guiradio "White" $arg1 7
- ]
- newgui _ds_colgui_a [
- guitext (concatword (_ds_color $_ds_col_w) "Winning Text:") 0
- _ds_colrad _ds_col_w
- guitab "Losing"
- guitext (concatword (_ds_color $_ds_col_l) "Losing Text:") 0
- _ds_colrad _ds_col_l
- guitab "Tied"
- guitext (concatword (_ds_color $_ds_col_t) "Tied Text:") 0
- _ds_colrad _ds_col_t
- if (& $_ds_opts 4) [
- guitab "Difference"
- guitext (concatword (_ds_color $_ds_col_f) "Frag Difference:") 0
- _ds_colrad _ds_col_f
- ]
- if (& $_ds_opts 8) [
- guitab "Clock"
- guitext (concatword (_ds_color $_ds_col_c) "Clock:") 0
- _ds_colrad _ds_col_c
- ]
- ] "Winning"
- newgui _ds_colgui_b [
- guitext (concatword (_ds_color $_ds_col_txt) "Text:") 0
- _ds_colrad _ds_col_txt
- guitab "Numbers"
- guitext (concatword (_ds_color $_ds_col_stats) "Numbers:") 0
- _ds_colrad _ds_col_stats
- guitab "Clock"
- guitext (concatword (_ds_color $_ds_col_clock) "Clock:") 0
- _ds_colrad _ds_col_clock
- ] "Text"
- // Helper Functions:
- _ds_getduelstatus = [
- if $_ds_go [
- if (> (getfrags) (getdeaths)) [
- result (concatword (_ds_color $_ds_col_w) $_ds_ifw " " (_ds_color $_ds_col_f) (? (& $_ds_opts 4) (- (getfrags) (getdeaths))))
- ] [
- if (= (getfrags) (getdeaths)) [
- result (concatword (_ds_color $_ds_col_t) $_ds_ift)
- ] [
- result (concatword (_ds_color $_ds_col_l) $_ds_ifl " " (_ds_color $_ds_col_f) (? (& $_ds_opts 4) (- (getdeaths) (getfrags))))
- ]
- ]
- ] [
- _ds_echostats
- ]
- ]
- _ds_echostats = [ ? (& $_ds_stats_gh 64) (substr (_ds_getstats (- $_ds_stats_gh 64)) 1) (substr (_ds_getstats ($_ds_stats_gh)) 1) ]
- _ds_addzero = [ ? (> $arg1 9) $arg1 (concatword "0" $arg1) ]
- _ds_timeleft = [ format "%1:%2" (div (timeremaining) 60) (_ds_addzero (mod (timeremaining) 60)) ]
- //Gamehud:
- gamehud = [
- if (&& $_ds_go (& $_ds_opts 2)) [
- concatword (
- ? (& $_ds_opts 8) (
- concatword (
- _ds_color $_ds_col_c) (_ds_timeleft))) (
- concat (
- ? (& $_ds_opts 8)) (
- _ds_getduelstatus) (
- _ds_getstats $_ds_stats_dgh))
- ] [
- _ds_getstats $_ds_stats_gh
- ]
- ]
- // Forever Loops:
- _ds_duelloop = [ if (&& $_ds_go (& $_ds_opts 1)) [ echo (_ds_getduelstatus) ] ; sleep (* $_ds_delay 1000) [ _ds_duelloop ] ]
- _ds_duelloop
- _ds_isduel = [
- if (& $_ds_opts 16) [
- if (>= (getmode)) [
- count = 0
- looplist i (listclients 1) [
- if (! (isspectator $i)) [ count = (+ $count 1) ]
- ]
- _ds_go = (= $count 2)
- ] [ _ds_go = 0 ]
- ]
- sleep 5000 [ _ds_isduel ]
- ]
- _ds_isduel
- // ------------------------------------
- createine _ds_list [ name frags deaths acc kpd flags time ]
- looplist i $_ds_list [
- do [
- createine _ds_color_lbl_@i 7
- createine _ds_color_num_@i 7
- createine _ds_show_lbl_@i 1
- createine _ds_show_num_@i 1
- ]
- ]
- createine _ds_show_lbl 0
- createine _ds_show_num 0
- newgui duel [
- guititle "GameHud"
- guistayopen [
- guibar
- guialign 0 [
- guialign 0 [
- guialign 0 [
- guitext "show/hide" 0
- ]
- guibar
- guialign 0 [
- guilist [
- guitext "label" 0
- looplist i $_ds_list [
- guialign 0 [
- guibitfield "" _ds_show_lbl (+ (pow 2 (indexof $_ds_list @i))) [
- if (! (getalias (concatword "_ds_show_num_" @@i))) [
- (concatword "_ds_show_lbl_" @@@i) = 0
- ]
- ]
- ]
- ]
- ]
- guibar
- guilist [
- guitext "number" 0
- looplist i $_ds_list [
- guialign 0 [
- guibitfield "" _ds_show_num (+ (pow 2 (indexof $_ds_list @i))) [
- if (! (getalias (concatword "_ds_show_num_" @@i))) [
- (concatword "_ds_show_lbl_" @@@i) = 0
- ]
- ]
- ]
- ]
- ]
- ]
- ]
- guibar
- guialign 0 [
- guialign 0 [
- guitext "color" 0
- ]
- guibar
- guialign 0 [
- guilist [
- guitext "label" 0
- looplist i $_ds_list [
- guialign 0 [
- guibutton "" [
- (concatword "_ds_color_lbl_" @i) = (+ (mod (getalias (concatword "_ds_color_lbl_" @i)) 7) 1)
- ]
- ]
- ]
- ]
- guibar
- guilist [
- guitext "number" 0
- looplist i $_ds_list [
- guialign 0 [
- guibutton "" [
- (concatword "_ds_color_num_" @i) = (+ (mod (getalias (concatword "_ds_color_num_" @i)) 7) 1)
- ]
- ]
- ]
- ]
- ]
- ]
- guibar
- guialign 0 [
- guialign 0 [
- guitext "label" 0
- ]
- guibar
- guibar
- //guistrut 1
- looplist i $_ds_list [
- cases $i "name" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Name:") 0
- ] "frags" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Frags:") 0
- ] "deaths" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Deaths:") 0
- ] "acc" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Acc:") 0
- ] "kpd" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "KpD:") 0
- ] "flags" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Flags:") 0
- ] "time" [
- guitext (concatword "^f" (getalias (concatword "_ds_color_lbl_" @i)) "Time:") 0
- ]
- ]
- ]
- guibar
- guialign 0 [
- guialign 0 [
- guitext "number" 0
- ]
- guibar
- //guistrut 1
- guibar
- looplist i $_ds_list [
- do [
- guitext (concatword "^f" $_ds_color_num_@i $i) 0
- ]
- ]
- ]
- guibar
- guialign 0 [
- guialign 0 [
- guitext "location" 0
- ]
- guibar
- guibar
- //guistrut 1
- loop i (listlen $_ds_list) [
- guialign 0 [
- guibutton "" [
- _ds_list = (
- strreplace $_ds_list (concat (at $_ds_list (- @@i 1)) (at $_ds_list @@i)) (concat (at $_ds_list @@i) (at $_ds_list (- @@i 1)))
- )
- ] "arrow_bw.jpg"
- guibutton "" [
- _ds_list = (
- strreplace $_ds_list (concat (at $_ds_list @@i) (at $_ds_list (+ @@i 1))) (concat (at $_ds_list (+ @@i 1)) (at $_ds_list @@i))
- )
- ] "arrow_fw.jpg"
- ]
- ]
- ]
- ]
- guibar
- guibutton "Save" [] 0
- guibutton "Reset" [] 0
- ]
- ] "DuelScript"
- _ds_name = [ concatword "^f" $_ds_color_lbl_name (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "name")))) "Name: ") "^f" $_ds_color_num_name (getname) ]
- _ds_frags = [ concatword "^f" $_ds_color_lbl_frags (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "frags")))) "Frags: ") "^f" $_ds_color_num_frags (getfrags) ]
- _ds_deaths = [ concatword "^f" $_ds_color_lbl_deaths (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "deaths")))) "Deaths: ") "^f" $_ds_color_num_deaths (getdeaths) ]
- _ds_acc = [ concatword "^f" $_ds_color_lbl_acc (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "acc")))) "Acc: ") "^f" $_ds_color_num_acc (getaccuracy) ]
- _ds_kpd = [ concatword "^f" $_ds_color_lbl_kpd (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "kpd")))) "KpD: ") "^f" $_ds_color_num_kpd (substr (divf (getfrags) (max (getdeaths) 1)) 0 4) ]
- _ds_flags = [ concatword "^f" $_ds_color_lbl_flags (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "flags")))) "Flags: ") "^f" $_ds_color_num_flags (getflags) ]
- _ds_time = [ concatword "^f" $_ds_color_lbl_time (? (& $_ds_show_lbl (+ (pow 2 (indexof $_ds_list "time")))) "Time: ") "^f" $_ds_color_num_time (_ds_timeleft) ]
- _ds_getstats = [
- _ds_temp = ""
- looplist i $_ds_list [
- if (& $_ds_show_num (+ (pow 2 (indexof $_ds_list $i)))) [
- _ds_temp = (concat $_ds_temp (_ds_@i))
- ]
- ]
- result (substr $_ds_temp 1)
- ]
Advertisement
Add Comment
Please, Sign In to add comment