Scripting Library

Learn to write your own TradeWars scripts

Lesson 1: Send and Wait

Every script does two things: send a command, wait_for the response.

# Wait for the command prompt, then send a command
wait_for("Command [TL=00:00:00]:[1]?")
send("I")

# Wait for the info menu, then go back
wait_for("Information")
send("Q")

The wait_for looks at what the game actually sent. The send types your command. That's it. Everything else is just repeating this pattern.

Lesson 2: Reading the Screen

Your script sees what you see. Learn the prompts:

Match on the exact text. If the game says "Command" and you wait for "command" (lowercase), it won't match. Case matters.