Methods
Methods are like commands. Like commands, these can take certain arguments/parameters and do something with them. These are the building blocks of your scripts.
What classifies as a method?
For something to be classified as a method by the script, it needs to:
Be an existing method (findable in
serhelp methods)
π« SendMassiveMessage "Hello, World!"
β
Reply "Hello, World!"Be the first word in the line (exceptions apply, explained later)
π« test Reply "Hello, World!"
β
Reply "Hello, World!"Be the exact same case-wise
π« reply "Hello, World!"
π« REPLY "Hello, World!"
β
Reply "Hello, World!"What methods can I use?
The serhelp command will tell you! If you do serhelp methods, you will get a list of all methods you have at your disposal.
By the time you're reading this tutorial, the command could've changed a little. I advise you to verify by yourself if the command matches what is shown here.
Here's a small part of the output:
How to get information about a specific method?
You can do serhelp <methodName> to get info about a specific method. Let's run the serhelp Broadcast command and see what it gives us:
How to use that information?
So, let's say we want a broadcast cool broadcast to every player for 3 seconds, how to do that?
Well, we have 3 arguments:
playersargument
If we want this argument to mean "all players", we can just use *, which represents all players.
durationargument
This argument provides an example of how to use it. We need to provide seconds, so we can use the #s format, where we replace # with our number, so we can use 3s.
messageargument
This will be the text that will be displayed, so we provide "cool broadcast"
Providing text in SER
When providing text, you MUST put it inside quotes. If not, each word will be assumed to be a different argument, causing an error.
Using this information we can quickly make a player broadcast! Let's open the myScript.txt file in your SER folder, and add the following:
Now if you run this script, you should get a broadcast like this:
And that's it, you now know how to use methods!
Last updated