"Scan" every single letter in a textbox

Get help using Construct 2

Post » Fri May 29, 2015 9:23 pm

Hi,
Is there a way to "scan" every single letter in a textbox and then create an event where it compares the letter that is "scanned" at the moment. I want to try to make a program that generates a code like this "-*-*" and for every "*" it should make a sound and for every "-" it should stop for a second. The program later should be able to generate different sound combinations. :)
Thanks :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Fri May 29, 2015 10:01 pm

Image
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Fri May 29, 2015 10:15 pm

if you're interested about the mid thing

Mid(string,whereyouwanttostartofstring,numberofletterstoreadfromstartofstring)

so for example

if we have a string called word with the value of "potatoe"

Mid(word,1,2) would give you "po"

you can also use Len(word) to get the number of characters in a word so you can do Mid(word,1,len(word)) to get: "potatoe"

and so on


Oh also if you wanted you could use the Mid thing to merge 2 parts of a string together, thats a cool trick if you want to save names and scores in the same variable
(example:
playerscore has saved inside of it : Playerone8
leaderbordshowtext = (Mid(playerscore,1,Len(playerscore)-1) & " has score of " & Mid(playerscore, Len(playerscore)-1,1)

which gives: Playerone has score of 8
sorry if i went off topic xD
B
5
Posts: 48
Reputation: 319

Post » Sat May 30, 2015 12:36 am

@zhroguexe The score thing you mentioned would be easier using the end expression or just a simple regex.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Sat May 30, 2015 5:48 pm

@briggybros
@zhroguexe
Thank you all really much I'll try it!
:D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Sat May 30, 2015 6:14 pm

@briggybros
Ok it works but it has one problem.
The sound has almost no delay so the sound doesn#t stop for a second. Is there a way to slow the For event down so it increases only 1 time per second?
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Sat May 30, 2015 10:21 pm

i dont know if this would work as it would with system threading on windows but you could try adding a wait 0.5 or 0.01 at one of the points in the loop to slow it down as much as you need
B
5
Posts: 48
Reputation: 319

Post » Sun May 31, 2015 1:37 pm

@aquadujoib you could make it so that the for loop ticks every second, something like this:

Image
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], dop2000, Kin, Yahoo [Bot] and 31 guests