02 Nov 10, 12:00AM
Since they're important enough...
check2add.cfg:
findbind.cfg:
check2add.cfg:
[SELECT ALL] Code:
// check2add.cfg -- a sane way to generically standardize check-based alias addition by DES|V-Man
alias addcheck [if (strstr $arg1 $arg2) [] [add2alias $arg1 $arg2]]
alias add2bind [if (strstr (keybind $arg1) $arg2) [] [bind $arg1 (concat (keybind $arg1) ";" $arg2)]]
// Some commonly-used native aliases that do not get emptied
alias addcheck_msa [addcheck mapstartalways $arg1]
alias addcheck_si [addcheck start_intermission $arg1]
alias addcheck_onquit [addcheck onQuit $arg1]
alias addcheck_sb [addcheck sbconnect $arg1]
// A way to not only add aliases to be cleared OnQuit, but to also conveniently be able to see which aliases originate from specific scripts
alias addlistonquit [alias_list = $arg1; loop i (+ (listlen $alias_list ) 1) [addOnQuit (concat "delalias" (at $alias_list $i))]]
// example: at the end of any script, list each new alias you've introduced in a containing alias:
// alias newscript_aliases [newalias newalias1 newalias2 newalias3 newalias4 newalias5]
// addlistonquit $newscript_aliases
// They will be cleared on quitting the game, if users prefer to keep saved.cfg clear.
findbind.cfg:
[SELECT ALL] Code:
// findbind.cfg -- A method of back-searching for key commands, phrases, or aliases in keybinds -- by DES|V-Man
// includes bindcheck -- A method of ascertaining whether a key contains given commands, phrases, or aliases -- also by DES|V-Man
// Requires check2add.cfg.
alias bindcheck [if (strstr (keybind $arg1) $arg2) [result 1] [result 0]]
alias findbind [
alias bindloopresult []
alias fblc 0
alias itemtofind $arg1
findbind_loop
result $bindloopresult]
alias findbind_loop [
loop i 144 [if (bindcheck (at $keylist $i) $itemtofind) [alias bindloopresult (concat $bindloopresult (at $keylist $i))] []]]
alias keylist [ MOUSE1 MOUSE2 MOUSE3 MOUSE4 MOUSE5 MOUSE6 MOUSE7 MOUSE8 BACKSPACE TAB CLEAR RETURN PAUSE ESCAPE SPACE EXCLAIM QUOTEDBL HASH DOLLAR AMPERSAND QUOTE LEFTPAREN RIGHTPAREN ASTERISK PLUS COMMA MINUS PERIOD SLASH 0 1 2 3 4 5 6 7 8 9 COLON SEMICOLON LESS EQUALS GREATER QUESTION AT LEFTBRACKET BACKSLASH RIGHTBRACKET CARET UNDERSCORE BACKQUOTE A B C D E F G H I J K L M N O P Q R S T U V W X Y Z DELETE KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KP_PERIOD KP_DIVIDE KP_MULTIPLY KP_MINUS KP_PLUS KP_ENTER KP_EQUALS UP DOWN RIGHT LEFT INSERT HOME END PAGEUP PAGEDOWN F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 NUMLOCK CAPSLOCK SCROLLOCK RSHIFT LSHIFT RCTRL LCTRL RALT LALT RMETA LMETA LSUPER RSUPER MODE COMPOSE HELP PRINT SYSREQ BREAK MENU SZ UE OE AE ] // (listlen $keylist) = 144
// Method for dealing with multiple results in findbind
alias numbinds [listlen (findbind $arg1)] // number of keys having the designated term in their binds
alias add2eachbind [ // add2bind every key that has the designated term
alias addition $arg2
if (findbind $arg1) [
loop i (numbinds $itemtofind) [add2bind (at (findbind $itemtofind) $i) $addition]]]
// Example:
// add2eachbind reload [echo "reloading..."]