Originally Posted by
mrgadosh
Hey I don't understand anything about scripts
But hey pretty cool
The script simply multiplies the player input by pi.
Problem with this script though, is that it'll try to multiply anything that the player says, even letters, words or sentences.
Here's how I'd do it:
PHP Code:
// Created by Kirzey
function onCreated() {
showcharacter();
this.head = "head0.png";
this.colors[0] = "orange";
this.colors[1] = "white";
this.colors[2] = "blue";
this.colors[3] = "red";
this.colors[4] = "black";
this.shield = "no-shield.png";
this.dir = 2;
this.chat = "Tell me the diameter (in centimers) of the circle which it's circumference you want to know?";
setcharani("idle",null);
}
function onPlayerChats() {
if (player.chat.start("a","b", "c","d","e","f","g","h","i","j","k","l","m","o","p","q","r","s","t","u","v","w","x","y","z")) { //If the players chat starts by a letter, return. The NPC will say "-3.141592653"
return; //which is an error. (Can't multiply letters)
} else { //Else, if the players chat starts by a number
this.chat = player.chat * pi; //Multiply the players chat by Pi
}
}