View Single Post
  #4  
Old 07-14-2006, 11:12 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by killerogue
This is me being the guy who started learning scripting today.

function onCreated(){
e = "Penguin";
say(e);
}


function onCreated(){
e = "Penguin";
player.chat = e;
;


Now, the first would make me say penguin with anything I said correct? And the second would be only when I said e?
You are actually looking for onplayerchats for saying stuff anf getting stuff back.
NPC Code:

function onPlayerchats() {
}



That will start the whole ball rolling, now you want to return something when you say e?

NPC Code:

if (player.chat == "e") {
}



and return something else otherwise?

NPC Code:

else{
say2("e");
}



Now lets put it all into practice.

NPC Code:

function onPlayerchats() {
if (player.chat == "e") {
player.chat = "Penguin";
}else{
say2("Penguin");
}
}



Hope I have helped you some.
Reply With Quote