Whoooooo likes self-recursive conline checking?! :D
At the speed of sleep 0, here's conloop.cfg:
Also available on Akimbo!
At the speed of sleep 0, here's conloop.cfg:
[SELECT ALL] Code:
// 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!