On Monday, July 27, 2020 at 9:22:15 AM UTC-7, Mat wrote:
>
> So do I understand it right that to achieve a repetition of 10minutes + 
>> 2minutes * 5times, I'd need to, in the tiddler, type in about 10 calls, 
>> right? I made a quick, but failed attempt to modify firstDone into: 
>>
>
> \define firstDone()
> <$list filter="[range[5]]" variable="_NUL">
> <$list filter="00:00:03 00:00:06" variable=duration>
> <$vars
>  H={{{ [<duration>split[:]nth[1]] }}}
>  M={{{ [<duration>split[:]nth[2]] }}}
>  S={{{ [<duration>split[:]nth[3]] }}}
> >
> <$macrocall $name=setCountdown H=<<H>> M=<<M>> S=<<S>> />
> </$vars>
> </$list>
> </$list>
> \end
>
> Each of the "...Done" macros handles one, and ONLY one, countdown result.  
 For example, firstDone()
\define firstDone()
<<showMessage "First Countdown ended. You have another minute!">>
<$vars done=<<secondDone>>>
<<setCountdown 00 01 00>>
\end

Is invoked when the first countdown ends, and it's job is to
* display a message 
* set up the next "done" handler (i.e., "secondDone()")
* start the next countdown with the specified hh mm ss values

There is *currently* no easy syntax for setting up a repeating pattern of 
countdowns.
That is something I will be adding soon.
In the mean time, to do the one hour cycle you described, you would need to
create 10 separate macros (2 macros per cycle, times 5 cycles) and then
"daisychain" them using the syntax demonstrated in the 
SampleCountdownSequence tiddler.
 

> I must also ask something else - what kind of syntax is this:
> \define controls()
> <$vars here=<<currentTiddler>>>
> <$vars done=<<firstDone>>>
> <<getCountdown>> <<start>> <<stop>> <<reset>>
> \end
> ...i.e no closing vars tags!? I know one *can* do that but is the system 
> OK with it? No sideeffects?
>

Yeah.  When the end of a macro is reached, any unterminated widgets are 
automatically terminated.

This comes in handy for several types of widgets, such as $vars and 
$tiddler.
For example, take a look in *TiddlyTools/Timer/CountDown *at the 
*showRemaining() 
*macro:

\define showRemaining()
<$tiddler tiddler=<<temp>>>
<$vars  R={{{ [<temp>get[text]subtract[1]]       }}}>
<$vars  H={{{ [<R>divide[3600]trunc[]]           }}}>
<$vars HM={{{ [<H>multiply[60]]                  }}}>
<$vars  M={{{ [<R>divide[60]subtract<HM>trunc[]] }}}>
<$vars HS={{{ [<H>multiply[3600]]                }}}>
<$vars MS={{{ [<M>multiply[60]]                  }}}>
<$vars  S={{{ [<R>subtract<HS>subtract<MS>]      }}}>
<$action-setfield hours={{{ [<H>addprefix[00]split[]last[2]join[]] }}} />
<$action-setfield  mins={{{ [<M>addprefix[00]split[]last[2]join[]] }}} />
<$action-setfield  secs={{{ [<S>addprefix[00]split[]last[2]join[]] }}} />
\end

It's very convenient to NOT have to terminate all those $vars (and the 
$tiddler).
Of course, if the $vars occurred inside other syntax (e.g., a <$reveal>), 
then you MUST terminate each $vars before the
</$reveal> or there would be unbalanced nesting.  However, in the above 
example, since the $vars and $tiddler occur
at the outermost level of the macro definition, the end of the macro takes 
care of it for you, regardless of how many
$vars were used.

-e

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0a5b75c6-6855-4b22-83dd-d411a7fbd77eo%40googlegroups.com.

Reply via email to