Blockland Forums > Modification Help
Guide to Scripting/Chatbot Tutorial 2.0 -For the inexperienced.
<< < (11/12) > >>
alex dude:

--- Quote ---function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
  if (%msg $= "Hi") {

commandToServer('messageSent',"Hello!");

}
}

function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
  if (%msg $= "Pen0r") {

commandToServer('messageSent',"stop being gay");

}
}
};

--- End quote ---
Do i need to change the name of the function for it to work? or what? D:::
Chrono:
No you need to fix syntax errors.

You also can't put the same function twice in a package.
alex dude:

--- Quote ---package cakes {
function FirstMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::FirstMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
  if (%msg $= "Hi") {

commandToServer('messageSent',"Hello!");

}
}
};

function SecondMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::SecondMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
  if (%msg $= "Pen0r") {

commandToServer('messageSent',"stop being gay");

}
}
};

activatePackage(cakes);
--- End quote ---
?
Red_Guy:
you need a semicolon  ;   after each parent::  line.

otherwise you will get syntax errors
alex dude:
Hm, I seem to get no syntax errors but it does not seem to respond to the messages as i say them

--- Quote ---package cakes {
function FirstMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::FirstMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
  if (%msg $= "Hi") {

commandToServer('messageSent',"Hello!");

}
}


function SecondMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::SecondMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
  if (%msg $= "Sup") {

commandToServer('messageSent',"Yo");

}
}
};

activatePackage(cakes);
--- End quote ---
Navigation
Message Index
Next page
Previous page

Go to full version