Carrying capacity not working

I have been trying to set the carrying capacity of a supporter to 1. Yet this is ignored when in play and I can’t figure out why. Do I need a check statement? I read in the docs that “tying” isn’t very defined, but don’t know what to try next.

A rod is a kind of supporter. A rod is portable. A rod has carrying capacity 1. A lure is a kind of thing. ... Instead of tying something to something: if noun is a lure: if second noun is a rod: move the noun to the second noun; say "You expertly tie on the lure."; otherwise: say "You can't tie the [noun] to the [second noun]."; otherwise: say "You can't tie that!";
This lets me tie any number of lures to a rod (player has two rods) without being stopped. I also tried with a unique item “green rod” and the results were identical.

(Edited for dumb mistake on my part.)

When you use something like “move the foo to the bar” it doesn’t check the carrying capacity. The carrying capacity comes in in a “check putting it on” rule, so it gets invoked when the action that’s happening is “putting it on.” (There are other places carrying capacity gets used – for instance, when the player picks something up, their carrying capacity is checked. And there are some bugs with that.)

Your best bet here, I reckon, is to redirect tying a lure to the rod to putting the lure on the rod. That means that the built-in carrying capacity rules will kick in; it also ensures that “PUT LURE ON ROD” is treated the same as “TIE LURE TO ROD,” which is good. (In fact, if you try “PUT LURE ON ROD” in your code, it’ll respect the carrying capacity limits.)


[code]A rod is a kind of supporter. A rod is portable. A rod has carrying capacity 1.
A lure is a kind of thing.

River Bank is a room. The player carries a rod and three lures.

Instead of tying a lure to a rod:
try putting the noun on the second noun.

After putting a lure on a rod:
say “You expertly tie [the noun] to [the second noun].”

The can’t put onto something being carried rule is not listed in any rulebook.[/code]

Some subtleties: We want to change the message you get from putting a lure on a rod, so we use an “after” rule, which fires and then prevents the Report rules from firing. That’s why we don’t get the standard message for putting things on other things.

There’s a standard rule that prevents the player from putting things onto things they’re carrying, I guess with the thought that most supporters take two hands to carry and it’s hard to put things on them without putting them down. We don’t want that, so we eliminate that rule.

Also, it might be good practice to put [the noun] in brackets, which lets Inform handle the definite article for the rod/lure in case you’ve defined something with a special article.

EDIT: You’ll also need to write some code to make sure that you can only put lures on rods.

Instead of putting something on a rod when the noun is not a lure: say "The rod is too delicate to support that!"

might do.

Also, if you got my code before I updated, it won’t compile because I stupidly wrote “first noun” one place I should’ve had “noun.”

That’s working, thanks. First I tried understand “tie” as putting, then I tried declaring tie as a new verb not knowing it existed already, then the above. None it it worked obviously. Was trying to write a check rule for tying but you’re right, being able to put or tie is helpful and your solution is a lot easier. Been reading a lot but sometimes a little Q and A goes a lot farther.

Looks like I’ll have to create two unique rods as having duplicate rods is getting confusing for me and the parser when in play. It’s already got “rod holders” to deal with too.

You probably want to make sure “tie rod to lure” works in exactly the same way as “tie lure to rod”.