[TW5] Presenting ifAisB Macro: Compare Strings if-then-else Style

570 views
Skip to first unread message

Thomas Elmiger

unread,
Apr 30, 2017, 9:48:54 AM4/30/17
to TiddlyWiki
Hi all 

A new "hack" is ready for you to try – I hope you will find it useful, e.g. to create quizzes or tests, to automate letters, …

This macro offers a solution for simple if-then-else text generation. It presents some added value compared to the reveal widget: it accepts variables as well as text references and it can show an error message. The ifAisB macro comes with full documentation in the tiddler $:/_telmiger/ifAisB – a link to the documentation can also be found below.


Credits and more examples: This solution was inspired by and developed together with Måns who describes his usage of a former version in this post in the Google group. Many others have contributed with relating posts or inspiring ideas. So thank you, TW community!



A shorthand macro to test if the value of a field priority equals "a" could be defined and used like this:


\define check-a() <$macrocall $name="ifAisB" A={{!!priority}} B="a" then="priority is a" else="priority is not a"/>

<<check-a>>


See documentation here: https://tid.li/tw5/hacks.html#ifAisB%20%E2%80%93%20Compare%20if-then-else%20Style%20in%20Wikitext

As always: Do yourself a favour and save a backup before trying my stuff.

Let me know if it works for you.

All the best,
Thomas

Måns

unread,
May 1, 2017, 5:21:16 AM5/1/17
to TiddlyWiki
Hi Thomas

Great, great, great :-)
Well done!!

With the new 5.1.14 editions new features - dnd etc. - your macro could help start a veritable lavine of games for TiddlyWiki!!
Card games, dnd questions to answers with instant feedback etc., etc ....  

Maybe we should announce a "create games & quizzes challenge" to speed up things?

Cheers Måns Mårtensson

Ste Wilson

unread,
May 1, 2017, 7:50:42 AM5/1/17
to TiddlyWiki
Ooohhh..
Will definitely have a play with this.
Cheers.

@TiddlyTweeter

unread,
May 1, 2017, 8:13:55 AM5/1/17
to TiddlyWiki
Ciao Måns & Thomas

Semi-seriously ... apps that can play games are very inviting.

Personally I need to see more examples of how the ifAisB Macro works to fully get it.

Best wishes
Josiah

Thomas Elmiger

unread,
May 1, 2017, 5:40:03 PM5/1/17
to tiddl...@googlegroups.com
Hi Josiah & all,

Here’s a little quiz for you: http://tid.li/tw5/hacks.html#Distances%20Quiz

I just played a bit with a short quiz macro that uses ifAisB and a button to set tags …

Have fun!
Thomas

Måns Mårtensson

unread,
May 2, 2017, 3:32:15 AM5/2/17
to TiddlyWiki
Thank you Thomas :-)

2017-05-01 23:40 GMT+02:00 Thomas Elmiger <thomas....@gmail.com>:
Hi Josiah & all,

Here’s a little quiz for you: http://tid.li/tw5/hacks.html#Distances%20Quiz

I just played a bit with a short quiz macro that uses ifAisB and a buttoun to set tags …

Have fun!
Thomas

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/889379c0-ecf0-441e-8ae0-60cc71fc57c5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jan

unread,
May 2, 2017, 5:37:35 AM5/2/17
to tiddl...@googlegroups.com
Hallo Thomas,
again a great and much desired feature!
You are doing lot of basic but groundbreaking things that are taking TW to a new level.

Thanks for this
Jan
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Thomas Elmiger

unread,
May 2, 2017, 6:14:50 PM5/2/17
to TiddlyWiki
Thanks Jan,

Other ways* to do similar things have been around for a while – I just try to make solutions as simple as possible for myself :)

I optimized and enhanced the quiz and added a mini-survey where two out of three options must be chosen. Just to demonstrate the potential and to inspire others …
https://tid.li/tw5/hacks.html#ifAisB%20%E2%80%93%20Compare%20if-then-else%20Style%20in%20Wikitext

Hope to see more playful stuff from others!

Cheers,
Thomas

* Alternatives:
– Learn PILOT: https://www.quaraman.de/tw/pilot.html
– Learn french: http://www.tw5.xyz/tiddlyquiz.html ;–)
– Learn TW5 including filters and reveal widget: http://tiddlywiki.com/#RevealWidget

Steven Schneider

unread,
May 8, 2017, 6:52:18 PM5/8/17
to TiddlyWiki
Thomas, great stuff! I'll try to incorporate into DesignWriteStudio classes for Fall semester (Just starting now on a basic American Government course, and a Math course in Differential Equations). //steve.
Reply all
Reply to author
Forward
0 new messages