Last updated: 17 Jul 19 16:42:16 (UTC)

Timer Macro - appearing text (e.g., scrolling coms)

Sugarcube 2

I used this in *No World 4 Tomorrow *to show a display of scrolling text messages being received on a digital com.

  1. Silently set variables for message count, message texts, and (using the example of a text msg convo) sender names:

<> <<set $msgCt to 0>> <<set $sndr1 to “A. Jones”>> <<set $msg1 to “Don’t listen to them - the Senate is playing us”>> <<set $sndr2 to “M.J. Thon”>> <<set $msg2 to “Metra = oligarchy. Fight now”>> <<set $sndr3 to “R. Udell”>> <<set $msg3 to “What are our actual stores? Is this warranted?”>> <>

  1. Establish spans for placing the texts in for the number of slots in which messages can appear (can have many more messages, but they will essentially sequence through these slots). You can fill in the first one if it is to already be on the screen when the user arrives at the passage:

N. Lour
We have to fight this




  1. Use the Timer macro, the message count variable, and <>, <>, and <> macros to count how many messages have displayed and move them up the slots after a certain time period:

<<timed 1s>> <<if $msgCt == 0>>     <<replace “#sndr1”>><<print $sndr1>><>     <<replace “#msg1”>><<print $msg1>><><<set $msgCt += 1>><> <<next 1s>> <<if $msgCt == 1>>         <<replace “#sndr2”>><<print $sndr2>><>

<<replace “#msg2”>><<print $msg2>><><<set $msgCt += 1>><>

<<next 1s>> <<if $msgCt == 2>>         <<replace “#sndr3”>><<print $sndr3>><> <<replace “#msg3”>><<print $msg3>><><<set $msgCt += 1>><> <<next 1s>> <<if $msgCt == 3>>         <<replace “#sndr4”>><<print $sndr4>><> <<replace “#msg4”>><<print $msg4>><><<set $msgCt += 1>><> <<next 1s>> <<if $msgCt == 4>>     <<replace “#sndr0”>><<print $sndr1>><>     <<replace “#sndr1”>><<print $sndr2>><>     <<replace “#sndr2”>><<print $sndr3>><>     <<replace “#sndr3”>><<print $sndr4>><>     <<replace “#sndr4”>><<print $sndr5>><>     <<replace “#msg0”>><<print $msg1>><>     <<replace “#msg1”>><<print $msg2>><>     <<replace “#msg2”>><<print $msg3>><>     <<replace “#msg3”>><<print $msg4>><>     <<replace “#msg4”>><<print $msg5>><><<set $msgCt += 1>>     <> <>