Hello everyone!
It's been a while since I've written on these forums, but I'm back with this wonderful program called AGS.
I'm a little rusty with the scripting part of AGS, so I want to ask for help
I'm trying to write a function to type text like a typewriter.
I have two problems with my current code:
1) I need to press any key (such as the mouse button) to skip the text and appear the next word (character).
2) The function does not work in the global script to be called in any room, but if you write the code in the room script, it works fine.
The code is the following:
Code: ags
And when I use the function for example when I look an object:
Code: ags
The function works fine, but I need to press a key, the text disappears and comes back with the next word, something like:
W
*presses a key*
*text disappears*
*text appears again*
Wo
*text disappears*
*text appears again*
Wow
Someone can help me with this?
Thanks in advance
It's been a while since I've written on these forums, but I'm back with this wonderful program called AGS.
I'm a little rusty with the scripting part of AGS, so I want to ask for help
I'm trying to write a function to type text like a typewriter.
I have two problems with my current code:
1) I need to press any key (such as the mouse button) to skip the text and appear the next word (character).
2) The function does not work in the global script to be called in any room, but if you write the code in the room script, it works fine.
The code is the following:
function Typewriter(Character* ch, String text, int speed) {
String textShow = "";
for (int i = 1; i <= text.Length; i++) {
textShow = text.Substring(0, i);
Display(textShow);
Wait(speed);
}
}
And when I use the function for example when I look an object:
Typewriter(player, "Wow, Amazing", 10);
The function works fine, but I need to press a key, the text disappears and comes back with the next word, something like:
W
*presses a key*
*text disappears*
*text appears again*
Wo
*text disappears*
*text appears again*
Wow
Someone can help me with this?
Thanks in advance