0 votes
by (2.3k points)

I'm trying to get item 'rations' to be added to my inventory via an 'exit link' with another link refusing the item offered, but the method I've tried isn't working.

"Here, you can have some rations if you wish?"

[[Take the Items and thank the Master Chief|Extra Rations Exit][$score += 3][<<set $playerInventory.rations = {
name: "Rations",
quantity: 2,
weight: 1.0,
description: "''@@.item;Provisions for nourishment and sustainance. not the tastiest, but long-lasting and filling enough.''@@" }>>]

[[Refuse the Items |No Extra Rations Exit][$score += 8]]

Any ideas?

1 Answer

+1 vote
by (44.7k points)
selected by
 
Best answer

The problem is that you're putting a <<set>> macro inside of a Twine link, which won't work.  Try this instead:

"Here, you can have some rations if you wish?"

[[Take the Items and thank the Master Chief|Extra Rations Exit][$score += 3, $playerInventory.rations = { name: "Rations", quantity: 2, weight: 1.0, description: "''@@.item;Provisions for nourishment and sustenance. Not the tastiest, but long-lasting and filling enough.@@''" }]]

[[Refuse the Items|No Extra Rations Exit][$score += 8]]

To put that in a bit more readable form, you can have multiple expressions (such as "$score += 3") if you separate them by commas like this:

[[Link text|Passage name][expression, expression]]

Hope that helps!  :-)

by (2.3k points)
That is top-drawer! Thanks for your assistance once again Hi-Ev! :)
...