Quantcast
Channel: Twine Forum
Viewing all articles
Browse latest Browse all 3830

SugarCube: Widgets inside set ...?

$
0
0
Hi,

me again, flooding the forum :)

I've set up a somewhat long (but descriptive) widget for printing the clear name of a variable id. So you call, say <<PrintLocation 2>> and get Greenhouse in return.

Now, of course, I could add yet another widget for what I need that would set the appropriate variable but that would split variable initialization over two places and I'd like to avoid that, if possible. Here's the problem (if it is one):

For a lengthy passage I'm going to need the clearname of the location quite a few times. Since I like to keep text and code separated as muchas possible, I tried a setup routine before going to the passage (set of passages actually but that is beside the point). In that setup passage I tried to fill a couple of handy variable names with the "printed" content so I could use something like $loc in the text. Not too disturbing and interrupting when writing and proof reading.

But ... my first attempt went like this:

<<set $loc to <<PrintLoc $passedID>> >>

And, lo and behold ... that is a construct not suported by Twine/Sugarcube. I always get a naughty error that an expression was expected and "<<" was received instead.

So unless there is a trick to get that past the parser it seems nested Macros are a no, no?

If so ... is there really no other way than to either create another "shorter" widget so that I'd have to type <<loc $passedID>>? Way more ... bleh .. when writing and proof reading. :(

The SugarCube documentation is excellent in some places and somewhat sparse in others ... did I miss a pointer system somewhere I could pass to a widget so that the variable itself could be changed (wouldn't always be $loc - that's why I use a widget - other passes would have $loc2, $loc3 and so on ...

Viewing all articles
Browse latest Browse all 3830

Trending Articles