From EventScripts Community Encyclopedia
|
Create your first script for EventScripts. This will show you how to create a simple script addon.
Tutorial
In this tutorial, we'll create a simple "Hello World" script to test that you've installed EventScripts properly. This tutorial assumes that you've installed EventScripts on your dedicated server. (See the EventScriptsGuide for installation instructions.)
Steps
// My first script!
block load
{
es_msg My hello script has been loaded.
}
block unload
{
es_msg My hello script has been unloaded.
}
event player_spawn
{
es_msg Hello World! event_var(es_username) has spawned!
}
- Save es_hello.txt (or upload it to your server to the corresponding folder).
- Connect to your server from your game machine (on Windows)
- log into rcon as normal with rcon_password yourpasswordhere (this step not necessary if you are doing a listen server)
- in the console, type rcon es_load hello (if doing a listen server, don't put the rcon in front)
- Choose a team and try dying and respawning.
- Whenever a player spawns, you should see a message like this in the bottom left of your screen:
Hello World! xxxx has spawned.
- Once you prove that it's working, type rcon es_unload hello so that you don't see it all the time. (Once again, the rcon prefix is not necessary if you are doing a listen server)
Did it work?
- If you see the Hello World message, your installation was successful. Congratulations! You should try the next section of the EventScriptsGuide.
- If you do not see the message when you jump, something is wrong with your installation. Visit the Install Troubleshooting section or provide a detailed question in our forums. There's also an IRC channel for help, too.
|
|