Text functions and operands

mariusiancumariusiancu Member Posts: 9
edited June 2012 in Working with GS (Mac)
Hi!
I am making a trivia game where the player have to type the right answer, not to choose it from a list of possible answers.
I made the keyboard thanks to tshirtbooth and his video:
Comparing the typed answer with the right answer from a table is no problem. But I want more :)
I want to be able to show random letters after a period of time. For example, if the player doesn't type anything for 10 seconds I want to show 2 letters (at random position in text) and, of course, lower his score :) Then after another 10 seconds, another 1 letter and less points. And so on. I think you got the idea.
So for this I need text functions like "str", "substr" and alike. Is there anything I can use for my project? Or, is there any other way I can pick a letter from a string?

Thank you guys.

Best Answers

  • lukey5227lukey5227 Posts: 111
    Accepted Answer
    Well, one of the number one things I'd suggest is having a table with the strings.

    Get two tables: The first has the questions. Row 1 has question 1, row 2 has question 2, etc...
    The second table should be the text. Question 1's answer will be in row 1. Each column is a different character. For example, Hello! Would be separated into H, e, l, l, o, and !.

    I'd also suggest having the first table contain how many characters the answer has.

    Now, since I'm not 100% sure how yours is working I'll give you an idea of how it would work this way.

    1) GS picks a random number between 1 and the total number of characters of the answer (in table 1)
    2) Round that number to the nearest whole number
    3) Find the question #, go to that row in the second table and choose the column number of the random number that was rounded.

    You now have the character. Place it in the correct position or add it to the string.

    Use @luke5227 if you want to ask me more...

    Hope I could help!
  • lukey5227lukey5227 Posts: 111
    Accepted Answer
    ;)

Answers

  • mariusiancumariusiancu Member Posts: 9
    Thank you luke! I had that in mind. The trouble is that I have 30000+ questions and answers in an excel file. I hate excel by default :)))) So I have to find a way to split the answers in individual letters. I don't think excel could do that. Maybe I'll try php script and mysql database.
    Thank you very much for your answer
  • mariusiancumariusiancu Member Posts: 9
    edited June 2012
    OK nevermind that. I use excel MID function and some copy-paste and I'll split the answers into individual letters.
    Thank you very much!
Sign In or Register to comment.