#pragma strict_types #include "/areas/Kordar/Kordarpaths.h" #include < items.h > // This include adds the content of a file called items.h. Include is good touse when you have several rooms that need the same defines (or functions).#include < macros.h >
// Just like in the game you can add defines to make your coding easier. macros.h contains lots of useful defines. It is located in /include/macros.h If you use those defines, your code will be more easy to read by others.inherit "/std/room/parse_room"; object monster;
// Creating object called 'monster'.int read_fun(string str);
// All the funcions except create_object need to be "declared" before you use them. You should always put them in the same order as they appear below in the code since they then also work as an "index" for your code and it will be much easier to find a specific function later when reading your code.
// A declaration simply means that you declare what type the function will return and what of what type the arguments it will accept are. int write_fun(string str); means that the function will return something of type integer and it will accept an argument str that will be of the type string.string text;
// Making a text variable called text.void create_object(void); void reset(void); void create_object(void) { setuid();
// When using create_object(), put this in otherwise the room will selfdestruct when in contact with a mortal.seteuid(getuid(this_object())); set_new_light(); add_property(""); set_short(""); set_long("\n"); add_item("",""); add_item("",""); add_item("",""); skip_obvious 1; add_exit(KCCi+"",""); add_exit("",""); reset(); } void init(void) {
// This function is called everytime a living objects can "see" the object. It is good to the set up add_action() in the init() routine.add_action("read_fun","read");
// First argument is what function to call. Second argumnet is the verb that // calls the function. There is also a optional third argument to add_action. // Man add_action to learn more about it ;) */} void reset(void) { if(!monster) { monster = make(KCM+""); } } int read_fun(string str) {
// This function is called when the player types "read". The variable str will have the value . If you want to get the verb "read", you have to use query_verb(); if (str == "blackboard"||str == "writing"||query_verb() != "read") { if (!text) write("The blackboard is empty.\n"); else write("'" + text + "' is written on the blackboard.\n"); return 1; } notify_fail("Read what?\n"); return 0;
// If you return 0; (or equivantly just return;) then whatever the player typed will be passed on to other add_actions(also in other objects). Usually this means that the player gets a "What?" because the verb doesn't match one of the other add_actions. Here notify_fail changes the fail response to "Read what?".}