Re: Displaying text conditionally like in Twine

126 views
Skip to first unread message

TonyM

unread,
Jul 4, 2012, 1:18:18 AM7/4/12
to tiddl...@googlegroups.com
See recent https://groups.google.com/forum/#!topic/tiddlywiki/SEIPnAVxRA0

On Friday, 29 June 2012 20:50:00 UTC+10, Sonda wrote:
Hi, i'm new here and firstly I'd like to give to the community a huge THANKS for developing such a wonderful tool.

Recently I've been impressed by Twine's possibility of showing text conditionally (see here:
http://gimcrackd.com/etc/doc/#code,if ) and I'd like to do the same in TW.

I'm not a programmer, but I thought this could be achieved with some scripts, so I installed the InlineJavascriptPlugin... but I couldn't make use of it since I cannot write javascript.

Could you show me how to do this? I'm attaching an extremely simple example of what I'd like to achieve both in TW and Jonah format.
Thanks again,

Matteo

PS: i'm sorry if I made some mistakes, I'm italian...

Sonda

unread,
Jul 4, 2012, 5:51:29 AM7/4/12
to tiddl...@googlegroups.com
Thank you, I didn't know that method, but what I'd like to achieve is slightly different:
as shown in the attached document "conditional_story_jonah", you get (or don't get) to see a tiddler depending on which tiddlers you visited before.

Twine makes use of macros called <<set>>, <<if>>, <<else>> in order to do so, but they obviously don't work in TW.
The document "conditional_story" is what you get if you try to import the Twine-generated file in TW.

My aim would be to write interactive stories, so I'd like to spare an hypothetical reader from tagging/untagging tiddlers while he reads... is there alternative way to displaying text conditionally? maybe with HideWhenPlugin?

thanks!

PMario

unread,
Jul 4, 2012, 8:33:19 AM7/4/12
to TiddlyWiki
On Jul 4, 11:51 am, Sonda <pavanati.mat...@gmail.com> wrote:
> Twine makes use of macros called <<set>>, <<if>>, <<else>> in order to do
> so, but they obviously don't work in TW.
> The document "conditional_story" is what you get if you try to import the
> Twine-generated file in TW.
As you found out, Twine uses several plugins to get things going. It
would be needed, to add all of them to a "vanilla" TW, to get the same
behaviour. IMO interactive stories are quite complex. So the Twine
program abstracts this complexity away and exports to TW.

> My aim would be to write interactive stories, so I'd like to spare
> an hypothetical reader from tagging/untagging tiddlers while he reads... is
> there alternative way to displaying text conditionally? maybe with
> HideWhenPlugin?
I had a very short look at the Twine homepage. It seems to use
variables to store a stories state. So you can stop reading and start
over at the same "place" after some time.

====
I'm not sure, but the Twine discussion group seems to be active. Did
you ask them about your wishes allready?

-m

Sonda

unread,
Jul 5, 2012, 6:07:11 AM7/5/12
to tiddl...@googlegroups.com
>As you found out, Twine uses several plugins to get things going. It
>would be needed, to add all of them to a "vanilla" TW, to get the same
>behaviour. IMO interactive stories are quite complex. So the Twine
>program abstracts this complexity away and exports to TW.
Yes, I see that doing it with Twine is much easier, but I'd like to keep my stories inside a bigger TW, which Twine currently can't. Also, it crashes when I try to generate TW files (I reported this to their discussion group).

Anyway, after reading this guide How_To/Display_a_variable_within_a_tiddler I've learnt how to set variables and I almost came to an acceptable conclusion. Now, all I need is the javascript equivalent of

"if variableXX is X, show (return?) tiddlerX --- else, show tiddlerY"

Also, I may need some more "complex" scripts like 

"if variableXX is X and variableZZ is Z show tiddlerX --- else, show tiddlerY" 
and
"if variableXX is X, show tiddlerX --- if variableYY is Y show tiddlerY --- if variableZZ is Z show tiddlerZ " 

Can anybody help me translate this ideas into working javascripts?
Thanks a lot 
 
Reply all
Reply to author
Forward
0 new messages