start ^ start ^ whatjusthappened >>
====== Hello World ======
Whenever you learn a new language, the first step is often to perform what is known as a "Hello World": it's a simple script that just prints out that statement but it confirms your environment has been set up. We can use this to test that your RC access has been setup and you know what to go.
The code looks like this:
function onCreated() {
echo("Hello, World!");
}
Don't worry if none if this makes sense right now: we will dive into all aspects as we go. For now, we can under stand that the moment this NPC is created, it will print "Hello, world!" somewhere. Let's make it happen!
First, we will hit the 'Weapons' button in RC: {{:learngs2:rc_weaponlist_normal.png?nolink&32x32}}
This will open a list of all the current Weapons in the server. For Testbed, this will be a lot.
//{{:learngs2:learning_helloworld_weapons.png?nolink&546x494}}//
From here, we want to press the 'Add' button down the bottom. This will open a prompt where we can enter the name for our weapon. If you are using the Testbed server, you will need to follow the standard naming convention. For me, this would be Personal/Twinny/HelloWorld . You would replace 'Twinny' with your account name. If you are unsure, open your rights and check what rights you have been given [TODO: prob add dedicated section]
{{:learngs2:learning_helloworld.png?nolink&322x143}}
When you hit OK, it will open a new window where you can create your weapon but it hasn't done so yet. It will only do so when you hit Apply. For now, enter the code as provided above:
{{:learngs2:learning_helloworld_code.png?nolink&812x376}}
Hit Apply and hopefully you will successfully create your first script and see the output in RC!
{{:learngs2:learning_helloworld_success.png?nolink&855x62}}
You've made your first successful script…hopefully! If you didn't see 'Hello, world!' you may have seen an error instead. Some examples:
Twinny prob: No write rights for WEAPONS/Personal/NotMe/HelloWorld
This is telling me I don't actually have rights to create a weapon with this name. If you see something like this, you will need to check your rights to confirm what weapons you can create (if any). [TODO: elaborate]
If you have been successful, we can move on! Let's go!