Using this code (as a widget):
<<widget Add_ItemToInv>><<nobr>>
<<set $ItemAdded = "args[0]">>
<<if $Inventory.includes($args[0])>>
<<set $TextMessage = "You already have the item $ItemAdded in your inventory.">>
<<else>>
<<set $TextMessage = "You have added the $ItemAdded to your inventory.">>
<<endif>>
<<set $Inventory.pushUnique($args[0])>>
$TextMessage
<</nobr>><</widget>>
How can i then display/print out $TextMessage (i.e args[0]) in a different passage at a later point, without getting something like this:
You have added the $args[0] to your inventory.
I get you're supposed to use <<print>>, but i'm not entirely sure how to do it properly in practice. The widget itself on it's own works fine and displays/prints properly, but when i use $TextMessage somewhere else or outside the widget, i get the following above.
Thanks