The Meaning of Life, the Universe, and Everything.
Join Date:
2/24/2013
Posts:
63
Member Details
I type /help but it instead shows the text for Aquairon. Here is the code.
//Storyline Adventure made by 9cookies070102
function procCmd(help){
clientMessage('Commands: (Make sure you add the /)');
clientMessage('craft Brings up crafting recipes.');
clientMessage('spawner Gives you the spawning tool for bosses');
clientMessage('quest Displays your current quest');
clientMessage('bossname Displays boss statuses');
clientMessage('[Boss Names]');
clientMessage('Aquairon');
clientMessage('Metallion');
};
function procCmd(Aquairon){
clientMessage('Aquairon');
clientMessage('The weakest of all bosses.');
clientMessage('Spawned by putting 4 blocks of iron');
clientMessage('around one water source block');
clientMessage('and putting two dirt blocks');
clientMessage('ABOVE the water. Do not get');
clientMessage('rid of the water');
clientMessage('Health: 100hp');
};
I type /help but it instead shows the text for Aquairon. Here is the code.
Super quick JavaScript tutorial.
function procCmd(Aquairon){
function <- this is a function
procCmd <- named procCmd
Aquairon <- when you receive the command name and parameters, put it in a variable named Aquairon
So when ModPE calls your code, it would find your procCmd method (there are two, so it would use the second one), put the command ("help") into a variable called Aquairon, and run code. So it would run your second ProcCmd, which doesn't check which command is running.
What you can do is this:
function procCmd(cmd) {
var arguments = cmd.split(" "); //split our command into several parts based on spaces.
if (arguments[0] == "help") {
clientMessage("Help lol");
} else if (arguments[0] == "aquairon") {
clientMessage("Aquairon lol");
}
}
Try taking a look at some JavaScript tutorials - they really do help. Try codecademy or w3schools.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSuper quick JavaScript tutorial.
function procCmd(Aquairon){function <- this is a function
procCmd <- named procCmd
Aquairon <- when you receive the command name and parameters, put it in a variable named Aquairon
So when ModPE calls your code, it would find your procCmd method (there are two, so it would use the second one), put the command ("help") into a variable called Aquairon, and run code. So it would run your second ProcCmd, which doesn't check which command is running.
What you can do is this:
function procCmd(cmd) { var arguments = cmd.split(" "); //split our command into several parts based on spaces. if (arguments[0] == "help") { clientMessage("Help lol"); } else if (arguments[0] == "aquairon") { clientMessage("Aquairon lol"); } }Try taking a look at some JavaScript tutorials - they really do help. Try codecademy or w3schools.