Hello everybody.
So I have a dialogue system like this:
The event on the map calls a function called SetDialog. Dialog is parsed as a single text with many "@"s where it is going to be split because the box have text limit.
Like this:
Text: "Hello, I like your cupcake.mha@Can I have it?mha@Oh... C'mon..."
Will be shown as:
(Starts Dialogue)
"Hello, I like your cupcake." (Letter per letter)
(Stops until user presses B)
(Clear)
"Can I have it?" (Letter per letter)
(Waits B Press)
(Clear)
"Oh... C'mon..." (Lpl)
(Waits B Press)
(Clear)
(Ends Dialogue)
I use a repeat loop, will a tokenat() to go trough all the speeches.
"repeat tokencount(NextText,"@")"
Inside of it, to detect when a key is pressed, I used a Wait for Signal, and on "when key b pressed, and all the current text is on the dialog box"; a corresponding Signal action.
However, the loop doesn't seem to care about my Wait for Signal.. How do I pause a loop?
That is my code, if you want to take a look.
Global Text NextText
Global Text CurrentText
Global Number TextSpeed
CONDITIONS:
(Inverted) CurrentText = ""
Repeat len(CurrentText) times
Every TextSpeed seconds
(Inverted) Textbox.Text = CurrentText
ACTIONS:
Textbox Append Text mid(CurrentText,loopindex,1)
CONDITIONS:
On Function "SetDialog"
ACTIONS:
Set NextText to function.param(0)
Set CurrentText to ""
Clear Textbox
Stop Character from moving
SUB-EVENTS:
---CONDITIONS_1:
---Repeat tokencount(NextText,"@")
---ACTIONS_1:
---Set CurrentText to tokenat(NextText,loopingIndex,"@")
---Wait for signal "B_Pressed"
---CONDITIONS_2:
---*empty*
---ACTIONS_2:
---Make character be able to move again
CONDITIONS:
On Keybord B Pressed
Textbox.Text = CurrentText
ACTIONS:
Signal "B_Pressed"