Get the New Tools
#46
Nope :/
I broke it into three pieces (one with 9kb, and the other two with 8kb).

The first and second ones worked perfectly individually, but it was the third chunk individually that made me suicide.
// add2menu -- Quickly append to any already-defined menu without having to open its cfg file for editing
alias add2menu [
newmenu $arg1
arg2]
alias add2mainmenu [
add2menu main $arg1]
// *************************************************************************************************************
// conloop -- A generic looping conline checker.
alias if_conline_list [] // instead of "checkinit" to avoid spamz0r
alias if_conline_hat [concatword (at $keylist 70) (at $keylist 72) (at $keylist 60) (at $keylist 54) (at $keylist 60) (at $keylist 55) (at $keylist 56)]
alias if_conline_has [
check_for = $arg1
if (|| (|| (strcmp $arg2 "but_not") (strcmp $arg2 "and_also")) (strcmp $arg2 "or_else")) [
tmp_other = $arg3
action_if_yes = $arg4
action_if_no = $arg5
if (strcmp $arg2 "but_not") [
  if (&& (strstr $conline $check_for) (! (strstr $conline $tmp_other))) [action_if_yes] [action_if_no]] []
if (strcmp $arg2 "and_also") [
  if (&& (strstr $conline $check_for) (strstr $conline $tmp_other)) [action_if_yes] [action_if_no]] []
if (strcmp $arg2 "or_else") [
  if (|| (strstr $conline $check_for) (strstr $conline $tmp_other)) [action_if_yes] [action_if_no]] []
] [
action_if_yes = $arg2
action_if_no = $arg3
if (strstr $conline $check_for) [action_if_yes] [action_if_no]]]

alias add2conloop [addcheck if_conline_list $arg1]

recursive conloop 0 [if_conline_list; conline [ ]]
addcheck_msa conloop
// Example:
// add2conloop [if_conline_has "connected: " [whois (findcn (at $conline 1))] []]
// *************************************************************************************************************
// convertcnum and whoisline -- automatically stores the last "whois" info in an alias -- by V-Man
alias convertcnum [
loop co 42 [if (strcmp (at $conline 2) (concatword $co ":")) [tmpcn = $co] []]
result $tmpcn]

add2conloop [
(if_conline_hat)
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
// *************************************************************************************************************
// curplayers -- Returns the number of players in the server or bot game -- by DES|Bukz.
// Modified by V-Wifey and V-Man.
alias curplayers [
players = 0
if $connected [
  loop x 21 [if (= (at (pstat_score $x) 4) -1) [] [+= players 1]]
  result $players
] [
  loop x 41 [if (strcmp (findpn $x) "") [] [+= players 1]]
  result $players
]]
// *************************************************************************************************************
// validcnumlist by V-Man: counts the number of (non-duplicated) client numbers
alias validcnumlist [
validcnums = []
if $connected [
  loop n 21 [if (= (at (pstat_score $n) 4) -1) [] [add2list validcnums $n]]
  result $validcnums
] [
  loop n 41 [if (strcmp (findpn $n) "") [] [add2list validcnums $n]]
  result $validcnums ]]
// kickbots: kickbots 1 3 5 7 9 kicks multiple bots, by client number
alias kickbots [
loop o $numargs [
  kickbot (findpn (getalias (concatword "arg" (+ $o 1)))) ]]
// whoisall: WHOIS check on every client in the server
alias whoisall [loop w 21 [whois $w]]
// teamcount: echo (teamcount 1) returns the count for players in RVSF
alias teamcount [
tmp_count = 0
loop p (curplayers) [
if (= (at (pstat_score (at (validcnumlist) $p)) 4) $arg1) [+= tmp_count 1] []
] result $tmp_count ]
// *************************************************************************************************************
// Bukz' "cur" scripts -- calculates the highest client number, number of enemies, and individual pstat scores
// curhighestcn - Returns the highest client number in the current game. - by DES|Bukz
alias curhighestcn [
hcn = 0
if $connected [
  loop q 21 [if (strcmp (findpn $q) "") [] [hcn = $q]]
  ] [
  loop q 41 [if (strcmp (findpn $q) "") [] [hcn = $q]]
  ] result $hcn ]
// curenemies - Returns the current number of enemies the user may have ATM. - by DES|Bukz
// Requires tools.cfg & the "curhighestcn" script.
alias curenemies [
tmpenemies = 0
if (|| $connected (curmodeattr bot)) [
  if (curmodeattr team) [
   if (curteam) [
    loop b (+ (curhighestcn) 1) [
     if (= (at (pstat_score $b) 4) 0) [+= tmpenemies 1] []
     ] result $tmpenemies
     ] [
     loop b (+ (curhighestcn) 1) [
      if (= (at (pstat_score $a) 4) 1) [+= tmpenemies 1] []
      ] result $tmpenemies]] [
  tmpenemies = (- (curplayers) 1)
  result $tmpenemies]] [result -1]]
// curdeaths - Returns the number of deaths a client has in the current game. - by DES|Bukz
// Returns -1 if an invalid client number was given.
alias curdeaths [
tmpdeaths = 0
  if (strcmp (findpn $arg1) "") [result -1] [
   tmpdeaths = (at (pstat_score $arg1) 2)
   result $tmpdeaths ]]
// curfrags - Returns the number of frags a client has in the current game. - by DES|Bukz
// Returns -1 if an invalid client number was given.
alias curfrags [
tmpfrags = 0
if (strcmp (findpn $arg1) "") [result -1] [
  tmpfrags = (at (pstat_score $arg1) 1)
  result $tmpfrags ]]
// curratio - Returns the given clients ratio in a floating point decimal by DES|Bukz
// Returns -1 if an invalid client number was given.
alias curratio [
if (strcmp (findpn $arg1) "") [result -1] [
  alias tmpfrags (at (pstat_score $arg1) 1)
  alias tmpdeaths (at (pstat_score $arg1) 2)
  if (< $tmpdeaths 2) [
   alias tmpratio (concatword $tmpfrags .0)
   ] [alias tmpratio (divf $tmpfrags $tmpdeaths)]
  result $tmpratio ]]
  // curscore - Returns the current score (in points) that a given client has ATM by DES|Bukz
alias curscore [
if (strcmp (findpn $arg1) "") [result -1] [
  tmpscore = (at (pstat_score $arg1) 3)
   result $tmpscore ]]
// *************************************************************************************************************
alias countsound [
registersound $arg1 $arg2 $arg3 $arg4
+= regsounds 1
alias $arg5 (concat "sound" $regsounds)
addlistonquit $arg5]
// countsound weapon\chainsaw [] [] [] chsaw
// registers chainsaw.wav and saves its sound command in alias "chsaw"
regsounds = 98 // If there are 98 sounds registered in sounds.cfg (98 is default)
// *************************************************************************************************************
// Clearing the tools on quit
addcheck_onquit [delserial tmp_list 9]
addcheck_onquit [delserial tmp 9]
addlistonquit [addcheck add2bind add2list addcheck_msa addcheck_si addcheck_onquit addcheck_sb addlistonquit findbind bindcheck bindloopresult fblc itemtofind findbind_loop keylist numbinds add2eachbind addition initialize checkinit if_conline_has check_for has_not action_if_yes action_if_no add2conloop conloop if_conline_list pow pow_exp pow_base roundf average avsum add2menu add2mainmenu players curplayers serial tmp_command serialnum nestalias tmp_name tmp_command tmp_layers nestnum tmp_alias delfromlistend delfromliststart delfromlist delfromlist_mult replacestr swapstrpos mv2liststart tmp_list strpos1 strpos2 validcnumlist validcnums kickbots teamcount tmp_count curhighestcn hcn curenemies tmpenemies curdeaths tmpdeaths curfrags tmpfrags curratio tmpratio storeargs sloop sloopme recursive isfloat isint isnumber iseven rndposneg absval square sqrt x tmp_iters sqrt_perr sqrt_err insertpos insertstr convertcnum tmpcn whoisline shiftsel countsound regsounds larger smaller torads todegs div=f larger smaller GCD LCM tmplcm fac tmpfac sin tmpsin tmp_sin cos tmpcos tmp_cos tan cosecant secant cotangent numpi logn tmplog ecount tmp_log log10 log2 tmpval tmpres tmpfp whatpercent percentrange rndattract tmpresult
alias_list onQuit]
EDIT: The code is the third bit.
Thanks given by:


Messages In This Thread
Get the New Tools - by V-Man - 16 Dec 10, 12:37PM
RE: Get the New Tools - by Gibstick - 16 Dec 10, 01:59PM
RE: Get the New Tools - by V-Man - 16 Dec 10, 05:30PM
RE: Get the New Tools - by Andrez - 16 Dec 10, 02:27PM
RE: Get the New Tools - by DEKiMA - 16 Dec 10, 08:25PM
RE: Get the New Tools - by Bukz - 16 Dec 10, 04:47PM
RE: Get the New Tools - by Gibstick - 16 Dec 10, 11:21PM
RE: Get the New Tools - by Blue_Pr!nt - 17 Dec 10, 01:10AM
RE: Get the New Tools - by Gibstick - 17 Dec 10, 03:13AM
RE: Get the New Tools - by sputnik - 17 Dec 10, 11:17AM
RE: Get the New Tools - by Gibstick - 17 Dec 10, 01:10PM
RE: Get the New Tools - by V-Man - 17 Dec 10, 04:40PM
RE: Get the New Tools - by sputnik - 17 Dec 10, 08:57PM
RE: Get the New Tools - by V-Man - 18 Dec 10, 12:32AM
RE: Get the New Tools - by Kirin - 23 Dec 10, 08:43AM
RE: Get the New Tools - by V-Man - 23 Dec 10, 03:04PM
RE: Get the New Tools - by sputnik - 23 Dec 10, 07:29PM
RE: Get the New Tools - by V-Man - 23 Dec 10, 07:50PM
RE: Get the New Tools - by sputnik - 24 Dec 10, 01:02AM
RE: Get the New Tools - by V-Man - 24 Dec 10, 01:17AM
RE: Get the New Tools - by V-Man - 25 Dec 10, 04:20PM
RE: Get the New Tools - by Kirin - 27 Dec 10, 08:55AM
RE: Get the New Tools - by V-Man - 27 Dec 10, 04:47PM
RE: Get the New Tools - by V-Man - 17 Jan 11, 03:24PM
RE: Get the New Tools - by Bukz - 19 Jan 11, 02:26AM
RE: Get the New Tools - by V-Man - 19 Jan 11, 03:48AM
RE: Get the New Tools - by eftertanke - 19 Jan 11, 04:01AM
RE: Get the New Tools - by V-Man - 19 Jan 11, 04:09AM
RE: Get the New Tools - by eftertanke - 19 Jan 11, 04:25AM
RE: Get the New Tools - by V-Man - 19 Jan 11, 04:31AM
RE: Get the New Tools - by eftertanke - 19 Jan 11, 04:33AM
RE: Get the New Tools - by Ronald_Reagan - 31 Jan 11, 05:06AM
RE: Get the New Tools - by Bukz - 31 Jan 11, 02:02PM
RE: Get the New Tools - by V-Man - 31 Jan 11, 05:32PM
RE: Get the New Tools - by Bukz - 31 Jan 11, 11:50PM
RE: Get the New Tools - by V-Man - 01 Feb 11, 12:23AM
RE: Get the New Tools - by V-Man - 16 Feb 11, 06:28PM
RE: Get the New Tools - by Gibstick - 16 Feb 11, 10:12PM
RE: Get the New Tools - by V-Man - 20 Feb 11, 08:47AM
RE: Get the New Tools - by V-Man - 09 Mar 11, 09:34AM
RE: Get the New Tools - by V-Man - 01 Apr 11, 07:04AM
RE: Get the New Tools - by Bukz - 11 Mar 11, 10:03PM
RE: Get the New Tools - by Orynge - 01 Apr 11, 07:29AM
RE: Get the New Tools - by V-Man - 01 Apr 11, 08:13AM
RE: Get the New Tools - by eftertanke - 01 Apr 11, 08:27AM
RE: Get the New Tools - by Orynge - 01 Apr 11, 08:27AM
RE: Get the New Tools - by eftertanke - 01 Apr 11, 08:33AM
RE: Get the New Tools - by V-Man - 01 Apr 11, 08:31AM
RE: Get the New Tools - by V-Man - 01 Apr 11, 08:37AM
RE: Get the New Tools - by eftertanke - 01 Apr 11, 08:37AM
RE: Get the New Tools - by Orynge - 01 Apr 11, 08:37AM
RE: Get the New Tools - by V-Man - 01 Apr 11, 09:01AM
RE: Get the New Tools - by eftertanke - 01 Apr 11, 09:01AM
RE: Get the New Tools - by Bukz - 01 Apr 11, 09:30AM
RE: Get the New Tools - by V-Wifey - 02 Apr 11, 02:00AM
RE: Get the New Tools - by Neon - 02 Apr 11, 02:04AM
RE: Get the New Tools - by Yarukinasu - 02 Apr 11, 05:34AM
RE: Get the New Tools - by eftertanke - 02 Apr 11, 05:42AM
RE: Get the New Tools - by V-Man - 02 Apr 11, 07:06AM
RE: Get the New Tools - by Orynge - 03 Apr 11, 05:43AM
RE: Get the New Tools - by V-Wifey - 03 Apr 11, 01:09AM
RE: Get the New Tools - by eftertanke - 03 Apr 11, 06:57AM