[SELECT ALL] Code:
// absval, square, and sqrt -- calculate absolute value, square, and square root -- by V-Man
alias absval [if (<f 0 $arg1) [result $arg1] [result (*f $arg1 -1)]]
// absval (value to calculate absolute value )
alias square [result (*f $arg1 $arg1)]
alias sqrt [
sqrt_arg = (absval $arg1)
tmp_sqrt = $sqrt_arg
if (< $sqrt_arg 1) [
tmp_sqrt_lo = 0
tmp_sqrt_hi = 1
sqrtloop
] [
tmp_sqrt_lo = 1
tmp_sqrt_hi = $sqrt_arg
sqrtloop]
result $tmp_sqrt
]
alias sqrtloop [
if (<f (absval (-f $sqrt_arg (square (getalias tmp_sqrt)))) 0.000001) [] [
if (>f (square (getalias tmp_sqrt)) $sqrt_arg) [
tmp_sqrt_hi = $tmp_sqrt
tmp_sqrt = (average $tmp_sqrt (getalias tmp_sqrt_lo))
if (&& (!=f $tmp_sqrt $tmp_sqrt_hi) (!=f $tmp_sqrt $tmp_sqrt_lo) (!=f $tmp_sqrt_hi $tmp_sqrt_lo)) [sqrtloop] []
] [
if (<f (square (getalias tmp_sqrt)) $sqrt_arg) [
tmp_sqrt_lo = $tmp_sqrt
tmp_sqrt = (average $tmp_sqrt (getalias tmp_sqrt_hi))
if (&& (!=f $tmp_sqrt $tmp_sqrt_hi) (!=f $tmp_sqrt $tmp_sqrt_lo) (!=f $tmp_sqrt_hi $tmp_sqrt_lo)) [sqrtloop] []
] [
if (=f (square (getalias tmp_sqrt)) $sqrt_arg) [] [echo (c 3)Square root error]]]]]
[SELECT ALL] Code:
// convertcnum and whoisline -- automatically stores the last "whois" info in an alias -- by V-Man
alias convertcnum [
delalias tmpcn
loop co 42 [if (strcmp (at $conline 2) (concatword $co ":")) [tmpcn = $co] []]
result $tmpcn
]
add2conloop [
if_conline_has "WHOIS" [
if (= (listlen $conline) 7) [
alias whoisline (concat (convertcnum) (at $conline 4) (at $conline 6))
] [
alias whoisline (concat (convertcnum) (at $conline 4) (at $conline 7))]] []]
// whoisline = cn, name, IP
[SELECT ALL] Code:
// insertpos -- modify a list by inserting a specified element into a specified point in the list -- by V-Man
alias insertpos [
delalias tmp_list7
loop inp (listlen $arg1) [
if (= $arg2 $inp) [
add2list tmp_list7 $arg3 ; add2list tmp_list7 (at $arg1 $inp)] [
add2list tmp_list7 (at $arg1 $inp)]
]
result $tmp_list7
]
// insertpos (list) (position) (element to add)
// echo (insertpos [I really would enjoy playing TOSOK all day long] 3 not)
alias insertstr [
if (= (findlist $arg1 $arg2) -1) [echo Specified string not found in list!] [
insertpos $arg1 (+ (findlist $arg1 $arg2) 1) $arg3]
]
// insertstr (list) (element after which to insert new element) (element to add) (next element, if it helps you)
// echo (insertstr [A good Cuber will die for the team!] will sometimes die)
// if there are two instances of the reference element, this script uses the first one.
[SELECT ALL] Code:
// cconnect -- a way to quickly copy when other players say "connect server.url 28763 password", or to easily tell other players this info -- by V-Man
// Users store server info by typing "getserver" when they are in the desired server.
// The password can be added to the alias by adding it as an argument to "getserver"
// They can then go to other servers and type "sayserver" to invite other players to that server.
// The script also recognizes "connect" messages and automatically stores them.
// The user can access them by typing "cconnect".
alias connectline []
add2conloop [
if (strcmp (at $conline 1) "connect") [
alias connectline (concat (at $conline 2) (at $conline 3) (at $conline 4))
if (>= (listlen $connectline) 1) [echo (c 2)Connect information has been stored!] []
] []]
alias cconnect [
if (strcmp $connectline "") [
echo (c 3)No connect information is stored.
] [
connect (at $connectline 0) (at $connectline 1) (at $connectline 2)]
]
alias getserver [
if (strcmp $arg1 "") [
alias connectline (curserver 5)
] [
alias connectline (concat (curserver 5) $arg1)
]
]
alias sayserver [say connect $connectline]
// getserver (password)
// sayserver
[SELECT ALL] Code:
// votehandler -- stores the last vote in an alias, allowing you to view or re-call it -- by V-Man
alias votehandler [
if (strcmp $vote_type "load") [alias map_vote (at $conline 6); alias mode_vote (at $conline 9)] []
if (strcmp $vote_type "kick") [alias player_kbf (findcn (at $conline 6)); alias kb_reason (at $conline 8)] []
if (strcmp $vote_type "ban") [alias player_kbf (at $conline 6); alias kb_reason (at $conline 8)] []
if (strcmp $vote_type "shuffle") [] []
if (strcmp $vote_type "force") [alias player_kbf (findcn (at $conline 6))] []
if (strcmp $vote_type "set") [alias mmarg (at $conline 7)] []
]
add2conloop [
if_conline_has "called a vote: " [alias vote_is_pending 1; alias who_called (at $conline 0); alias vote_type (at $conline 4); votehandler] []
if_conline_has "vote passed" [alias vote_is_pending 0] []
if_conline_has "vote failed" [alias vote_is_pending 0] []
]
alias lastvote [
if (strcmp $vote_type "load") [$mode_vote $map_vote] []
if (strcmp $vote_type "kick") [kick $player_kbf $kb_reason] []
if (strcmp $vote_type "ban") [ban $player_kbf $kb_reason] []
if (strcmp $vote_type "shuffle") [callvote 12] []
if (strcmp $vote_type "force") [forceteam $player_kbf] []
if (strcmp $vote_type "set") [
if (strcmp $mmarg "open") [mastermode 0] []
if (strcmp $mmarg "private") [mastermode 1] []
if (strcmp $mmarg "match") [mastermode 2] []
] []
]
TDM = tdm
DM = dm
SURV = lms
surv = lms
TSURV = ts
tsurv = ts
CTF = ctf
PF = pf
BTDM = [votemap 7 $arg1]
BDM = [votemap 8 $arg1]
LSS = lss
OSOK = osok
TOSOK = tosok
BOSOK = [votemap 12 $arg1]
HTF = htf
TKTF = tktf
KTF = ktf
vote_is_pending = 0
Oh BTW, that "convertcnum" and "whoisline" are needed in order for Remote Control to work...
Yeah. Obviously another update to tools.cfg is due... The day after the last one. XD XD XD
Please PM me with feedback about the Remote Control script if you use it. :D