For srbs: duelscript
Page 1 of 2 • Share •
Page 1 of 2 • 1, 2 
For srbs: duelscript
Hi srbs, here is that duelscript I was talking about in irc. atm it constantly echos if you are winning, loosing or tied in a duel and the score difference, I'm trying to get it to display that in the gamehud and auto-activate it during duels. Here is the origional code:
// DuelScript by Chaos
// It will constantly echo whether you are winning, loosing or tied in a duel.
newgui duel [
guititle "^f5DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text to echo if winning: "
guifield ifw 20 [$ifw =; echo Text to echo if winning set to: "^f0"$ifw]
guitext "^f3Text to echo if loosing: "
guifield ifl 20 [$ifl =; echo Text to echo if loosing set to: "^f3"$ifl]
guitext "^f1Text to echo if tied: "
guifield ift 20 [$ift =; echo Text to echo if tied set to: $ift]
guibar
guitext "Interval (seconds): "
guifield delay 2 [$delay =; echo Interval between echos set to $delay seconds.]
guibar
guicheckbox "Start/Stop" go
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~."
]
go = 0
duel1 = [if (= $d 0) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo "^f0"$ifw] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo $ift] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo "^f3"$ifl] []]
] []]
duel2 = [if (= $d 1) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo "^f0"$ifw "^f1"(- (getfrags) (getdeaths))] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo $ift] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo "^f3"$ifl "^f1"(- (getdeaths) (getfrags))] []]
] []]
bind 4 [if (= $go 0) [go = 1] [go = 0]]
// DuelScript by Chaos
// It will constantly echo whether you are winning, loosing or tied in a duel.
newgui duel [
guititle "^f5DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text to echo if winning: "
guifield ifw 20 [$ifw =; echo Text to echo if winning set to: "^f0"$ifw]
guitext "^f3Text to echo if loosing: "
guifield ifl 20 [$ifl =; echo Text to echo if loosing set to: "^f3"$ifl]
guitext "^f1Text to echo if tied: "
guifield ift 20 [$ift =; echo Text to echo if tied set to: $ift]
guibar
guitext "Interval (seconds): "
guifield delay 2 [$delay =; echo Interval between echos set to $delay seconds.]
guibar
guicheckbox "Start/Stop" go
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~."
]
go = 0
duel1 = [if (= $d 0) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo "^f0"$ifw] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo $ift] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo "^f3"$ifl] []]
] []]
duel2 = [if (= $d 1) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo "^f0"$ifw "^f1"(- (getfrags) (getdeaths))] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo $ift] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo "^f3"$ifl "^f1"(- (getdeaths) (getfrags))] []]
] []]
bind 4 [if (= $go 0) [go = 1] [go = 0]]
Last edited by srbs on Sun Jan 09, 2011 4:34 pm; edited 1 time in total (Reason for editing : removed stuff for various reasons, i have a copy of it)
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
heres version 1 lol, not automatic yet tho
note some of the improvements
- the 1st if statement
- the combined lines for incl/excl difference
gamehud = [
if $go [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0 " $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result $ift
] [
if (< (getfrags) (getdeaths)) [
result (concatword "^f3 " $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
] [
//stats line
]
]
note some of the improvements
- the 1st if statement
- the combined lines for incl/excl difference
gamehud = [
if $go [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0 " $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result $ift
] [
if (< (getfrags) (getdeaths)) [
result (concatword "^f3 " $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
] [
//stats line
]
]
_________________


srbs- Admin
- Posts: 644
Join date: 2009-11-13
Re: For srbs: duelscript
looks nice srbs
I'll try to work on it too and there are probably many more features we can add such as customizable colors which could be quite cool. So far so good! 
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
okay i fixed up something wrong with the echos; it would put in too many spaces so i used concatword to fix. Here is all that we have so far (made it a little neater too):
// DuelScript by Chaos and srbs
// It will constantly echo whether you are winning, loosing or tied in a duel. It will also display this in the gamehud.
//GUI:
newgui duel [
guititle "^f5DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text to echo if winning: "
guifield ifw 20 [$ifw =; echo Text to echo if winning set to: "^f0"$ifw]
guitext "^f3Text to echo if loosing: "
guifield ifl 20 [$ifl =; echo Text to echo if loosing set to: "^f3"$ifl]
guitext "^f1Text to echo if tied: "
guifield ift 20 [$ift =; echo Text to echo if tied set to: $ift]
guibar
guitext "Interval (seconds): "
guifield delay 2 [$delay =; echo Interval between echos set to $delay seconds.]
guibar
guicheckbox "Start/Stop" go
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~ and ^f6srbs^f~."
]
//Commands:
go = 0
duel1 = [if (= $d 0) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f0" $ifw)] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f1" $ift)] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f3" $ifl)] []]
] []]
duel2 = [if (= $d 1) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f0" $ifw "^f1 " (- (getfrags) (getdeaths)))] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f1" $ift)] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f3" $ifl "^f1 " (- (getdeaths) (getfrags)))] []]
] []]
//To toggle script on/off, feel free to change key or delete:
bind 4 [if (= $go 0) [go = 1] [go = 0]]
//Gamehud:
getstats = [ result (format "%1^f1Frags: ^f3%2 ^f1Deaths: ^f3%3 ^f1Acc: ^f3%4%% ^f1KpD: ^f3%5%6" (? $arg1 (format "^f1Name: ^f3%1 " (getname))) (getfrags) (getdeaths) (getaccuracy) (substr (divf (getfrags) (max (getdeaths) 1)) 0 4) (? (> (getmode) 10) (concat " ^f1Flags:^f3" (getflags)))) ]
gamehud = [
if $go [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0 " $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result $ift
] [
if (< (getfrags) (getdeaths)) [
result (concatword "^f3 " $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
] [
result (getstats 0)
]
]
// DuelScript by Chaos and srbs
// It will constantly echo whether you are winning, loosing or tied in a duel. It will also display this in the gamehud.
//GUI:
newgui duel [
guititle "^f5DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text to echo if winning: "
guifield ifw 20 [$ifw =; echo Text to echo if winning set to: "^f0"$ifw]
guitext "^f3Text to echo if loosing: "
guifield ifl 20 [$ifl =; echo Text to echo if loosing set to: "^f3"$ifl]
guitext "^f1Text to echo if tied: "
guifield ift 20 [$ift =; echo Text to echo if tied set to: $ift]
guibar
guitext "Interval (seconds): "
guifield delay 2 [$delay =; echo Interval between echos set to $delay seconds.]
guibar
guicheckbox "Start/Stop" go
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~ and ^f6srbs^f~."
]
//Commands:
go = 0
duel1 = [if (= $d 0) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f0" $ifw)] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f1" $ift)] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f3" $ifl)] []]
] []]
duel2 = [if (= $d 1) [
if (> (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f0" $ifw "^f1 " (- (getfrags) (getdeaths)))] []]
if (= (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f1" $ift)] []]
if (< (getfrags) (getdeaths)) [if (= $go 1) [echo (concatword "^f3" $ifl "^f1 " (- (getdeaths) (getfrags)))] []]
] []]
//To toggle script on/off, feel free to change key or delete:
bind 4 [if (= $go 0) [go = 1] [go = 0]]
//Gamehud:
getstats = [ result (format "%1^f1Frags: ^f3%2 ^f1Deaths: ^f3%3 ^f1Acc: ^f3%4%% ^f1KpD: ^f3%5%6" (? $arg1 (format "^f1Name: ^f3%1 " (getname))) (getfrags) (getdeaths) (getaccuracy) (substr (divf (getfrags) (max (getdeaths) 1)) 0 4) (? (> (getmode) 10) (concat " ^f1Flags:^f3" (getflags)))) ]
gamehud = [
if $go [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0 " $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result $ift
] [
if (< (getfrags) (getdeaths)) [
result (concatword "^f3 " $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
] [
result (getstats 0)
]
]
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
are you going to keep the echo part or just make it gamehud only?
_________________


srbs- Admin
- Posts: 644
Join date: 2009-11-13
Re: For srbs: duelscript
I'd like to give users the option to use either gamehud or echos (or both simultaneously). I'm also thinking of adding a bind that echos only once, which can be enabled/disabled aswell.
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
well, in that case, might i suggest a consolidation of code:
chaos - duel script.cfg
chaos - duel script.cfg
_________________


srbs- Admin
- Posts: 644
Join date: 2009-11-13
Re: For srbs: duelscript
i really really dont understand this
i just try to ready the scripts when
xDD
i just try to ready the scripts when
xDD

Scoob-DooBR- Posts: 133
Join date: 2010-12-21
Age: 17
Location: Brazil
Re: For srbs: duelscript
Thats a lot neater than my bulky code
Now we just need options to toggle individual parts of the script on and off and an auto-initiation option. I think I might be able to do the first part but idk about the auto-initiation.
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
I make things as neat & short as possible. 
You can do the gui stuff with the settings, I can do the auto-on/off.
You can do the gui stuff with the settings, I can do the auto-on/off.
_________________


srbs- Admin
- Posts: 644
Join date: 2009-11-13
Re: For srbs: duelscript
Ok my part is done, added a tab that allows you to disable parts of the script, here is the new code:
// DuelScript by Chaos and srbs
// It will constantly echo whether you are winning, loosing or tied in a duel. It will also display this in the gamehud.
//GUI
newgui duel [
guititle "^f2DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text if winning: "
guifield ifw 20 [ echo "Text if winning set to:^f0" $ifw ]
guitext "^f3Text if loosing: "
guifield ifl 20 [ echo "Text if loosing set to:^f3" $ifl ]
guitext "^f1Text if tied: "
guifield ift 20 [ echo "Text if tied set to:" $ift ]
guibar
guicheckbox "Start/Stop" go
guitab "^f5Options"
guitext "^f2Continuous Echo: "
guilist [
guitext "Interval (seconds): "
guifield delay 2 [ echo "Interval between echos set to" $delay "seconds." ]
guibar
guicheckbox "Disable" en1
]
guibar
guilist [
guitext "^f2Single Echo: "
guicheckbox "Disable" en2
]
guibar
guilist [
guitext "^f2Duel Gamehud: "
guicheckbox "Disable" en3
]
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~ and ^f6srbs^f~."
]
//helper functions
getstats = [ result (format "%1^f1Frags: ^f3%2 ^f1Deaths: ^f3%3 ^f1Acc: ^f3%4%% ^f1KpD: ^f3%5%6" (? $arg1 (format "^f1Name: ^f3%1 " (getname))) (getfrags) (getdeaths) (getaccuracy) (substr (divf (getfrags) (max (getdeaths) 1)) 0 4) (? (> (getmode) 10) (concat " ^f1Flags:^f3" (getflags)))) ]
getduelstatus = [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0" $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result (concatword "^f1" $ift)
] [
result (concatword "^f3" $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
//gamehud
gamehud = [
if (= $en3 0) [
if $go [
result (getduelstatus)
] [
result (getstats 0)
]
] [
result (getstats 0)
]
]
//echo on bind
bind 5 [ if (= $en2 0) [ echo (getduelstatus) ] ]
// DuelScript by Chaos and srbs
// It will constantly echo whether you are winning, loosing or tied in a duel. It will also display this in the gamehud.
//GUI
newgui duel [
guititle "^f2DuelScript Manager"
guitext "Manage the settings of the DuelScript here."
guibar
guicheckbox "Show Difference" d
guibar
guitext "^f0Text if winning: "
guifield ifw 20 [ echo "Text if winning set to:^f0" $ifw ]
guitext "^f3Text if loosing: "
guifield ifl 20 [ echo "Text if loosing set to:^f3" $ifl ]
guitext "^f1Text if tied: "
guifield ift 20 [ echo "Text if tied set to:" $ift ]
guibar
guicheckbox "Start/Stop" go
guitab "^f5Options"
guitext "^f2Continuous Echo: "
guilist [
guitext "Interval (seconds): "
guifield delay 2 [ echo "Interval between echos set to" $delay "seconds." ]
guibar
guicheckbox "Disable" en1
]
guibar
guilist [
guitext "^f2Single Echo: "
guicheckbox "Disable" en2
]
guibar
guilist [
guitext "^f2Duel Gamehud: "
guicheckbox "Disable" en3
]
guitab "^f5About"
guitext "Created and Developed by ^f6Chaos^f~ and ^f6srbs^f~."
]
//helper functions
getstats = [ result (format "%1^f1Frags: ^f3%2 ^f1Deaths: ^f3%3 ^f1Acc: ^f3%4%% ^f1KpD: ^f3%5%6" (? $arg1 (format "^f1Name: ^f3%1 " (getname))) (getfrags) (getdeaths) (getaccuracy) (substr (divf (getfrags) (max (getdeaths) 1)) 0 4) (? (> (getmode) 10) (concat " ^f1Flags:^f3" (getflags)))) ]
getduelstatus = [
if (> (getfrags) (getdeaths)) [
result (concatword "^f0" $ifw "^f1 " (? $d (- (getfrags) (getdeaths))))
] [
if (= (getfrags) (getdeaths)) [
result (concatword "^f1" $ift)
] [
result (concatword "^f3" $ifl "^f1 " (? $d (- (getdeaths) (getfrags))))
]
]
]
//gamehud
gamehud = [
if (= $en3 0) [
if $go [
result (getduelstatus)
] [
result (getstats 0)
]
] [
result (getstats 0)
]
]
//echo on bind
bind 5 [ if (= $en2 0) [ echo (getduelstatus) ] ]
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61

srbs- Admin
- Posts: 644
Join date: 2009-11-13
Re: For srbs: duelscript
srbs this is awesome! Thanks for all your help. 1 more thing tho (
) is it possible have an option to turn the auto-initiation on and off?
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61
Re: For srbs: duelscript
I have another idea; GUI options that allow the user to show/hide parts of the gamehud (normal one, not duel one) such as KpD, acc or timeleft, what do u think? 
Chaos- Posts: 33
Join date: 2010-06-06
Age: 61

srbs- Admin
- Posts: 644
Join date: 2009-11-13
Page 1 of 2 • 1, 2 
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum