ainslec / adventuron-issue-tracker

Adventuron Issues Tracker
4 stars 0 forks source link

Inventory in one line doesn't mention worn items #508

Open hnejfnvjojgrogjwm opened 1 year ago

hnejfnvjojgrogjwm commented 1 year ago

If the game shows the inventory all in one line, there is no information regarding worn items. I use the one line inventory because there are many objects in my game and not too many lines of text to display as the graphic area is quite big. The player can't know if is wearing certain items or not because that information is missing. Moreover, having the worn items on a separated line would be amazing. Something like:

You have an apple, an orange, and a bicycle. You are wearing: a clown nose and a hat.

joshgoebel commented 1 year ago

IIRC it's possible to implement these type of customizations yourself, of course.

hnejfnvjojgrogjwm commented 1 year ago

I wish I knew how. Anyway, I think this is a feature that should work on Adventuron by default.

joshgoebel commented 1 year ago

https://github.com/joshgoebel/island_adventure/blob/main/island.adv#L3097

This is for the release/stable version, not the BETA... but it shows you the broad strokes.

ainslec commented 1 year ago

I'm not going to "fix" this right now as the workaround will suffice for now, I'll leave this open and try to generalize some solution in the theme.

Josh's solution is good.

Here is another one just using iterators and the append and print commands.


start_at = my_location

locations {
   my_location : location "You are in a room.";
}

objects {

   wallet : object "a wallet" at = "inventory" ;
   pen : object "a pen" at = "inventory" ;
   coins : object "some coins" at = "inventory" ;
   hat : object "a hat" at = "inventory" initially_worn = "true" ;
   coat : object "your coat" at = "inventory" initially_worn = "true" ;

}

on_command {

   : match "inventory _"  {

      : append "You are carring ";

      : if (count "_inventory_notworn" > 0) {
         : iterate "_inventory_notworn"  {
            : if (is_final_iteration()) {
               : append " and ";
            }
            : else_if (!is_first_iteration()) {
               : append ", ";
            }
            : append (d(item()));
         }
         : print ".";
      }
      : else {
         : print "You are holding nothing.";
      }

      : append "You are wearing ";
      : if (count "_inventory_worn" > 0) {
         : iterate "_inventory_worn"  {
            : if (is_final_iteration()) {
               : append " and ";
            }
            : else_if (!is_first_iteration()) {
               : append ", ";
            }
            : append (d(item()));
         }
         : print ".";
      }
      : else {
         : print "You are wearing nothing (oh-dear!).";
      }
   }

}