Esempio n. 1
0
        if ($varName == "name" || $varName == "descrpition" || $varname == "speices" || $varName == "hp" || $varName == "itemsCarried") {
            $this->{$varName} = $newVal;
            return true;
        } else {
            return false;
        }
    }
}
class player extends character
{
}
$cli = new cli();
$chk = new chk();
$knettenba = new character($cli, "CAT", "Cat", 22, "Bugger all.");
$knettenba->ask("I SPEeAAK. MROWL.");
$knettenba->say("Hello, my name is " . $knettenba->getVar("name") . ".");
$knettenba->updateVar("name", "TWAT");
$knettenba->say("Hello, my name is " . $knettenba->getVar("name") . ".");
//cho $cli->out("", "p");
//while(
$chk->inpContains("What are birds?", array(1 => array("We just don't know", "don't know,", "I don't know")), array("BOLLOCKS!", "We just don't know."))["outputKey"];
/*
$chk->inpContains(
	"You walk into x room. In the room is a table. On the table is a loaf of BREAD.",
	array(array("eat","bread"), array("leave", "exit"),array("knife", "cut", "chop", "slice"))
	array(0 => "NONSENSE", 1 => "You eat the bread. OMNOMNOM", "You f**k RIGHT OFF. You have no interest in this silly room.", "You realise kthere is a bread knife! Such fun! You carefully slice the bread and eat it. OM TO THE NOM TO THE NOM. Yes. Good."));
*/
$chk->inpContains("Having enjoyed the delicious bread, you look around you. There is a cat under the table.", array(array("pet", "stroke", "touch", "play"), array("eat", "kick"), array("leave", "exit")), array(0 => "NONSENSE", 1 => "You pet the cat. The cat is happy. You wish that for you, happiness was so simple.", "You monster.", "Oh fine. I didn't want you to play this game anyway."));
$cli->out("The cat is a magic cat. You can tell this because of its pointy purple hat with stars on it. Magic cats, as everybody knows, can talk.");
$x = true;
$name = $knettenba->ask("Hello oddly hairless one. What is your name?", "p");