Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[CNC] Extension for searching text positions...


USC

Recommended Posts

Hey.

I hate to ask so many questions, but I'm kinda stuck here.

Alright, I'm making a "Fill in the blank program" for a friend of mine. Ideally, it's suppose to randomly take out random words from a sentence, and you have to guess what they are. Here was my thought process...

1. Load the text

2. Set a variable to a random number, between certain values.

3. Have a loop where the program goes through every letter, one at a time. If it finds a blank space, it adds one to another variable.

4. When the "blank space" variable equals the random number variable, save the current index value, then keep going until it reaches the next space.

5. Get that index value, subtract the starting index value and save the number that results.

6. Finally, do something like this...

*Set TextBox2 = TextBox1.substring(Starting Index Value, Number of Characters)

*Set TextBox1 = TextBox1.replace(Starting Index Value, Number of Characters, "______")

...This sets some text equal to the word we want to take out of the string (so the program can compare what you type to that). Then, it replaces it with a "_______" in the original text...

------------------------------

My problem is, I haven't been able to find an extension that allows you to go to a text Index Value. String Parser lets you save a word's index value in a counter, but I haven't been able to use that for anything. I think I have a way around it (I'll post later if anyone's interested), but it's pretty convoluted and inefficent. If anyone would help, it'd be much appreciated.

Link to comment
Share on other sites

Hahaha. Believe it or not, shortly after writing that, I figured it out. Yeah, the Mid$ function on String Parsar works for what I need (I had tried it before, but for some reason got a syntax error. Weird).

Still, thanks a lot for replying Mark. I was really stuck there...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...