Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Display "moving" string

$
0
0
Sooo, getting back to Twine, and I wanted to add some flair to my text.
I'm trying to substring a string, and increment the min & max values for the substring by one, and print the substring (Essentially it'd look like the text on car-stereos "Hello this"->"ello this "->"llo this i" etc)
Here's what I got so far
<span id="warning"></span>
<<silently>>
	<<set $min = 0, $max = 12>>
	<<repeat 100ms>>
		<<set $warn = $warnings.substr($min, $max)>>
		<<set $min++, $max++>>
		<<if $max gt 185>> //Hardcoded string-length
			<<set $max = 12, $min = 0>>
		<</if>>
		<<replace "#warning">>$warn<</replace>>
	<</repeat>>
<</silently>>
It works, buuut it behaves oddly. For some reason, the gap between min & max becomes larger, making the length of the substring longer, the longer it runs, until $max hits the if-statement, where the substring starts shrinking. Once the substring's length is 0, it repeats again.

Viewing all articles
Browse latest Browse all 1844

Trending Articles