Script to make the computer type for you?

Talk about making games.

Script to make the computer type for you?

Postby Kooldudese » Sun Apr 13, 2008 4:12 pm

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...
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Re: Script to make the computer type for you?

Postby DarkParadox » Sun Apr 13, 2008 6:57 pm

(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)
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron