Topic:   File handling   (Read 21110 times)


0 Members and 2 Guests are viewing this topic.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
File handling
« on: June 30, 2011, 10:32:42 AM »
I'm trying to recreate my fileio grid nav for SC.

1.) what is the diff. between openfile$ and openoutfile$
2.) can I have a syntax example of the above
3.) can a have a syntac example of filereadline$
4/5.) can I have a syntax example of CLOSEOUTFILE and what is it's significance?
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: File handling
« Reply #1 on: June 30, 2011, 02:15:54 PM »
I'm not sure how they work, I never had to use any of these. :(
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: File handling
« Reply #2 on: June 30, 2011, 03:33:34 PM »
any ideas of where I can find the documentation?
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: File handling
« Reply #3 on: July 01, 2011, 01:21:13 PM »
No, just keep asking people about them I spose. Gan did some pretty cool stuff with SC so he might know more, or you could just start experimenting!
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Charlo


  • GMG-er

  • **


  • Posts: 451
Re: File handling
« Reply #4 on: July 01, 2011, 08:13:34 PM »
1.)  I don't know what OPENFILE$ does, but I'm guessing it opens a file to be read from (I use OPENINFILE to do the same thing).  OPENOUTFILE opens a file to be written to.

2.)To open a file that I want to read data from, I use:
Code: [Select]
OPENINFILE 2, "scores"
The "2" is the number of the file (to reference the file later).  "Scores" is the actual name of the file.

3.)This code would print the first line from file #2.  Every time you call FILEREADLINE$, it reads the next line. It's not very useful if you want to read things out of order since there's no way to tell it which line to read.
Code: [Select]
PRINT FILEREADLINE$(2)

4.)
Code: [Select]
CLOSEOUTFILE 3
CLOSEOUTFILE closes a file that you've been writing to.  I'm not sure what the consequences are if you leave a file open after you're done writing to it, so it's best to close every file that you open.
« Last Edit: July 01, 2011, 08:14:18 PM by Charlo »

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: File handling
« Reply #5 on: July 04, 2011, 10:38:50 PM »
Thanks I'll make sure to tell you guys how it goes.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: File handling
« Reply #6 on: July 05, 2011, 04:11:35 PM »
Quote
3.)This code would print the first line from file #2.  Every time you call FILEREADLINE$, it reads the next line. It's not very useful if you want to read things out of order since there's no way to tell it which line to read.
Code:
PRINT FILEREADLINE$(2)
actually no. if it's inside a for loop and set to he same variable. It will read different lines. That's actually the area I've been having trouble with
http://www.mediafire.com/?c2p8s84p9b2mt5m

1.) can I have a syntax example of a 'FOR' loop
2.) how do I set FILEREADLINE$ to a variable?

Thanks for all the help your giving me :)
EDIT: I solved the problem check out: http://therist.com/gamemakers/index.php/topic,156.msg2285.html#new for more info.
I'll post it here also in the code exchange.
« Last Edit: July 05, 2011, 05:26:27 PM by KurtManion »
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: File handling
« Reply #7 on: September 05, 2011, 11:15:06 AM »
IDEA!!!
two words shell scripting!
the download would just be a folder with an exe(for mac) and a batch(for windows) they'd be installers that you use with would grab the materials from the internet using download routines, and then place them in the corresponding folders. ie. application support on a mac, and then download the actual game to the desktop, and the games coding targets the folder in application support we downloaded using the installer, the installer than deletes the folder it was in, so that it only downloads once, and would also avoid piracy!

It's all theoretical of course, but I'm sure it will work! We've just got a bit to learn, and the great thing is that it would work for every language.  ;D and you can't beat that!

EDIT: tell me if you actually would use this, it wouldn't require you to learn anything, just change sprite paths.
« Last Edit: September 05, 2011, 11:16:25 AM by KurtManion »
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: File handling
« Reply #8 on: September 17, 2011, 01:39:28 PM »
it almost works I have to get the darn cd command to work correctly. Its super easy to modify for a game and I'd even do it myself its so quick.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to