ainslec / adventuron-issue-tracker

Adventuron Issues Tracker
4 stars 0 forks source link

[BUG] Pushing a dynamic variable onto a collection does not work once compiled #456

Closed nww02 closed 3 years ago

nww02 commented 3 years ago

I am attempting to build a collection using variables, as shown in the on_startup below. This works perfectly in the classroom, and prints "1" as expected. However, when compiled, nothing it pushed onto the list, and it outputs "0" instead.

UPDATE: I've figured a workaround (see comment). So, this isn't an emergency :) :)

I'm working on the /betabeta branch, if that helps.

start_at = my_location
integers {
      some_variable : integer "0" ;
}

collections {   
   list_1 : list {
      items  = [  ]
   }
}

on_startup {
   :collection_push collection="list_1" item->(some_variable);

   :print {("Should be 1, actually=" + count "list_1")};
   :press_any_key;
}

locations {
   my_location : location "You are in a room.";   
}
nww02 commented 3 years ago

UPDATE: It's only when pushing a non-string dynamic item. I can get around this now by doing this:-

on_startup {
   :collection_push collection="list_1" item->(""+some_variable);

   :print {("Should be 1, actually=" + count "list_1")};
   :press_any_key;
}

So, I can work around it now... Phew!

nww02 commented 3 years ago

This seems to be resolved in 74l (at least for integers, so I assume Booleans too). Thank you.