Hey there, I'm back !
I've asked for help a while ago and got great help from Chapel, yet I didn't have enough time so far to continue trying out stuff with SugarCube.
Well, I've managed to do something, and obviously I'm having some issues I can't understand.
So here's the thing, I've done a widget "chat" which manages to simulate a conversation. I enter 2 names (<<chat 'Roméo' 'Juliette'>> then enter who speaks first, what they say, then when I want the other one to talk I enter his name and do the same. (<<chat 'Roméo' 'Juliette' 'Roméo' 'You re amazing, Juliette' 'Juliette' 'Oh, thanks Roméo...' >>
Like this !
And this part has been working wonderfuly.
But here's where I am having trouble with : I can't manage to print out "name is writing" and erase/replace it when the sentence is printed.
Here's what I've tried :
<<widget 'chat'>>
<<nobr>>
<<set _name to $args.shift()>>
<<set _name2 to $args.shift()>>
<<set _nameActuel to _name>>
<<set _i to 0>>
<<repeat 2s>>
<<if $args[_i] eq _name>>
<<set _nameActuel to _name>>
<<set _i++>>
<<elseif $args[_i] eq _name2>>
<<set _nameActuel to _name2>>
<<set _i++>>
<</if>>
<<set _message to $args[_i]>>
@@#typing; _nameActuel is writing.@@ <br/>
<<timed 1s>>
''_nameActuel'' : <<if _nameActuel eq 'Joris'>>@@color:red; _message @@ <<else>> _message <</if>> <br/>
<</timed>>
<<remove '#typing'>>
<<set _i++>>
<</repeat>>
<</nobr>>
<</widget>>
This "almost" works, but I get the error "Error: <<remove>>: no elements matched the selector "#typing" ",
Although the <<remove>> is obviously doing its job ? And I have no idea how to include <<br/>> in the @@#typing;@@ thing, it makes me an error as well ?
Hopefuly I've been clear enough... I'm sorry if I wasn't, please let me know !
And thanks a lot for your help !