Hello. I've managed to set up a simple trivia script. Everything's working fine except for the hint system, which I'm struggling with as I'm not too good with scripting and have no idea how to use complex identifiers like $regsubex. I'll be grateful to anyone who can help me with setting the 4 hints system below.

Basically, I read from a txt file and store the question and answer into variables. So far so good.

For example, I get from the qa.txt file: Who founded Microsoft?|Bill Gates.

My script posts the question: Who founded Microsoft?

After that is where I need help. I want a four hint system that does the following:

1st hint (Entire answer asterisked - no letter should be shown, with *exception Please see below): **** *****

2nd hint (Show ONLY 1 letter from each word, the first. It MUST always be the first letter.): B*** G****

3rd hint (Show ONLY 1 more letter from each word, but random. Could be anywhere in the word, and it could be vowel or consonant. Doesn't matter.): B*l* G**e*

4th hint (Show ONLY 1 more from each word, but random. Could be anywhere in the word, but this time MUST be vowel if available, otherwise a consonant): Bil* Ga*e*


*Exception
: Everything on the first hint should be asterisked. I want nothing to show except for punctuation marks that could be part of the answer. For example: commas, hyphens, dots and apostrophes. For example, a question could be Whose book was John talking about? and the answer could be Mary's As you can see, the ' in Mary's is part of the answer, so it should be shown. Name a famous cathedral? St. Paul's Here, both . and ' are part of the answer, so they should both be shown. In short: the first hint should ALL be asterisked except for punctuation marks.

One more quick example:

Q. What does the acronym USA stand for?

H1. ****** ****** ** *******
H2. U***** S***** O* A******
H3. U**t** S**t** Of A****c**
H4. U*it** S*at** Of A*e***c*

Last edited by PopMerrill; 19/02/22 03:40 PM.