I'd like in my TypeLine function for a specific key (X - 88) to have to be pushed before the overlay is removed, as opposed to any keypress at all doing it.
At the moment, the code is like:
function TypeLine (int message, int vspacing, int xpos, int font, int colour, int width, int delay, int wait) {
string line;
GetMessageText(message, line);
SetTextWindowGUI(1);
//declare local vars
Ã, int length=0;
Ã, int i = 0;
Ã, string displayedline;
Ã, int textid = 0;
//initialise vars , overdoing it a bit ;-)
Ã, length = 0;Ã,Â
Ã, i=0;
Ã, StrCopy(displayedline,"");
Ã, textid = CreateTextOverlay(xpos,100,400,font,colour,displayedline);
Ã, Ã, Ã, Ã, Ã, //get string length, to know how long the loop must run
Ã, length=StrLen(line); //set string length
Ã, Ã, Ã, Ã, Ã, //start loop
Ã, Ã, Ã, Ã, Ã, SetGlobalInt(0,1);
while((i<length) && (1||(WaitKey(delay)==0))) {
Ã, Ã, Ã, Ã, Ã, // pick character at position "i"and stick it at the end of string "displayed line"
Ã, Ã, StrFormat(displayedline, "%s%c", displayedline, StrGetCharAt(line,i));
Ã, Ã, Ã, Ã, Ã, //set textoverlay as displayedline
Ã, Ã, SetTextOverlay(textid,xpos,vspacing,width,font,colour,displayedline);
Ã, Ã, Ã, Ã, Ã, // if a space is added to the string do not play a sound, else play a 'tick'
Ã, Ã, if (StrGetCharAt(line,i) == ' '){
Ã, Ã, }
Ã, Ã, else{
Ã, Ã, Ã, Ã, PlaySound(1);
Ã, Ã, }
Ã, Ã, Ã, Ã, Ã, Ã, //increase the loop counter
Ã, Ã, i++;Ã,Â
[b]Ã, Ã, if (i==length) if (wait>0) WaitKey(wait);
Ã, Ã, else if (wait == -1) while (WaitKey(100) == 0) { }[/b]
Ã, Ã, }
RemoveOverlay(textid);
SetGlobalInt(0,0);
Wait(5);
}
Can I incorporate a (IsKeyPressed(88) ==1) line into it or something?
while (IsKeyPressed(88) == 0) Wait(1);