# Carrying capacity

I know its in the docs, but I can’t find it: How do you change the player’s carrying capacity?

Is this Inform 7? If so, try:

``Increase the carrying capacity of the player by 3.``

Thanks! Actually, I was trying to decrease capacity.

``The carrying capacity of the player is 2 while player is in Bath.``

isn’t working.

I think you have to do something a little more complicated, like this. (I’m an Inform novice, so there may be a more efficient way.) I’m assuming The Bath is a room:

[code]“The Bathroom”

The Bathroom is a room. “This bathroom is spartan, but functional. It has a sink, a toilet and there’s a clawfoot bathtub to the north.”

A rubber ducky is a kind of thing. There are ten rubber duckies in the bathroom.

The Bath is north of the bathroom. “A capacious tub filled with luke-warm cloudy water.”

The carrying capacity of the player is 5.

Before going to the bath:
now the carrying capacity of the player is 2;
if the player is carrying more than 2 things:
say “A few things slipped out of your hands.”;
while the player is carrying more than 2 things:
try silently dropping a random thing carried by the player;
continue the action.

After going from the bath:
now the carrying capacity of the player is 5;
continue the action.

test me with “get all / n / i / s / get all”
[/code]

Let me just comment on what Matt_W did, because it’s important for you to understand what’s going on, rather than just copy-pasting the code (which looks great; I’d tried to mock something up but decided to leave it for someone better, and lo and behold!)

First off, you really have to understand that you can’t have actions flying around loose like you did. I don’t mean actions like I7 understands them (actions a character can carry off), I mean actions in the simplest form. Changes to the game state. Changing the score, the carrying capacity, the location of a thing. If it’s not inside a rule, I7 will never know when it fires.

That’s the first thing Matt_W did; he encapsulated what you wanted in the “Before going to the Bath” rule. Now I7 knows when the carrying capacity has to be changed.

Your original attempt seemed to want something more temporary - “if the player happens to be in the bath, then be told, I7, that I want their carrrying capacity to be 2”. This sort of thinking won’t work with I7, I’m afraid - in some cases you may want to use Every Turn rules for something similar, but mostly you’ll want to be specific. Tell I7 exactly when to make the change - in this case, upon entering Bath.

And of course you have to reset the change upon leaving Bath.

Something else Matt_W demonstrates quite well which you overlooked and is very important - what if the player is carrying more than two items when he enters the bath? What happens to the extra items? You don’t want to leave this sort of solution to I7. Matt_W decided to silently drop the excess items; I would personally have prevented the player from entering if he was carrying more than two items; however you do it, though, you do have to consider it.

Thanks both to Matt_W and Peter Pears.