Open warrigal24 opened 3 years ago
Trimmed down minimal test case :
start_at = room01
game_settings {
enable_standard_all_behaviour = false
experimental_auto_propogate_known = true
experimental_new_parser = true
experimental_new_scoping = true
}
integers {
sleigh_item_limit : integer_const "10";
}
collections {
list_object_buffer : list;
}
traits {
treasure_t : trait;
}
locations {
room01 : location "You're in a barn.";
}
objects {
sleigh : scenery "Santa's sleigh" at = "room01" container_type = "surface" {experimental_matching_text_sequences = ["santa's sleigh", "sleigh"]}
coal : object "a lump of coal" at = "inventory" weight = "2" {experimental_matching_text_sequences = ["lump of coal", "lump", "coal"] traits = [treasure_t]}
}
on_pre_command {
: match "_ _" {
: disambiguate_s1 "present";
: disambiguate_s2 "present";
}
}
on_command {
: match "put all" {
: disambiguate_s2 "present";
: if (s2() == "sleigh") {
: do_all "inventory_notworn";
}
}
: match "put _" {
: disambiguate_s1 "carried" with_trait = "treasure_t";
: disambiguate_s2 "present";
: 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")}
: print {("^n^s1 = " + s1())}
: print {("^n^s2 = " + s2() + "^m^")}
}
: if (s2() == "sleigh") {
: if (parent_of(s1()) == "sleigh") {
: print {(first_cap(definite(d(s1()))) + " is already on Santa's sleigh.")}
: done;
}
: if (!is_carried(s1())) {
: print {("You're not carrying any " + original "noun1" + ".")}
: done;
}
: if (!s1_has_trait "treasure_t") {
: print "You can only put the presents for the children on the sleigh.";
: done;
}
: if (child_count(s2()) == sleigh_item_limit) {
: print "You can't put any more items on the sleigh.";
: done;
}
: if (weigh(s1()) > 6) {
: print {(first_cap(definite(d(s1()))) + " won't fit on the sleigh.")}
: done;
}
: insert_in_container "sleigh" quiet = "true";
: print {("You put " + definite(d(s1())) + " on Santa's sleigh.")}
: done;
}
}
}
Fixed in beta 66s.
From Garry:
"Re #267: PUT ALL ON SLEIGH now works, but GET ALL FROM SLEIGH fails on first object. You can test it with the same code. It looks like : remove_from_container "sleigh" quiet = "true"; fails and prints an inappropriate system message saying "You don't have it.", then prints my message saying that I just took it. Is there any way of testing the success or otherwise of remove_from_container and changing the default system message? What happens with remove_from_container if your inventory is full?"
NOTE: Running these commands in text version of Adventuron does not replicate the issue. There appears to be a difference between the transpiled version of Adventuron's internal logic versus the pure Java version. Very worrying.
Fixed in 66t.
Re-opening this, also related to issue #427 (see findEntitiesForSubject() )....
start_at = room01
game_settings {
enable_standard_all_behaviour = false
experimental_auto_propogate_known = true
}
integers {
sleigh_item_limit : integer_const "10";
}
collections {
list_object_buffer : list;
}
traits {
treasure_t : trait;
}
locations {
room01 : location "You're in a barn.";
}
objects {
sleigh : scenery "Santa's sleigh" at = "room01" container_type = "surface" {experimental_matching_text_sequences = ["santa's sleigh", "sleigh"] noun="sleigh"}
coal : object "a lump of coal" at = "inventory" weight = "2" {experimental_matching_text_sequences = ["lump of coal", "lump", "coal"] traits = [treasure_t]noun="coal"}
}
on_pre_command {
: match "_ _" {
: disambiguate_s1 "present";
: disambiguate_s2 "present";
}
}
on_command {
: match "put all" {
: disambiguate_s2 "present";
: if (s2() == "sleigh") {
: do_all "inventory_notworn";
}
}
: match "put _" {
: disambiguate_s1 "carried" with_trait = "treasure_t";
: disambiguate_s2 "present";
: 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")}
: print {("^n^s1 = " + s1())}
: print {("^n^s2 = " + s2() + "^m^")}
}
: if (s2() == "sleigh") {
: if (parent_of(s1()) == "sleigh") {
: print {(first_cap(definite(d(s1()))) + " is already on Santa's sleigh.")}
: done;
}
: if (!is_carried(s1())) {
: print {("You're not carrying any " + original "noun1" + ".")}
: done;
}
: if (!s1_has_trait "treasure_t") {
: print "You can only put the presents for the children on the sleigh.";
: done;
}
: if (count(s2()) == sleigh_item_limit) {
: print "You can't put any more items on the sleigh.";
: done;
}
: if (weigh(s1()) > 6) {
: print {(first_cap(definite(d(s1()))) + " won't fit on the sleigh.")}
: done;
}
: insert_in_container "sleigh" quiet = "true";
: print {("You put " + definite(d(s1())) + " on Santa's sleigh.")}
: done;
}
}
}
I have a bunch of Christmas presents that are identified by the trait 'treasure_t'. I also have a sleigh. You can only put things on the sleigh if they are Christmas presents. This is checked using
s1_has_trait "treasure_t"
. If they aren't presents, you get an appropriate message. A sample program is attached. You can put all the individual presents on the sleigh, but if you try to PUT ALL ON SLEIGH, it fails. After considerable experimenting, I realised that the return value of thes1_has_trait
test is flipped with PUT ALL.Here is some sample input:
Here's the sample program with debugging code to show that in each case,
noun1
is identified correctly ands1
is identified correctly, but PUT ALL fails. If you change the test from '!s1_has_trait
' to 's1_has_trait
', the results are reversed. PUT ALL works, but PUT