Making commands

Experienced Elementalist
Joined
Apr 13, 2010
Messages
280
Reaction score
18
Ok so this is the code you need to understand

Code:
if (command.equalsIgnoreCase("helloworld"))
{
sM("Hello World!");
}


Basics
Only tested on delta base.

The first line is what you type in to make the command work. Fir instance, in my example i have out helloworld. Which means in game i would type ::helloworld.
Code:
if (command.equalsIgnoreCase("helloworld"))


Then this is what the command does, here in this example it says hellworld. sM meaning call or say. so in the chat window it would say helloworld
Code:
sM("Hello World!");

Expanding
Well now you have the code things you can add are teleport co ordinates

Code:
if (command.equalsIgnoreCase("telehere"))
{
sM("You are teleported to enter what you want");
toX = x;
toY = y;
}


Enjoy
 
Fucking pathetic.

Not only do you need to learn your code conventions, but your command string should be array integrated.

String[] cmd;
cmd[0] = p.stream.readQString();
cmd[1] = p.stream.readQString().subString(1);

Or something like that. I don't know because I haven't worked on rsps for a while.
 
How is it exactly pathetic? It's that simple. Stability, your coding methods are a little more complicating and longer. They are also older and nowadays they would result in people saying that your client.java is too unorganized and full of useless things.
 
Back