I know there's probably no ideal answer to this, but I was wondering what's the best way to organise your command handlers in the on_commands{} section. In the past, I organised them by room, then object in room, then commands for each object. The advantage of this is that all commands for a particular object are grouped together. For example:
: match "examine door" {
: if (is_present "door") {
// Do something
}
}
: match "open door" {
: if (is_present "door") {
// Do something
}
}
: match "close door" {
: if (is_present "door") {
// Do something
}
}
Alternatively, you could do something like this:
: if (is_present "door) {
: match "examine door" {
// Do something
}
: match "open door" {
// Do something
}
: match "close door" {
// Do something
}
}
I'm now wondering if it's better to organise them by verb, then statements for each object within the verb. For example:
: match "examine _" {
: if (noun1_is "door" && is_present "door") {
// Do something
}
: if (noun1_is "cupboard" && is present "cupboard") {
// Do something
}
}
What do others think?