Scripts
Thanks Kirin! I'll test those tonight. If I find them tools-worthy, do I have your permission to add those to tools.cfg?

@Bukz: Is the search feature really that popular? :O
Nice fancification BTW. :D
Thanks given by:
V-Man yes ofcourse! :)
Thanks given by:
macm and I are proud to announce sendalias -- transmit or receive an alias over in-game chat! Thanks to Bukz and Freddo for help with testing and debugging.

Be sure to update your tools.cfg file to use this! :D
Thanks given by:
// 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]]]]]

// 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

// 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.

// 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

// 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
O_o spam much V-Man? Gawrsh...

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
Thanks given by:
v-man i would recommend you to ditch bisection and use the tangent method to calculate square roots (and generally zeroes of derivable functions)
here's an implementation
scroll down for the fixed version :) sry for the inconvenient
it's MUCH faster (MUCH!)
this calcolates sqrt up to the maximun precision allowed
also this is not recursive so it's another advantage my implementation has.
Thanks given by:
I did the first method that came to my head. XD
I'll test this version, thanks for showing it to me!

Edit: Can you add decimal-argument capability? Right now the sqrt of 0.5 is 0.25... XD
Thanks given by:
let me see what bug i left XD i tested it only for numbers above 1
and it got to full precision in few steps
FIXED:
// 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 [
alias x (divf (+f $arg1 1) 2)
alias sqrt_prec 1e-05
tmp_iters = 0
sqrt_perr = (absval (-f (square $arg1) $arg1))
sqrt_err = (absval (-f (square $x) $arg1))
while [(|| (<f $sqrt_err $sqrt_perr) (< $tmp_iters 5))] [
-=f x (divf (-f (square $x) $arg1) (*f 2 $x))
sqrt_perr = $sqrt_err
sqrt_err = (absval (-f (square $x) $arg1))
+= tmp_iters 1
]
result $x
]

it wasnt converging for numbers below 1 because the initial guess add opposite tendence to the square root.
now i'm pretty confident it works for every number
and that it has not got any corner cases
Thanks given by:
You da man! Can I put it in the next tools update? :D

Oh and this definitely wins the "while" contest in my book.
Thanks given by:
Too late, the contest is closed. The only attention it attracted was stef's.
Thanks given by:
D:
Thanks given by:
yes V-Man, (btw i already answered this question :D)
Thanks given by:
heya script nerds ^^
i was wondering if some1 can make me a script or just tell me where to get it which would do:
count and show you how many times you have hitted your enemy. e.g. i shoot some1 with AR and i see the number of hits in the console? :P
thank you :)
Thanks given by:
Turn "Hit Sound" on.

Settings > Gameplay

Unless you want a message spammed in your console.
Thanks given by:
Milandrag: What Orygne mentioned, as well as using /accuracy which also showed how many bullets you have shot in total and how many actually hit.
Thanks given by:
Give the devs some overpriced wine to try to get them to code CubeScript access to the accuracy stats and I'll make that script for ya. ;-)



Just in case someone looks here for it,
Try the new Random Terrain Generator!!
[Image: rndmap%208%2030%205%2016_small.jpg]
Thanks given by:
V-Man, make me a script to do something like bs_hypercube.
Thanks given by:
you know what would be awesome? a server that made it's own maps, and it would generate different sized/shaped ones depending on how many players are on.
Thanks given by:
@Gibstick: Show me bs_hypercube!
@Lantry: You could pre-generate a bunch of them, and then use the maprot file to load them into the game for a day or two.

@Everyone who downloaded the terrain generator so far: Sorry, I assumed some of my latest scripts had already been added to tools.cfg. ANOTHER UPDATE TONIGHT! lol
Thanks given by:
I was half kidding when I said that, but you can explore the option if you want for fun. Ask pwnage for bs_hypercube.
Thanks given by:
update on random map generator to make it work?
edit: i guess not, since v-man's offline
reedit: ty this things awesome! imma make a server with only random generated maps. Itll be a weird server!
re re edit: maybe not as ac_server still is not working with my server provider. Stupid hazenet!
Thanks given by:
This update of tools.cfg should do the trick. Sorry for taking so long... XD



For kicks und giggles:

A stopwatch
delalias swst
alias stopwatch [
if (strcmp $arg1 "start") [alias swst (millis)] [
if (strcmp $arg1 "time") [if (checkalias swst) [echo (- (millis) $swst)] [stopwatch isn't running!]] [
  if (strcmp $arg1 "clear") [delalias swst] []]]]

A vote detector (and storage unit)
// 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

A "connect" detector
// cconnect -- a way to coordinate server connection information with other players -- 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
Thanks given by:
do you think that a server made of completely randomly generated maps would be allowed in the master server? most of the maps have a wqd of way over 5000...
Thanks given by:
lol,
Note that the purpose of the random terrain script is to help inspire mappers.

If enough interest is expressed, I'll consider adding pickup and waterlevel randomization to the script.
Thanks given by:
If you like spam, you'll love the ping script!
// messy way for CubeScript to calculate ping by V-Man
// uh, by the way, this is not accurate. XD
ping = 0
cwatching = 0
checkinit watchingfor 0

alias on_nextconline [
cwatching = 1
watchingfor = $arg1
watchcommand = $arg2]

add2conloop [
if $cwatching [if_conline_has $watchingfor [watchcommand; cwatching = 0] []] []]

recursive findping 10000 [
if $connected [
whois (findcn $curname)
tmp_millis = (millis)
on_nextconline WHOIS [ping = (div (+ $ping (div (- (millis) $tmp_millis) 2)) 2)]] []]

addcheck_msa findping

I also figured AC needs hotkey compatibility, with common commands and such.
add2bind LCTRL [ctr = 1; onrelease [ctr = 0]]
add2bind RCTRL [ctr = 1; onrelease [ctr = 0]] // either ctrl key works
add2bind C [if $ctr [if $editing [copy] [copyconline = $cconline]] []] // copies editing selection or the latest console output!
add2bind V [if $ctr [if $editing [paste] [saycommand (getalias copyconline)]] []] // pastes editing stuff or the console copy!
add2bind A [if $ctr [if $editing [select 2 2 512 512] []] []] // Select a whole map
add2bind S [if $ctr [if $editing [if (strcmp (curmap) []) [saycommand "savemap "] [savemap]] []] []] // save the map
add2bind Z [if $ctr [if $editing [undo] []]] // Ctrl+z! Of course!
add2bind F [if $ctr [saycommand "docfind "]] // find
add2bind Q [if $ctr [quit]] // quit
add2bind P [if $ctr [screenshot]] // print XD
add2bind O [if $ctr [if $connected [showmenu Gamemode] [showmenu maps]] []] // "open"
add2conloop [if (strcmp $conline [ ]) [] [cconline = $conline]] // enables copying conline
Thanks given by:
I'll look at the mac binds soon enough and make it work for mac cmd keys. Notice that this will still work for mac users, just only for the control key (which you are generally not used to).
Thanks given by:
(21 Aug 10, 09:37AM)Kirin Wrote: i think that now it's a good idea to add this command:

addtimedloop [millisecs] [alias]

what do u think guys?

GJ Bukz :)

btw bukz
u can do conline [ ]
to avoid the spam and this way your scripts will become much more efficient.
EDIT: took time to do it properly:
//on Tk message script by Bukz. little mod by kirin.
if (! (strstr $mapstartalways tkchk)) [add2alias mapstartalways [sleep 1000 [tkchk]]] []
if (checkalias srymsg) [] [srymsg = "Sorry Mate :("]

tkchk = [
    if (= $connected 1) [ // Only apoligize to real people :p
        if (strstr $conline "you fragged teammate ") [say (concatword % $srymsg);conline [ ]] []
        if (strstr $conline "you gibbed teammate ") [say (concatword % $srymsg);conline [ ]] []
        if (strstr $conline "you splattered teammate ") [say (concatword % $srymsg);conline [ ]] []
        if (strstr $conline "you knifed teammate ") [say (concatword % $srymsg);conline [ ]] []
        if (strstr $conline "you headshotted teammate ") [say (concatword % $srymsg);conline [ ]] []
    ]
sleep 1 [tkchk]
]
newmenu "sorrymsg"
menuitemtextinput "message on TeamKill: " "result $srymsg" "srymsg = $arg1"

much simpler and efficient dont ya think?

also i fixed a bug that launched your script repeatdly after rerunning AC

mapstartalways was getting accumulated.
and i added a default for srymsg.

EDIT..
fixed another bug for those who call themselfes "teammate"

Supposed you want to kick the teamkiller with score of -5 or below?
Thanks given by:
Let the server do it.
Thanks given by:
Supposed that server didnt have teamkill ban option....
Thanks given by:
change server :P
Thanks given by:
Suppose I have admin...
Thanks given by: