Help - Search - Members - Calendar
Full Version: An odd effect with "releasing" console with aliases in config
Unknown Worlds Forums > Natural Selection > Natural Selection Creation > Scripting Discussion
the_x5
Let me explain what is happening. You hit the "~" key to pull up the console right? Well when I close it and go pack to the game I execute the alias code line: alias -enemyhear "say_team I can hear an enemy"

So this means everytime I go to the console people see me say "(TEAM) x5: I can hear an enemy" which gets really annoying and kind of defeats the purpose of that line.

Here is my full custom config file which is executed from config.cfg

CODE
// This file is executed from config.cfg

unbindall
bind "TAB" "+showscores"
bind "ENTER" "+jump"
bind "ESCAPE" "cancelselect"
bind "SPACE" "+speed"
bind "'" "+moveup"
bind "+" "sizeup"
bind "," "impulse 123"
bind "-" "sizedown"
bind "." "impulse 124"
bind "/" "impulse 125"
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
bind "9" "slot9"
bind ";" "+mlook"
bind "=" "+voicerecord"
bind "[" "messagemode"
bind "\" "lastinv"
bind "]" "messagemode2"
bind "`" "toggleconsole"
bind "a" "+moveleft"
bind "d" "+moveright"
bind "f" "impulse 100"
bind "i" "say /xmenu"
bind "m" "impulse 105"
bind "r" "+reload"
bind "s" "+back"
bind "t" "say /buildmenu"
bind "u" "messagemode2"
bind "v" "impulse 9"
bind "w" "+forward"
bind "x" "impulse 14"
bind "y" "messagemode"
bind "z" "impulse 7"
bind "~" "toggleconsole"
bind "BACKSPACE" "+reload"
bind "UPARROW" "+forward"
bind "DOWNARROW" "+back"
bind "LEFTARROW" "+moveleft"
bind "RIGHTARROW" "+moveright"
bind "ALT" "+use"
bind "CTRL" "toggleduck"
bind "SHIFT" "+duck"
bind "F1" "jointeamone"
bind "F2" "jointeamtwo"
bind "F3" "autoassign"
bind "F4" "readyroom"
bind "F5" "impulse 8"
bind "F6" "impulse 7"
bind "F7" "impulse 9"
bind "F8" "impulse 80"
bind "F9" "impulse 81"
bind "F10" "impulse 11"
bind "F11" "impulse 10"
bind "F12" "impulse 14"
bind "INS" "say_team Attack! Destroy target."
bind "DEL" "say_team Defend! Hold this position."
alias +enemyhear "impulse 13"
alias -enemyhear "say_team I can hear an enemy"
bind "PGDN" "+enemyhear"
alias +enemysee "impulse 13"
alias -enemysee "say_team I can see an enemy"
bind "PGUP" "+enemysee"
bind "HOME" "say_team Defend this position / Recon mode"
alias +enemykilled "impulse 15"
alias -enemykilled "say_team enemy eliminated!"
bind "END" "+enemykilled"
bind "KP_HOME" "impulse 201"
bind "KP_LEFTARROW" "slot4"
bind "KP_5" "slot5"
bind "KP_END" "slot1"
bind "KP_DOWNARROW" "slot2"
bind "KP_PGDN" "slot3"
bind "KP_ENTER" "impulse 3"
bind "KP_INS" "+showmap"
bind "KP_DEL" "impulse 3"
bind "KP_MINUS" "impulse 1"
bind "KP_PLUS" "invprev"
bind "KP_ENTER" "+popupmenu"
bind "*" "impulse 201"
bind "MWHEELDOWN" "+movement"
bind "MWHEELUP" "+movement"
bind "MOUSE1" "+attack"
bind "MOUSE2" "+popupmenu"
bind "MOUSE3" "+voicerecord"
bind "MOUSE4" "+speed"
bind "MOUSE5" "impulse 100"
bind "PAUSE" "pause"
sensitivity "4"
name "x5"
cl_autohelp "0"
cl_logocolor "#Valve_Red"
cl_logofile "x5"
echo "Custom binds loaded successfully"


What am I missing? confused-fix.gif
TG-Cain
When you close the console, the game emulates a key-release for all keys. This will cause all -aliases to execute.

Also, search is your friend. smile-fix.gif
Garet_Jax
I do lastinv when I close my console. Gives away my position as marine as I change weapon >_<

Keyboard is set to U.K. standard so it shouldn't be getting confused with the U.S. equivalent button (@ on a UK keyboard?)
a_civilian
A partial solution:
CODE

// if this doesn't work, you might need to alias each of these binds/unbinds
alias rebind_ "bind PGDN +enemyhear;bind PGUP +enemysee;bind END +enemykilled"
alias unbind_ "unbind PGDN;unbind PGUP;unbind END"

alias console_ "toggleconsole;unbind_"
bind joy1 +rebind // I use joy1 because it's never going to be used for any other purpose
alias +rebind
alias -rebind rebind_ // this executes on resuming the game
bind "`" "console_"
bind "~" "console_"

unbind_ executes when you hit the console key and unbinds the appropriate keys;
rebind_ executes on resuming the game (as joy1 is unpressed) and binds them again

This will prevent the execution of the -commands on resuming the game if you used the console key to escape, but not if you hit esc or minimized directly from the game. (esc cannot be rebound so this method cannot be applied there.)

But if the on-unpress functionality is not needed (as is probably the case here), a better solution would be to simply remove it.
Joe2
My old 3.1 +Ashowres can help you:

CODE
alias +Ashowres  "alias -Ashowres Astopshowres; wait; +showres"
alias -Ashowres  "wait"
alias Astopshowres "-showres; wait; alias -Ashowres wait"
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.