If you have 100 objects in your game, you have to check 100 objects. Unless you're saying "my_object" IS a generic object, i.e. the object referred to in your input.
In Adventuron, there are already a sub-optimal of handling loops and scanning within a container (location, entity, etc).
The look_inside command, in addition to collections, along with the while loop is a long winded way of achieving things.
As I alluded to, I suspect this would be technically work, but it's sub optimal.
A dedicated all-in-one scanning command was something I was going to work on after finishing attributes + stats.
I may move it forward if there is a demand.
The scanning construct will ultimately look a bit like this.
// Not yet working ... : scan (current_location()) { : if (is_carried(item()) { // Do something here } }
What I'm hoping for is something like:
: match "throw -" {
: if (is_carried(noun1)) {
: drop;
: print {("You throw the " + original_noun1() + ", but it doesn't go very far.")}
}
: else {
: print "You don't have that.";
}
}
Being able to reference noun1 and noun2 are the things that are desperately missing. Perhaps these would be noun1() and noun2() in Adventuron syntax. noun1 or noun1() is probably similar to item() in your example.