Can you put a link that sets a variable into an object key?
I know you can just do a link with the double square brackets [[“Link” |Destination Passage]] but I want it to set a variable when the link is clicked as well
<<set $object1 to {
name: "Chair",
link: "[["Chair Description"| Item Description Passage]] ",
variable: "<<set $variable to 1 >>"
}
Something like the below (but it throws up an error when I try it):
<<set $chair1 to {
name: "Chair",
link: "<<link"Chair Description" "Item Description Passage">><<set $variable to 1>><</link>> "
}>>
My guess is that the quotation marks are the problem, which IIRC you can get around by nesting single quotes inside double quotes or vice versa, but in this case I would just use the link markup with setter:
<<set $chair1 to {
name: "Chair",
link: "[[Chair description][$variable to 1]]"
}>>
(You don’t need quotes with the square bracket link markup, btw.)