Very nice script! Simple and elegant:).
I would like lifeinplymouth recommend fixing and absolute upper limit for punishtime, and also to check whether the OpenCdTrays() functions properly.
I am working on something similar in my farkel script, where I in addition to have an array of lines to be typed, I also have an array of taunting texts which aim is to distract the typer:). You could do that as well, if you like the idea.
Also I have made a code which calculates the amount of seconds you get to type the sentence correctly.
Now my script is a lot shorter, so take that into account when you see the very short time you have.
Code:
show("I want you to write the sentences I provide you.\nYou need to type them quickly and correctly.\n\nFinish them with not too many mistakes, and you might just get to cum!")
showButton("Yes, Mistress "+mistress+"!")
show("Let us try it out!\n\nType the next three sentences correctly as fast as you can?")
showButton("Ready, Mistress "+mistress+"!")
def round = 0;
def timeTaken = [0, 0, 0]; //The array which stores the time taken to write each sentence.
while(round < 3){
line = lines[getRandom(lines.size)]
typingStart = getTime()
typingInput = getString("Type: "+line,"")
typingEnd = getTime();
if(typingInput == line){
timeTaken[round] = typingEnd-typingStart;
round++
show("Correct!"+((typingEnd-typingStart)))
showButton("Ready, Mistress "+mistress+"!")
}else{
round = 0
show("Wrong!\nYou have to start over.")
showButton("Sorry, Mistress "+mistress+"!")
}
}
def timeDeadline = (int)(timeTaken[0]+timeTaken[1]+timeTaken[2])/3
if(timeDeadline > 25){
setImageDefeat(1)
show("That was pathetic. You spent "+timeDeadline+" seconds on average on the sentences.")
showButton("Sorry, Mistress "+mistress+"!")
timeDeadline = 25
}else{
show("You spent "+timeDeadline+" seconds on average on the sentences.")
showButton("Okay, Mistress "+mistress+"!")
}
timeDeadline += 5; //This adds a value to the average to make sure that it is in fact possible to type all sentences.