Help - Search - Members - Calendar
Full Version: Weird problem with my scripts.
Unknown Worlds Forums > Natural Selection > Natural Selection Creation > Scripting Discussion
GreyFlcn
Kinda sucks, they decide they all want to run automatically.
Wish I could find a way to stop them from doing this.

Here's how it looks like when I don't initialize the aliases.

Is that just a weird quirk of Natural Selection that I have to deal with?

IPB Image

Does this every time I use the console
And many times right when I join.

Whats up with it?

Here's the code I'm using:

CODE

//Request + Respond to Orders
alias "+orders" "impulse 123"
alias "-orders" "impulse 80"
bind "f1" "+orders"
bind "[" "+orders"

//Request + Respond to Health
alias "+health" "impulse 125"
alias "-health" "impulse 10"
bind "f2" "+health"
bind "f5" "+health"

//Request + Respond to Ammo
alias "+ammo" "impulse 124"
alias "-ammo" "impulse 11"
bind "f3" "+ammo"
bind "," "+ammo"

//Weld Me / Healspray Me / Select All Troops
alias "+weld" "impulse 105"
alias "-weld" "impulse 14"
bind "f4" "+weld"

// Join Marines / Acknowledged
alias "+Marines_Acknowledged" "impulse 81"
alias "-Marines_Acknowledged" "jointeamone"
bind "f6" "+Marines_Acknowledged"

//  Join Aliens / Follow Me
alias "+Aliens_Follow" "impulse 7"
alias "-Aliens_Follow" "jointeamtwo"
bind "f7" "+Aliens_Follow"

// Join AutoAssign / I'll Cover You
alias "+Auto_Cover" "impulse 8"
alias "-Auto_Cover" "autoassign"
bind "f8" "+Auto_Cover"

// Taunt / Chuckle / Exit Comm Chair
alias "+Taunt_ExitComm" "impulse 9"
alias "-Taunt_ExitComm" "stopcommandermode"
bind "t" "+Taunt_ExitComm"

// Ready Room
bind "f9" "readyroom"

// Quit Prompt
bind "f10" "quit prompt"
digz
Do you exec your script manually or do you launch it in your config.exe?
GreyFlcn
QUOTE(digz @ Jan 1 2007, 09:57 AM) [snapback]1593719[/snapback]

Do you exec your script manually or do you launch it in your config.exe?

Well when the picture is shown, thats just with the keys bound and no code to back it up.
Before I was running it from userconfig.cfg

It seems to run all the -alias binds everytime I either open the console, map changes, or connect to a new server.
Which can be annoying since it autojoins Marines, and keeps spamming "Need a MedPack"

So yeah, my problem is, how do I cause it not to keep running all the -commands.

About all I can think of is to make it so that they aren't registered inside the config.cfg file.
Which might work, but I was hoping this was something that could be done legit for other players.

For something like this:
http://www.greyfalcon.net/nskeys2.png


============================================================

Here's what my config.cfg looks like.
The order which it runs the commands is in the same sequence as config.cfg

CODE

// This file is overwritten whenever you change your user settings in the game.
// Add custom configurations to the file "userconfig.cfg".

unbindall
bind "TAB" "+showscores"
bind "ENTER" "messagemode"
bind "ESCAPE" "cancelselect"
bind "SPACE" "+jump"
bind "'" "+moveup"
bind "+" "sizeup"
bind "," "+ammo"
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 "=" "sizeup"
bind "[" "+orders"
bind "]" "+weld"
bind "`" "toggleconsole"
bind "a" "+moveleft"
bind "b" "impulse 100"
bind "c" "slot3"
bind "d" "+moveright"
bind "e" "slot2"
bind "f" "slot5"
bind "g" "impulse 3"
bind "h" "impulse 10"
bind "i" "needmedpack"
bind "j" "impulse 11"
bind "k" "impulse 81"
bind "l" "impulse 105"
bind "m" "amx_menu"
bind "n" "STEAM_0:1:1126072"
bind "o" "impulse 80"
bind "p" "say rollthedice"
bind "q" "slot1"
bind "r" "+reload"
bind "s" "+back"
bind "t" "+Taunt_ExitComm"
bind "u" "messagemode2"
bind "w" "+forward"
bind "x" "impulse 14"
bind "y" "messagemode"
bind "z" "slot4"
bind "~" "toggleconsole"
bind "BACKSPACE" "+showmap"
bind "UPARROW" "+forward"
bind "DOWNARROW" "+back"
bind "LEFTARROW" "+left"
bind "RIGHTARROW" "+right"
bind "ALT" "+voicerecord"
bind "CTRL" "+duck"
bind "SHIFT" "+showmap"
bind "F1" "+orders"
bind "F2" "+health"
bind "F3" "+ammo"
bind "F4" "+weld"
bind "F5" "+health"
bind "F6" "+Marines_Acknowledged"
bind "F7" "+Aliens_Follow"
bind "F8" "+Auto_Cover"
bind "F9" "readyroom"
bind "F10" "quit prompt"
bind "INS" "+klook"
bind "PGDN" "+lookdown"
bind "PGUP" "+lookup"
bind "END" "centerview"
bind "MWHEELUP" "+attack"
bind "MOUSE1" "+attack"
bind "MOUSE2" "+use"
bind "MOUSE3" "+popupmenu"
bind "MOUSE4" "lastinv"
bind "PAUSE" "pause"
_snd_mixahead "0.1"
ati_npatch "1.0"
ati_subdiv "2.0"
bgmvolume "1.000000"
bottomcolor "144.889999"
brightness "2"
cl_allowdownload "1"
cl_allowupload "1"
cl_autohelp "0"
cl_buildmessages "0"
cl_centerentityid "0"
cl_cmdbackup "2"
cl_cmdrate "30"
cl_cmhotkeys "qwerasdfzxcv"
cl_dlmax "128"
cl_download_ingame "1"
cl_dynamiclights "1"
cl_forcedefaultfov "0"
cl_gammaramp "1"
cl_highdetail "1"
cl_himodels "0"
cl_idealpitchscale "0.8"
cl_labelmaps "1"
cl_lc "1"
cl_logocolor "#Valve_Orange"
cl_logofile "lambda"
cl_lw "1"
cl_musicdelay "90.000000"
cl_musicdirectory ""
cl_musicenabled "0"
cl_musicvolume "155.000000"
cl_particleinfo "0"
cl_quickselecttime ".15"
cl_timeout "60"
cl_updaterate "20"
cl_vsmoothing "0.05"
con_color "255 180 30"
console "1.000000"
crosshair "1.000000"
fps_max "72.0"
fps_modem "0.0"
gamma "3"
gl_dither "1"
gl_flipmatrix "0"
gl_fog "1"
gl_monolights "0"
gl_overbright "0"
gl_polyoffset "0.1"
hisound "1"
hpk_maxsize "4"
hud_capturemouse "1"
hud_centerid "0"
hud_classautokill "1"
hud_draw "1"
hud_fastswitch "1"
hud_takesshots "0"
joystick "0"
lookspring "0.000000"
lookstrafe "0.000000"
m_filter "0"
m_forward "1"
m_pitch "0.022000"
m_side "0.8"
m_yaw "0.022"
model "barney"
MP3FadeTime "2.0"
MP3Volume "0"
mp_decals "300"
name "GreyFlcn"
net_graph "0"
net_graphpos "1"
net_scale "5"
r_bmodelhighfrac "5.0"
r_detailtextures "0"
s_a3d "0"
s_automax_distance "30.0"
s_automin_distance "2.0"
s_bloat "2.0"
s_distance "60"
s_doppler "0.0"
s_eax "0"
s_leafnum "0"
s_max_distance "1000.0"
s_min_distance "8.0"
s_numpolys "200"
s_polykeep "1000000000"
s_polysize "10000000"
s_refdelay "4"
s_refgain "0.4"
s_rolloff "1.0"
s_verbwet "0.25"
sensitivity "15"
skin ""
suitvolume "0.250000"
sv_aim "0"
sv_voiceenable "1"
team ""
topcolor "151.169998"
viewsize "110"
voice_enable "1"
voice_forcemicrecord "1"
voice_modenable "1"
voice_scale "1"
volume "0.930000"
+mlook
+jlook
exec userconfig.cfg
GreyFlcn
I guess one thing I can think of, is to exploit the binding mechanism.

Adn make it so that an early obscure alphanumeric key blanks out all the binds
And an late key, like pause, redefines them.

_

Man just wish it there was a more legit way to do it sad-fix.gif
DON_MAC
This is something many people have noticed and I am not aware of any way to fix or stop -aliases from being executed like that. However, most, if not all of your aliases can be rewritten to not have -aliases in the first place.
CODE
//Request + Respond to Orders
alias "orders" "impulse 123; impulse 80"
bind "f1" "orders"
bind "[" "orders"

//Request + Respond to Health
alias "health" "impulse 125; impulse 10"
bind "f2" "health"
bind "f5" "health"

//Request + Respond to Ammo
alias "ammo" "impulse 124; impulse 11"
bind "f3" "ammo"
bind "," "ammo"
etc.

Hope this helps.
GreyFlcn
QUOTE(DON_MAC @ Jan 1 2007, 06:07 PM) [snapback]1593795[/snapback]

This is something many people have noticed and I am not aware of any way to fix or stop -aliases from being executed like that. However, most, if not all of your aliases can be rewritten to not have -aliases in the first place.
CODE
//Request + Respond to Orders
alias "orders" "impulse 123; impulse 80"
bind "f1" "orders"
bind "[" "orders"

//Request + Respond to Health
alias "health" "impulse 125; impulse 10"
bind "f2" "health"
bind "f5" "health"

//Request + Respond to Ammo
alias "ammo" "impulse 124; impulse 11"
bind "f3" "ammo"
bind "," "ammo"
etc.

Hope this helps.


Well that works, but it gets stopped cold on a mp_blockscripts server sad-fix.gif

The trick behind these press-release keys is that they run just fine on a mp_blockscripts server.

Ooh, now we might be getting somewhere

I'm finding that it can bind Shift + Key stuff
Which is impossible to bind ;D

Using these keys I can undefine and refine my keys smile-fix.gif

I think...
GreyFlcn
I guess the other way might be to have the key run an exec file, with multiple commands.

Maybe
DON_MAC
The three aliases I posted were tested on a bs_1 server and they all worked.
GreyFlcn
Ooh cool, seems to work for all those aliases
Uzguz
You might want to throw a wait in the middle of those two-impules aliases. The second impulse will probably be skipped otherwise.

Also, as to the original question, the console is indeed the culprit - every time you close it, the game emulates a release for every key and button. Most - aliases don't do anything particularly obnoxious, though, so unless you're using a Leap/Bite script, or something similarly useless, you probably won't have any trouble. If you have + commands that don't have - equivalents (to prevent command repetition, for instance, which happens sometimes), you can prevent the "unknown command" messages by defining empty - commands.
TheGuy
Key toggles are pretty simple. All you have to do is define a +keypress that changes binds or settings and another -keypress that changes them back


Here's a simple sensitivity toggle for when you hold down shift

alias +lowersens "sensitivity 2"
alias -lowersens "sensitivity 4"
bind shift +lowersens
GreyFlcn
QUOTE(Uzguz @ Jan 8 2007, 06:14 PM) [snapback]1596257[/snapback]

You might want to throw a wait in the middle of those two-impules aliases. The second impulse will probably be skipped otherwise.

Also, as to the original question, the console is indeed the culprit - every time you close it, the game emulates a release for every key and button. Most - aliases don't do anything particularly obnoxious, though, so unless you're using a Leap/Bite script, or something similarly useless, you probably won't have any trouble. If you have + commands that don't have - equivalents (to prevent command repetition, for instance, which happens sometimes), you can prevent the "unknown command" messages by defining empty - commands.

Well I've seen some other scripts define the -alias as "" in the config file, and then define it in the +alias
(and then maybe make the -alias undefine it when pressed)

Havene't really analyzed it that well.

So far, the easiest method I've seen is to make a
bind ! "+undodefines"
bind pause "+redodefines"

Uses the a of how the keys are ordered in the config.cfg

It's not fullproof though, since Tab, Capslocks, Shift, and Enter come before !

QUOTE(TheGuy @ Jan 8 2007, 06:59 PM) [snapback]1596271[/snapback]

Key toggles are pretty simple. All you have to do is define a +keypress that changes binds or settings and another -keypress that changes them back
Here's a simple sensitivity toggle for when you hold down shift

alias +lowersens "sensitivity 2"
alias -lowersens "sensitivity 4"
bind shift +lowersens

You missed the point of the thread. confused-fix.gif
Uzguz
QUOTE(GreyFlcn @ Jan 9 2007, 11:40 AM) [snapback]1596424[/snapback]

Well I've seen some other scripts define the -alias as "" in the config file, and then define it in the +alias
(and then maybe make the -alias undefine it when pressed)

Havene't really analyzed it that well.

So far, the easiest method I've seen is to make a
bind ! "+undodefines"
bind pause "+redodefines"

Uses the a of how the keys are ordered in the config.cfg

It's not fullproof though, since Tab, Capslocks, Shift, and Enter come before !

That first method seems fairly logical, assuming that the - alias actually does something other than nullifying itself. Only a couple of scripts come to mind that actually make use of - aliases, though, and most are a waste of time. I suppose the only useful ones that do so would be metabinds (i.e. "Shift for binds"), but I always thought those were overkill.

Of course, if you aren't using the - aliases, then simply declaring them without contents in the first place and leaving them that way is more than enough:
CODE
alias -uz_lastinv_reset ""

Oh, and I wouldn't use anything that relies on config.cfg's binding order. My programmer sense flinches at the insecurity.
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.