I have a book. You can read about topics in the book. One of the topics is ‘ball’. When you READ ABOUT BALL, it tells you the materials you need to make a rubber ball.
Elsewhere in the game, I have a ball of twine. This can be referred to as ‘ball of twine’, ‘ball’ or ‘twine’. The mere existence of this object causes READ ABOUT BALL to fail. Rather than noun1
returning ‘ball’, as it should, it gets coerced into ‘twine’. I did not type ‘twine’, the ball of twine is not in scope, I am not carrying it, it is not in the room, it hasn’t even been created, so why does Adventuron change my input from ‘ball’ to ‘twine’ and how do I stop it from doing this?
The following minimal code demonstrates the problem. When you enter READ ABOUT BALL, the expected response is “It says you only need rubber to make a ball.” The actual response is “There’s no topic on that.” In the match
statement, I’ve added an alternative noun. If you type READ ABOUT BALLS, you get the correct response. In this case, Adventuron is not doing the automatic conversion between singular and plural, as it normally does. Debugging code is included so that you can see where Adventuron is returning the wrong thing for noun1
.
start_at = room
game_settings {
experimental_new_parser = true
}
locations {
room : location "You're in a room.";
}
objects {
twine : object "a ball of twine" {experimental_matching_text_sequences = ["ball of twine", "ball", "twine"]}
book : object "a book" at = "room";
}
on_command {
: match "_ _" {
: mask {
: print {("^n^verb = " + original "verb")}
: print {("^n^preposition1 = " + original "preposition1")}
: print {("^n^noun1 = " + original "noun1")}
: print {("^n^preposition2 = " + original "preposition2")}
: print {("^n^noun2 = " + original "noun2" + "^m^")}
}
}
: if (is_present "book") {
: match "examine book;read book" {
: print "It's a book about making a rubber ball. I guess you could READ ABOUT BALL.";
: done;
}
: match "read _" {
: if (preposition1_is "about") {
: if (noun1_is "ball" || noun1_is "balls") {
: print "It says you only need rubber to make a ball.";
: done;
}
: print "There's no topic on that.";
: done;
}
}
}
}