logo Scripting for Enemy Territory

Menu


Home
Tutorials
Downloads
Forum
Contact

Friends





Basic tutorial 9

Echo command.

A lot of people use the say or vsay command in combination with their scripts, which can be pretty annoying to other people playing on the server. A good example is the so-called reload script. What does it do? Well as well as reloading when they press their reload key, it also says something like: "I'm reloading!" A script like this would look like this:
bind r "+reload; say_team I'm reloading!"

This script might look cool to some of you, but people don't give a damn if you are reloading. They'd rather have you keep that to yourself. If you still think you need a confirmation to know for sure that you are reloading, use an echo command and it will not show up in the chat area, but in the echo section:
bind r "+reload; echo I'm reloading!"
By the way, this is the part where all the game info shows up, like the obituaries.

The question of course when do you really this. The example above is not something sain people would use :D. There are scripts however, where you might not be able to exactly know what happened when you executed it. A good example is the sensitivity toggle from the previous tutorial:
bind x "vstr sens"
set sens1 "sensitivity 1; set sens vstr sens2"
set sens2 "sensitivity 1.5; set sens vstr sens3"
set sens2 "sensitivity 2; set sens vstr sens1"
set sens "vstr sens1"



Of course you can notice that your mouse sensitivity changes, when you press the bided key. But if you have pressed the binded key a couple of times you might not know where you are in the script, meaning you do not know which variable will be executed next time you press your binded key. So you might have lost track of at which sensitivity you are. If you just add echo commands to this script, then you can read in the echo section what the present sensitivity value is when you press the binded key. The script above would then look like this:
bind x "vstr sens"
set sens1 "sensitivity 1; set sens vstr sens2; echo Sens: 1.0"
set sens2 "sensitivity 1.5; set sens vstr sens3; echo Sens: 1.5"
set sens2 "sensitivity 2; set sens vstr sens1; echo Sens: 2.0"
set sens "vstr sens1"

Using the binded key now would not only change your sensitivity, but would also show the selected sensitivity in the echo section, like this:


So in short: you can use the echo command to point out to yourself what's happening in your script when using it. In the advanced section I will also show you another application of this command: Confirmation of execution.

Back to the tutorial list