how do i load a text file?

You must understand the Game Editor concepts, before post here.

how do i load a text file?

Postby DarkParadox » Sat Feb 16, 2008 4:39 pm

i need a code that will load a .txt file according to a text actor's text
now all i need is the code above
Last edited by DarkParadox on Sat Feb 16, 2008 9:56 pm, edited 3 times in total.
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: Rename text problem/Load File

Postby Azou » Sat Feb 16, 2008 6:51 pm

I have just one solution:
Make the txt to be an animation
An then
Key down--Your key---Change animation/Txt into txt 2
Is it that,Diormeh? :D
User avatar
Azou
 
Posts: 514
Joined: Thu Sep 13, 2007 1:12 pm
Score: 35 Give a positive score

Re: Rename text problem/Load File

Postby DarkParadox » Sat Feb 16, 2008 9:02 pm

no, it isn't.
i wanted it to go on forever and it HAS to be a text actor
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: Rename text problem/Load File

Postby pyrometal » Sat Feb 16, 2008 9:18 pm

Here it is!

Demo.zip
(196.24 KiB) Downloaded 150 times


I don't know how to read and write files successfully yet so I'll leave that part to someone else.
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: Rename text problem/Load File

Postby DarkParadox » Sat Feb 16, 2008 9:26 pm

Thanks! :D
but i still need the load function
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: how do i load a text file?

Postby makslane » Sun Feb 17, 2008 11:43 am

Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: how do i load a text file?

Postby makslane » Sun Feb 17, 2008 10:40 pm

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.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: how do i load a text file?

Postby DarkParadox » Sun Feb 17, 2008 11:26 pm

makslane......
theres a problem with that code too,
it gets rid of the first line....
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest