# aichaos/rivescript-perl

### Subversion checkout URL

You can clone with
or
.
Fetching contributors…

Cannot retrieve contributors at this time

647 lines (569 sloc) 19.151 kB
Divided that by 2. * == 9 => We're done. Do you know what number I ^ \sstopped at? * == 10 => Subtracted 2 from that now. + (9|nine) % * do you know what number i stopped at - You're right, I stopped at the number 9. :) /****************************************************************************** * Object Macro Testing (Perl Only) * ******************************************************************************/ /* Encoding Object --------------- Human says: Encode something in MD5. Expected reply: "something" in MD5 is: 437b930db84b8079c2dd804a71936b5f Human says: Encode something in Base64. Expected reply: "something" in Base64 is: c29tZXRoaW5n */ > object encode perl my ($rs,$method,@args) = @_; my $msg = join(" ",@args); use Digest::MD5 qw(md5_hex); use MIME::Base64 qw(encode_base64); if ($method eq "md5") { return md5_hex($msg); } else { return encode_base64($msg); } < object + encode * in md5 - "" in MD5 is: encode md5 + encode * in base64 - "" in Base64 is: encode base64 > object testing javascript var w = screen.width; var h = screen.height; var dim = w + "x" + h; return dim; < object + test javascript - Testing javascript... testing. ! global topics = hello world + test global - Testing reserved global: topics=; users=; client=; reserved=. /****************************************************************************** * Topic Testing * ******************************************************************************/ /* Temporarily ignoring abusive users ---------------------------------- Human says: insert swear word here Expected reply: Omg you're mean! I'm not talking to you until you apologize. Human says: (anything) Expected reply: Not until you apologize. Say you're sorry. Apologize for being so mean. Human says: sorry Expected reply: Okay, I'll forgive you. */ + insert swear word here - Omg you're mean! I'm not talking to you until you apologize.{topic=apology} > topic apology + * - Not until you apologize. - Say you're sorry. - Apologize for being so mean. + [*] (sorry|apologize) [*] - Okay, I'll forgive you.{topic=random} < topic /* Topic Inheritence (simple roleplaying game) ------------------------------------------- Human says: enter the dungeon Expected reply: (drops you into a mini game. Skim the code below to figure it out) */ + enter the dungeon - {topic=room1}You've entered the dungeon. {@look} > topic global + help{weight=100} - Game Help (todo) + inventory{weight=100} - Your Inventory (todo) + (north|n|south|s|east|e|west|w) - You can't go in that direction. + quit{weight=100} - {topic=random}Quitter! + _ * - You don't need to use the word "" in this game. + * - I don't understand what you're saying. Try "help" or "quit". < topic > topic dungeon inherits global + hint - What do you need a hint on?\n ^ * How to play\n ^ * About this game + how to play % what do you need a hint * - The commands are "help", "inventory", and "quit". Just read and type. + about this game % what do you need a hint * - This is just a sample RPG game to demonstrate topic inheritence. < topic > topic room1 inherits dungeon + look - You're in a room with a large number "1" on the floor.\s ^ Exits are north and east. + (north|n){weight=5} - {topic=room2}{@look} + (east|e){weight=5} - {topic=room3}{@look} < topic > topic room2 inherits dungeon + look - This room has the number "2" here. There's a flask here that's trapped ^ \sin some kind of mechanism that only opens while the button is held ^ \sdown (so, hold down the button then quickly grab the flask).\n\n ^ The only exit is to the south. + [push|press|hold] button [*] - You press down on the button and the mechanism holding the flask is\s ^ unlocked. + [take|pick up] [ye] flask [*] % * mechanism holding the flask is unlocked - You try to take ye flask but fail (you can't take ye flask, give up). + [take|pick up] [ye] flask [*] - You can't get ye flask while the mechanism is holding onto it. + (south|s){weight=5} - {topic=room1}{@look} < topic > topic room3 inherits dungeon + look - There's nothing here but the number "3". Only exit is to the west. + (west|w){weight=5} - {topic=room1}{@look} < topic