Half-Life Console HelpYou know from binding your keys that all of the player movement controls (forward, duck, etc.) are just console commands that can be executed from a script. So it's possible (but sometimes tricky) to make scripts that control your player and cause it to do a difficult task, like rocket-jumping, or long-jumping (that duck-jump trick you have to have the power module to do in the game). The concept is easy, but in practice, the differences in lag and ping from game to game make it difficult to make reliable control scripts that work well over a wide range of network conditions (high/low ping or lag). Here's an example to clarify this point: alias +lj "+forward; +duck; wait; wait; wait; wait; wait; wait; +jump"This script makes pressing the 'x' key start moving forward, start ducking, wait a bit, and then start jumping. Releasing the 'x' key makes the player stop jumping, stop ducking, and finally stop moving forward. That's the recipe for the long-jump (again, it only works if you have the long-jump module). So what's tricky? See that sequence of six wait statements? Each one just lets one game tick go by, and so this script assumes that, from the time you start ducking, six ticks is enough time to get fully ducked. As you know, it can take more or less time to duck depending on how fast and good your connection to the server is, so six is really just a guess. If your ping is too high to get fully ducked in six ticks, the script will fail (you won't long jump). That's not a big deal here -- so the jump fails, but in more complex scripts that may be changing modes and re-binding keys on-the-fly, an incomplete command can wreak havoc on your configuration and leave you with keys improperly bound, incomplete aliases, or worse. So, if your ping and lag to the servers you play most often is pretty much constant, you can tweak the number of wait's in your scripts to get them right and leave them alone. If your ping is really high, you may find yourself with huge strings of wait's and possibly errors from excessively large script files (see Debugging Your Scripts). Here's a trick that can help reduce the problem: alias w5 "wait; wait; wait; wait; wait"With that script fragment in your config, you can use w5 wherever you need five wait's, w10 inplace of 10, etc. The same idea can be used to shorten any other frequently-used command(s) in your scripts, such as alias devon "developer 1" ; alias devoff "developer 0" so that your scripts can echo messages to the screen (and not just the console) with something like devon; echo "text"; devoff. That's useful, but it doesn't
help you any if your internet connection quality (ping and lag) changes
from day to day (or hourly!) The right number of wait's for a low ping
will cause incomplete commands at high ping, and the right number of wait's
for a high ping will add unnecessary delay to your scripts (you can't move
or do anything while waiting, and it's noticeable and annoying if there's
too much delay). If your ping is all over the place but you still want
to try scripts, I strongly recommend that you use a method like
the following:
|