Hello all. Inventory system is finished. My page layouts are working. So thanks up front to everyone who helped me with those when I ran into issues. Got a different type of question now. Image for reference.
So I've got this nifty little equipment div with links for player.head, player.accessory and so on. I've also got the player's location on the bottom right which loads state.history[1].title.passage. So since I don't want to mess with that, does Twine's linking syntax allow you to run a macro or perform an operation without changing the passage? I know you can manipulate variables with it like
[[Give me a cookie!|Passage2][$player.inventory.push("Cookie")]]
Anyway to use Twine link styles to do something else? Like only run a macro? I could do some neat fly-in equipment window stuff if I can figure this out.
Comments
So awesome!
If you were using SugarCube, you could simply use the <<click>> macro, but you aren't. Let me see if I can convert a really old version of <<click>> to the old-style macro API that the vanilla headers use.
This should work I believe:
<<click link_text [passage_name]>><<endclick>>
Binds its contents to a link, which silently executes/wikifies them when clicked, optionally forwarding the user to another passage.
Arguments:
- link_text: The text of the link.
- passage_name: The, optional, name of the passage to forward the user to.
Usage: Vanilla <<click>> minified: Vanilla <<click>> unminified: (Hmm. No [spoiler] tag? /sigh) UPDATE: Updated to add $variable substitution.I don't mean to look a gift horse in the mouth, but is there a way to get the macro to index variables? This code is... beyond me.
Right now if I can't do <<click $player.accessory>> for example. If it's too much of a hassle, this is still excellent. Thank you again.
EDIT: Tried making linkText = ("<<" + params[0] + ">>") and that didn't work. Dang!
UPDATE: Okay! I've fixed the <<click>> macro above (both the minified and unminified versions) to perform $variable substitution on all arguments. Things like <<click $player.accessory>> should work now.
*Which you could substitute for a <<nobr>> if you're only going to put <<set>> inside it, which I wager you will.
Is <<click>> part of 1.4? Or is it stashed away on your blog somewhere? I've never heard of it before, but it sounds amazing.
Also, is <<nobr>> working now? I thought it was buggy...
It's in this very thread (well, the vanilla header version anyway). Look up thread for it.
Now don't I feel stupid... :-[
Anyway, thanks for this!