Good evening,
I ran into a problem with timing again. This passage:
<<set $letterArray to []>>
<<set _letters to "abcdefghijklmnopqstuvwxyzäöüß">>
<<for _i=0;_i<1000;_i++>>
<<set _rnd to random(_letters.length)>>
<<set _randomLetter to _letters.charAt(_rnd)>>
<<set $letterArray.push(_randomLetter)>>
<</for>>
<<set $amount to 6>>
<<for _i=0;_i<$amount;_i++>>\
<<set _pos to random($letterArray.length)>>
<<set $letterArray[_pos] to '<span class="dot" id="dot-' + _i + '"><<link "●">><<replace "#dot-' + _i + '>>">><span class="black">●</span><</replace>><<audio "shoot" play>><<set _levelPoints+=10>><</link>></span>'>>
<</for>>\
<<set _posToReplace to random($letterArray.length)>>
<<set $letterArray[_posToReplace] to '<span class="red" id="boom"><<link "●">><<audio "wrong" play>><</link>></span>'>>
<<for _i=0; _i<$letterArray.length; _i++>>
<<print $letterArray[_i]>>
<</for>>
works fine when I open it directly in debug mode. But when I run the game and link to it, I get e.g.
<<replace>>: no elements matched the selector "#dot-2>>"
I understand it must be some kind of problem that “#dot-2” does not exist when is clicked. But why does it work in debug mode? Is there a way to fix this? I tried putting content into “PassageDone” passage, but no success.