Scripts
Or something like "Y" that gets hit less often, yet hit a fair amount. "V"?
Thanks given by:
I just noticed you forgot "forward" in that bind xD
Maybe bind S [backward; writecfg]
Thanks given by:
I use okl; instead of wasd.
Thanks given by:
heh.
And I thought my "ESDF" was weird.
Thanks given by:
Is it possible to make a script so that as soon as someone takes your flag next time you get a death you will switch to the Sniper Rifle?

That would be an epic script and I would use it!!
Thanks given by:
I don't see the use of that but here it is, I have not tested so I can't guarantee it will work. ;)
checkflag = [
    if (strstr $conline "has your flag") [
        nextprimary 5
    ] []
    sleep 1 [checkflag]
]

if (strstr $mapstartalways checkflag) [] [
    add2alias mapstartalways [checkflag]
]

Thanks given by:
Fourteen minutes! A new record! :D
Thanks given by:
(02 Dec 10, 03:46PM)usesnipez Wrote: Is it possible to make a script so that as soon as someone takes your flag next time you get a death you will switch to the Sniper Rifle?

That would be an epic script and I would use it!!

I can't see the relation here...
Thanks given by:
Updated version of anyconnect (connect to private/passworded servers from server list, even with admin pass).
//Even more convenient connecting from server browser.
//Concept by Stef
//By Gibstick

sbpass = ""
sbserverdesc_ = ""
sbpass = ""
lastIP = ""
lastport = ""
sbbreason = ""
connasadmin = ""

newmenu "connect with password"

menuitemvar [ concat "Connecting to:" $sbserverdesc_ ]
menuitem ""
menuitemvar [ result $sbbreason ]
menuitemtextinput "Password: " [] [ sbpass = $arg1 ]
menuitemcheckbox "Connect as admin" 0 [ conasadmin = $arg1 ]

menuitem " 2    [ Connect ]" [ closemenu "Server Password"; if $conasadmin [ connectadmin $lastIP $lastport $sbpass ]  [ connect $lastIP $lastport $sbpass ] ]


alias sbconnect [
lastIP = $arg1; lastport = $arg2; sbserverdesc_ = $arg7
if (= $arg5 1) [ sbbreason = " 2This server is mastermode private. Admin pass is required."; sleep 10 [ showmenu "connect with password" ] ] [
if (= $arg6 1) [ sbbreason = " 3You are banned from this server. Admin/deban pass is required."; sleep 10 [ showmenu "connect with password" ] ] [
if (= $arg6 2) [ sbbreason = " 3You are blacklisted from this server. Admin/deban pass is required."; sleep 10 [ showmenu "connect with password" ] ] [
if (= $arg6 3) [ sbbreason = " 3You are banned and blacklisted from this server. Admin/deban pass is required."; sleep 10 [ showmenu "connect with password" ] ] [
if (= $arg4 1) [ sbbreason = " 7This server is password protected."; sleep 10 [ showmenu "connect with password" ] ] [
connect $arg1 $arg2; echo connecting to $arg7 ]
]
]
]
]
                ]
Thanks given by:
Epic stuff Gibbeh! :D



Random map/match script:
// Random map/match script by DES|Bukz
alias offmaplist [ac_aqueous ac_arabian ac_arctic ac_arid ac_complex ac_depot ac_desert ac_desert2 ac_desert3 ac_douze ac_elevation ac_gothic ac_iceroad ac_ingress ac_keller ac_mines ac_outpost ac_power ac_rattrap ac_scaffold ac_shine ac_snow ac_sunset ac_toxic ac_urban ac_werk]
alias mltmdelist [tdm dm lms ts ctf pf lss osok tosok htf tktf ktf]
alias rndmap [
    map (at $offmaplist (rnd (+ (listlen $offmaplist) 1)))
]
alias rndmatch [
    ((at $mltmdelist (rnd (+ (listlen $mltmdelist) 1))) (at $offmaplist (rnd (+ (listlen $offmaplist) 1))))
]

addOnQuit [offmaplist = ""; mltmdelist = ""; rndmap = ""; rndmatch = ""]

docsection [RND]

docident [rndmap] [Loads a random official map.]

docident [rndmatch] [Loads a random mode on a random map.]

Use:
/rndmap // Loads a random map.
/rndmatch // Loads a random mode on a random map.
Commands to use the script.

Singleplayer and coop modes were left out intentionally.
Thanks given by:
Easily play bots on custom maps script:

http://pastebin.com/raw.php?i=h2jLCBBL

Use the:
/cstbot
...command to show the menu which allows you to choose what map, mode, total # of players (including yourself), and skill level of the bots, then click "START". :)

Protips: Use even numbers when choosing # of bots for BTDM, (ie choosing 8 will put 4 bots on the enemy team, and 3 on your team, for a 4 on 4) and don't try using a value higher than 32.

Enjoy! :)
Thanks given by:
Custom map settings script for every map you play:

http://pastebin.com/raw.php?i=aDzN0si3

Use:
/cstmap // Shows the custom settings menu for the current map.
/cstmapsets // Enables or disables the custom settings script.
...to use the script.

The menu lets you customize what gamma and fog you want to be applied for that map. AC should remember the values that you set for next time, so you should be able to set it once per map and forget it! :)

Some notes:

Quote:Custom map settings for every map you play on script by DES|Bukz
NOTE: Because this script will create two aliases for every map
you play on, over time, your saved.cfg may become over cluttered
and begin to cause errors. The problem will be more severe if you
play on a lot of different custom maps. This script also depends
on saved.cfg storing the aliases and remembering them when AC is
launched, therefore it won't play well with other scripts that
rely on the same thing; such as the "My Personal Ladder" script.
Currently only has fog and gamma variables, suggestions welcome.

Triple post spam woooooo. ♥
Thanks given by:
Whoooooo likes self-recursive conline checking?! :D
At the speed of sleep 0, here's conloop.cfg:
// Generic looping conline checker by DES|V-Man.
// Requires check2add.cfg.
if (checkalias if_conline_list) [] [alias if_conline_list ""]

alias if_conline_has [
alias check_for $arg1
if (strcmp $arg2 "but_not") [
alias has_not $arg3; alias action_if_yes $arg4; alias action_if_no $arg5
if (&& (strstr $conline $check_for) (! (strstr $conline $has_not))) [action_if_yes] [action_if_no]
] [
alias action_if_yes $arg2; alias action_if_no $arg3
if (strstr $conline $check_for) [action_if_yes] [action_if_no]]; alias has_not ""]

alias add2conloop [ addcheck if_conline_list $arg1 ]

alias conloop [
if_conline_list
conline [ ]
sleep 0 [conloop]]

addcheck_msa conloop

// Example:
// add2conloop [
// if_conline_has "you fragged" but_not "teammate" [+= frags 1] [
//  if_conline_has "you fragged teammate" [-= frags 1] [
//   if_conline_has "you knifed teammate" [-= frags 1] []]]
// if_conline_has "cheat" but_not "don't" [say "don't talk about cheating!"] [
//  if_conline_has "cheat" but_not "stop" [say "don't talk about cheating!"] []]]

docsection [Custom]

docident [add2conloop] [Adds entries to a system's "if_conline_list".];
docargument [E] ["if_conline_has" entries];
docexample [add2conloop [if_conline_has "fragged" but_not "you" [+= otherplayersfrags 1] [+= frags 1]]] [Adds the entries to the conline checker.];
docremark [Can be used in a nesting manner like other, similar CubeScript commands. See "if_conline_has".];

docident [conloop] [Loops through the conline output, searching for given cues and executing pertinent commands.];
docremark [Is added automatically to mapstartalways to enable conline culling at all times.];

docident [if_conline_has] [Checks conline for specific strings and returns the given commands.];
docargument [S] [The string to search for.];
docargument [B] [Can be "but_not" to indicate that the next argument is an exception; otherwise, it is the command to execute if the first argument is found in conline.];
docargument [X] [Is either the exception (if the second argument is "but_not") or the command to execute if the first argument is not found in conline.];
docargument [Y] [The command to be executed after conline passes the tests of the first and third arguments.];
docargument [N] [The command to be executed after conline fails the tests of the first and second arguments.];

Also available on Akimbo!
Thanks given by:
Double-post spam FTW! ♥
pauseconline:
// pauseconline.cfg -- make the conline hold still while you browse it! By DES|V-Man
// Bind "pauseconline" and "unpauseconline" to specific keys for the most efficient use.
alias pauseconline [
if (strcmp $conline " ") [] [
conskip 1; conline [ ]]
sleep 0 [pauseconline]]

alias unpauseconline [push pauseconline []; sleep 1 [pop pauseconline]]
Added to Akimbo, in case you can't see the script above
(shrug, lol)
Thanks given by:
Thanks to DES|Bukz for spending nearly two hours helping me (ok, he did all the hard work :D) wicked sweet script.
Auto whois everyone when you connect to a server, and auto whois new players as they connect:
autogetdemo = 0

if (checkalias whoisdall) [] [
        whoisdall = 0
]

checkplayers = [
        if (strstr (at $conline 0) "connected") [
                whois (findcn (at $conline 1))
                conline [  ]
        ] []
        if (= $connected 0) [whoisdall = 0] []
        sleep 0 [checkplayers]
]

if (strstr $mapstartalways checkplayers) [] [
        add2alias mapstartalways [
            if (&& (= $connected 1) (= $whoisdall 0)) [
                whoisdall = 1
                loop e 21 [whois $e]
            ] []
            if (&& (= $connected 1) (= $autogetdemo 1)) [
                getdemo
                autogetdemo = 0
            ] []
            checkplayers
        ]
]

if (strstr $start_intermission autogetdemo) [] [
    add2alias start_intermission [autogetdemo = 1]
]

Useful for logging purposes: I made a folder called logs and use this launcher for example:
assaultcube -T > ~/.assaultcube_v1.1/logs/$(date +%d.%m.%y_%H%M%S)\.log
and I end up with timestamped log files of all the standard output named the date and time I started the client.

EDIT: I added automatic demo recording. It only works if you are connected and have finished a match (you don't have to have played the entire thing however).
Thanks given by:
Bukz you make everything I do obsolete :((
Thanks given by:
@Gibstick: Your efforts aren't obsolete until I finish posting this.

I've grouped all the meta-scripting tools I've crafted over the past few months and consolidated them into one config file:
http://www.akimbo.in/files/index.php?act=view&id=723
Documentation and instructions included in the zip file.
@DEKiMA:
The script you wrote, with this config file installed, can be accomplished using this much code:
add2conloop [if_conline_has "connected: " [whois (findcn (at $conline 1))] []]
addcheck_msa [loop e 21 [whois $e]]
:D Welcome to the new dawn of scripts.
Thanks given by:
(14 Dec 10, 04:01PM)DES|V-Man Wrote: @DEKiMA:
The script you wrote, with this config file installed, can be accomplished using this much code:
add2conloop [if_conline_has "connected: " [whois (findcn (at $conline 1))] []]
addcheck_msa [loop e 21 [whois $e]]
:D Welcome to the new dawn of scripts.

Thanks, but because he spent so much time on it and it works perfectly, I'll use Bukz's. Also you use mapstartalways for the inital whois which doesn't work quite as neatly as only using when connecting to a server for the first time. Correct?
Thanks given by:
Correct, in which case you can merely change the second line to this:
addcheck_sb [add2alias mapstartonce [loop e 21 [whois $e]]]

I prefer the whoisall at every new map load because the players will have changed a bit -- but, with this monitoring every "connected: ", all of that will be kept track of. Good script. :D

Also, the main reason for using a consolidated looping conline check is so that any number of stats can access one script instead of fighting over alias names and system resources (Bukz and I have a ton of scripts with aliases named "conlinecheck" that all do different things, each causing the last one to throw errors). This allows a single alias to be modified at will by outside scripts wanting a piece of the conline.
Thanks given by:
First, a question (?)
What does add2conloop do? Is conloop something that I am missing?

Another couple pieces of advice.
First, I will almost always (now-a-days) prefix (or suffix) my aliases with a short thing describing what they are used for. So you could do who_checkplayers (checkplayers_who) or whois_checkplayers (checkplayers_whois). I may or may not use these prefixes for aliases the user uses, as these tend to be the ones in the lesser amount.
Second piece of advice, scan around other scripts, and find techniques used in these to use in yours. I have recently plucked a couple lines out of "My Personal Ladder" as these made initializing my variables much easier, and the script was just beautiful anyhow!
Thanks given by:
If the tools.cfg file is properly installed, conloop is an alias that is automatically put into mapstartalways. It executes "if_conline_list", which contains commands you give to it via add2conloop. After executing those commands, it clears the conline and calls itself.
alias add2conloop [ addcheck if_conline_list $arg1 ]

alias conloop [
if_conline_list
conline [ ]
sleep 0 [conloop]]

You can put anything in using add2conloop, but I mostly made it for the console-condition-checking "if_conline_has":
add2conloop [if_conline_has "connected: " [whois (findcn (at $conline 1))] []]

And yes, some of the tools were thrown in to the stats script to make things easier for me and Bukz. ;-)
Thanks given by:
Demo "rewind" workaround script:

http://pastebin.com/raw.php?i=kAjdpRy2

Use:
/rewind
...to use the script. The command only requires 1 argument, and that is the minutes remaining that you want the script to fast forward to after it restarts the demo for you. I didn't add error catching in (checking for valid minutes remaining) - so you'll have to make sure you're giving it a valid value ahead of time. :P
e.g.
/rewind 6 // Restarts the demo you are watching and skips to minutes remaining 6 as fast as possible.

HTH all :)
Thanks given by:
A novel script for warning people
My first (successful) script :D

NOTE: Replace |FOX|Thrawn with your own name, i dont like impersonators :D
// By Thrawn
alias WARNING1 [
     name "WARNING"
     me "KEY HAS BEEN PRESSED!!!!"
]

alias WARNING2 [
     me "KEY HAS BEEN RELEASED: YOU HAVE BEEN WARNED!"
     name "|FOX|Thrawn"
]
bind 7 [WARNING1; onrelease [WARNING2]]
Thanks given by:
(10 Jan 11, 01:04AM)Thrawn Wrote: A novel script for warning people
My first (successful) script :D

NOTE: Replace |FOX|Thrawn with your own name, i dont like impersonators :D
Uh... what?
Thanks given by:
(10 Jan 11, 05:15PM)eftertanke Wrote:
(10 Jan 11, 01:04AM)Thrawn Wrote: A novel script for warning people
My first (successful) script :D

NOTE: Replace |FOX|Thrawn with your own name, i dont like impersonators :D
Uh... what?

ok, see the line that reads:
name "|FOX|Thrawn"

Replace |FOX|Thrawn with whatever your name is
Thanks given by:
// Client counting ident script by DES|Bukz
alias curplayers [
    players = 0
    if (= $connected 1) [
        loop x 21 [
                if (= (at (pstat_score $x) 4) -1) [] [
                        += players 1
                ]
        ]
        result $players
    ] [result -1]
]

docsection [Server]
docident [curplayers] [Returns the current number of clients on the server.]
docremark [If executed while not connected to a server, it will return -1]
docexample [/echo (curplayers)] [Output: 6]

A new homemade ident that returns the current number of clients (players) on the server. This return is done silently as almost all cubescript idents, therefore an echo is required to *see* it's result. But, it will still work within any scripts you may incorporate it into. :)

Note: It requires no arguments.
Thanks given by:
Wouldn't it be easier to look at the scoreboard?
Thanks given by:
Wolf: write me a script that looks at the scoreboard
Thanks given by:
(10 Jan 11, 07:30PM)Thrawn Wrote: ok, see the line that reads:
name "|FOX|Thrawn"
Replace |FOX|Thrawn with whatever your name is
No... I just don't understand the purpose of the script.
Thanks given by:
Well for instance, this is a functionality that I've always wanted because my internet is so crappy and I can only play on servers with a certain # of players, when the server becomes too full I get too laggy, so:

// Personal max client threshold script by DES|Bukz
// Requires the "curplayers" script, get it from this link:
// http://forum.cubers.net/thread-38-post-32722.html#pid32722
if (checkalias climit) [] [
    climit = 21
    autodc = 0
    autocl = 0
]

alias checkclimit [
    if (< (curplayers) $climit) [] [
        add2alias mapstartonce [
            echo (c 3)The server has reached your predefined max client limit.
        ]
        if (= $autodc 1) [ disconnect ] []
    ]
    sleep 0 [ checkclimit ]
]

if (strstr $mapstartalways checkclimit) [] [
    add2alias mapstartalways [
        if (= $autocl 1) [ checkclimit ] []
    ]
]

newmenu "climit"
menuitemtextinput [ Max client limit: ] [ result $climit ] [ climit = $arg1 ]
menuitemcheckbox [ Auto-disconnect upon reaching threshold? ] [ $autodc ] [ autodc = $arg1 ]
menuitemcheckbox [ Enable the script? *Must be checked to function ] [ $autocl ] [ autocl = $arg1 ]
menuitem "                           OK" [ closemenu "climit" ]

Use:
/showmenu climit
...to bring up the script's menu, here you can set yourself a personal max client limit and choose whether or not to have your client automatically disconnect from the server when it's reached the limit. Keep in mind this number includes you so if you wanna be able to play with 11 other people at most (for a 6 on 6 or w/e), you'll have to set the limit to 13. By default the script does nothing, of course.

Useful for when some of the only good servers around ATM are ones with high maxclients that your internet can't handle, and you're lazy like me ofc. :P

Not really something that glancing at the scoreboard can pull off. This of course, is one of many examples I could of used - first one that came to mind since I've been craving it. :D
Thanks given by: