On November 23 2013 21:12 Manit0u wrote:
Why are you trying to re-invent the wheel? Get yourself some MUDlib and driver (they're usually free) and you can create entire worlds. Each room there is a separate object (class) and you have all the basic handling and interaction built-in.
http://en.wikipedia.org/wiki/Mudlib
Even if you don't make it this way, you can at least take a look at the code involved there and get some good ideas on how to handle such things. It's way easier than using some huge arrays since each room is a separate class you can easily add, remove and move stuff around.
Some tutorials:
http://discworld.starturtle.net/lpc/creating/lpc_basic/contents.html
http://discworld.starturtle.net/external/lpc_for_dummies/index.shtml
Example of a room done in LPC:
As a bonus you also get the entire network code and can set it up in 2 minutes time for multiplayer online play.
Why are you trying to re-invent the wheel? Get yourself some MUDlib and driver (they're usually free) and you can create entire worlds. Each room there is a separate object (class) and you have all the basic handling and interaction built-in.
http://en.wikipedia.org/wiki/Mudlib
Even if you don't make it this way, you can at least take a look at the code involved there and get some good ideas on how to handle such things. It's way easier than using some huge arrays since each room is a separate class you can easily add, remove and move stuff around.
Some tutorials:
http://discworld.starturtle.net/lpc/creating/lpc_basic/contents.html
http://discworld.starturtle.net/external/lpc_for_dummies/index.shtml
Example of a room done in LPC:
/*
This is a basic room!
Written by Drakkos.
29/09/2000
*/
inherit "/std/room";
void setup() {
set_short("blobby lair");
set_long("This is where the grey blob lives. All around lie "
"frogs, and wombles, and strange oozy things. It's a "
"very nice lair, as lairs go.\n");
add_property("determinate", "a ");
set_light(50);
add_item("frog", "The frogs are very nice. Very froggy.");
add_item("womble", "It's Uncle Bulgaria!");
add_item("strange oozy things", "Ewww!");
add_exit("east", "/w/your_name/workroom", "road");
}
void reset() {
call_out ("after_reset", 3);
}
void after_reset() {
object ob = find_object("/w/your_name/simple_npc");
// if (!ob) will return true if ob is 0... in other words, it
// didn't find an object with find_object().
if (!ob) {
// There's no object with that filename loaded, so we load it
// and then move it into this_object()... which in the case of
// this example, is the room we just coded.
ob = load_object("/w/your_name/simple_npc");
// For information on how the move() function works, you
// can check out 'help move'. But briefly, the first argument
// is where the object is to be moved to... the second is the
// message that objects in the destination get when the object
// enters. $N will be replaced with the short of the object.
// 'appear$s' is a pluralisation code... it will change to
// 'appear' when more than one object enters at the same time,
// and 'appears' when only one enters.
ob->move(this_object(), "$N appear$s with a wet squelch.");
}
// if (!environment(ob)) will return true if ob returns 0 for
// environment... in other words, it's loaded, but located in
// null-space.
else if (!environment(ob)) {
ob->move (this_object(), "$N appear$s with a wet squelch.");
}
}
As a bonus you also get the entire network code and can set it up in 2 minutes time for multiplayer online play.
There are heaps of easier ways to do it, I already explained one such solution, he could even just write the whole thing in Ruby and just install a bunch of gems, that would be easier than using MUDlib.

The whole point was to answer 3FFA on how HE wanted to do it. Not to mention the learning to program part.
