Right, this is probably how I would do it. You have to manually add code for each object, but in a small game like yours that's not too much of an issue.
There are lots of tweaks you could add, such as custom drop/get messages. But this will work similar to how it currently functions in your game.
Please see... http://8bitag.com/temp/riddle.html ...for a demo. Code is below...
######################################
# Adventuron #
######################################
start_at = riddle_room
######################################
# Locations #
######################################
locations {
riddle_room : location "You are in the riddle room. The Riddle Master is here.";
}
######################################
# Connections #
######################################
connections {
from, direction, to = [
]
}
######################################
# Objects #
######################################
objects {
rock : object "A small rock" start_at = "inventory";
crystal : object "A crystal" start_at = "inventory";
apple : object "An apple" start_at = "inventory";
rod : object "A fishing rod" start_at = "inventory";
blade : object "An axe blade" start_at ="inventory";
}
######################################
# Booleans #
######################################
booleans {
riddle_solved : boolean "false" ;
objects_checked : boolean "false";
}
######################################
# Integers #
######################################
integers {
object_counter : integer "0" ;
}
//increment decrement
######################################
# On Command #
######################################
on_command {
: match "drop _;give _" {
: if (is_at "riddle_room" && riddle_solved == false) {
: if (object_counter > 1) {
: print "You can only present two objects to the Riddle Master.";
: done;}
: else {
: gosub "riddle_drop_object";
: done;}}}
: match "get _" {
: if (is_at "riddle_room" && riddle_solved == false) {
: gosub "riddle_get_object";
: done;}}
}
######################################
# On Tick #
######################################
on_tick {
: if (is_at "riddle_room" && riddle_solved == false && object_counter == 2 && objects_checked == false) {
: if (is_beside "rod" && is_beside "blade") {
: print "\"Yes,\" says the Riddle Master, \"That's correct! Well done!\"";
: set_true "riddle_solved";
: done;}
: else {
: print "\"No,\" says the Riddle Master, \"Those objects are incorrect.";
: set_true "objects_checked";
: done;}}
}
######################################
# Subroutines #
######################################
subroutines {
riddle_drop_object : subroutine {
: match "_ rock" {
: if (is_carried "rock") {
: drop;
: increment "object_counter";
: done;}}
: match "_ crystal" {
: if (is_carried "crystal") {
: drop;
: increment "object_counter";
: done;}}
: match "_ apple" {
: if (is_carried "apple") {
: drop;
: increment "object_counter";
: done;}}
: match "_ rod" {
: if (is_carried "rod") {
: drop;
: increment "object_counter";
: done;}}
: match "_ blade" {
: if (is_carried "blade") {
: drop;
: increment "object_counter";
: done;}}
: print "You are not carrying that.";
}
riddle_get_object : subroutine {
: match "_ rock" {
: if (is_beside "rock") {
: get;
: decrement "object_counter";
: set_false "objects_checked";
: done;}}
: match "_ crystal" {
: if (is_beside "crystal") {
: get;
: decrement "object_counter";
: set_false "objects_checked";
: done;}}
: match "_ apple" {
: if (is_beside "apple") {
: get;
: decrement "object_counter";
: set_false "objects_checked";
: done;}}
: match "_ rod" {
: if (is_beside "rod") {
: get;
: decrement "object_counter";
: set_false "objects_checked";
: done;}}
: match "_ blade" {
: if (is_beside "blade") {
: get;
: decrement "object_counter";
: set_false "objects_checked";
: done;}}
: print "You've not presented that to the Riddle Master.";
}
}