Assigning weight to an object

I expect that this is obvious - but so obvious that I can’t fathom it. How do I assign a weight to a particular object? weight=10 for example, doesn’t work. I’ve never used weight limits before and now I need to; the manual alludes to units of weight but it doesn’t explicitly tell me how to assign them to an object, in either the main user guide or the cookbook (unless I just can’t see for looking).

Here is an example on how to use weight limits.

By default each item weighs “1” unit of weight, and the default weight limit is 200. This is different to the item carry limit which is by default “10”.

start_at = loc

game_settings {
   // Tells adventuron where to find the weight limit
   // Without this, the weight limit is 200 (see documentation for 'weigh' integer function)
   inventory_weight_limit_var = weight_limit
}

integers {
   weight_limit : integer "10"; // Weight limits can be altered mid-game, or use dynamic integer.
}

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

objects {
   lamp : object "a lamp" at = "loc" weight="11" ;
}

on_describe {
   : print {(
      "Weight carry limit is : " + weight_limit  + "\n" +
      "Lamp weight is : " + weigh ("lamp")
   )}
}

themes {
   my_theme : theme {
      system_messages {
         // Optional system message customisation
         cannot_carry_any_more_weight = ${entity} weighs too much to carry.
      }
   }
}
1 Like

Thanks Chris - the quotes around the number was what I need to know. That formatting isn’t shown in the manual or the autocomplete. Probably obvious for programmers, but not so for me.

I’ll put a code snippet in the documentation to remove this ambiguity. Thanks for the feedback.

UPDATE: Done.

1 Like