Half-Life Console Help

Debugging and Troubleshooting Your Scripts 

What if you make a script and it just doesn't do what you expect? There are several common types of scripting mistakes to watch out for. Here are a few things to check:
 

  1. The most common script problem comes from not having enough wait's between commands that take some time to complete. The most common symptom is scripts that work partially, or intermittently. A bind command is instant (no wait required), while changing weapons can take 10, 20 or even more wait's (depending on your lag / ping) to complete. Trial and error works, but using the script Lag-Proofing method described earlier is easier and faster.

  2.  
  3. If you can't respawn after you die, or your player keeps doing some action endlessly (like firing, or running forward), make sure your scripts execute the corresponding -command for every +command. Remember that, if you die before the -command is executed, you may still get stuck! See the work-around for Avoiding Stuck-On Commands.

  4.  
  5. If the game exits as soon as your script is executed (on startup if it's the autoexec.cfg) with an "allocation" error, your script file is either too big, or it has a line in it that is too long. Either use aliases and multiple script files to break up the files and lines into smaller ones, or try adding the "-zone XXXX" command- line option (try XXX = 512, 1024, . . . ) to allocate more memory for scripts.

  6.  
  7. If the game locks up, crashes, or behaves erratically, look for alias loops and remove them. Examples were given above, but in general you can "execute" the scripts and aliases in your head as you read through. If you pass the same point twice without stopping, you're in a loop.

  8.  
  9. If you find that you have to press the key for your script or alias twice the first time to get it working, make sure you execute one of your aliases (the one with your preferred default settings) by just placing its name on a line by itself.

  10.  
  11. When in doubt, surround command arguments in quotes, especially arguments with spaces in them. 
[Previous Page] [Back to Console Index] [Next Page]