"Scan" every single letter in a textbox

  • 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

  • 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

  • zhroguexe The score thing you mentioned would be easier using the end expression or just a simple regex.

  • briggybros

    zhroguexe

    Thank you all really much I'll try it!

  • 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?

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • you could make it so that the for loop ticks every second, something like this:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)