Quote:
|
Originally Posted by Twinny
PHP Code:
function onCreated() {
e = "Penguin";
}
function onPlayerchats() {
if (player.chat == "hello") {
message("I am a" SPC e);
}
}
Now when a player says hello in the room with that NPC, it will reply "I am a Penguin".
|
Would probably be better to use this.char (or just chat) instead of message to set the text. Also, you should avoid prefixless variables whenever possible, use this. or temp. instead.
PHP Code:
function onCreated() {
this.type = "Penguin";
}
function onPlayerChats() {
if(player.chat == "hello") {
chat = "I am a " @ this.type;
}
}