Page 1 of 1

Script to make the computer type for you?

PostPosted: Sun Apr 13, 2008 4:12 pm
by Kooldudese
Ok, i was bored one day,and i was looking around for something, (forgot what already) and i stumbled upon a vbs script that helps you type, the code was simple and if anyone wants it here it is...

set wshshell = createobject ("wscript.shell")
wscript.sleep 1000
wshshell.sendkeys "What you want the computer to type"
wshshell.sendkeys "{enter}" <-- it even supports function keys
next
(if ur gonna use it save it as a .vbs with notepad)
anyways, the point is i was wondering if game-editor can do the same thing...
it would be interesting to have...

Re: Script to make the computer type for you?

PostPosted: Sun Apr 13, 2008 6:57 pm
by DarkParadox
(sorry if it isn't what you intended to get)
To put the whole text in a single actor text, you can use:

Code: Select all
void readtext(char *fileName, char *s)
{
    int c;
    FILE *fp = fopen(fileName, "r");
    if(fp)
    { 
      while((c = fgetc(fp)) >= 0) *s++ = c;
      fclose(fp);
    }

    *s = 0;
}


And call in some action:

Code: Select all
readLines("myfile.txt", mytextactor.text);


The file must exists in the same folder of the game.

(thank makslane for this exact post.)
(does not support key functions)