Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Saving Once Again
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Archi




PostPosted: Tue Aug 12, 2003 12:41 am   Post subject: Saving Once Again

How can I make it so that I read from *.txt files that are in another folder on my computer?
For example my game is in my Arakaron folder and I want all the *.txt files to be found in the data folder within the Arakaron Folder. how can i do that?
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Tue Aug 12, 2003 8:48 am   Post subject: (No subject)

code:
var file : int
open file, "C:\\Arakaron\\save.txt", get


When you want to open the file in another folder, just use input the director along with the file name.

seriously, it's there in the Turing help file, wouldn't it take less time to check that instead of asking here?
Archi




PostPosted: Tue Aug 12, 2003 9:18 am   Post subject: (No subject)

I tried, and it didn't work:S...but yea..i asked right b4 i went to bed...
Mazer




PostPosted: Tue Aug 12, 2003 1:28 pm   Post subject: (No subject)

what didn't work? actually, if it's in the data folder i guess it should be:
code:

open : fs, "c:/Arakaron/data/save.txt", get


as for your question, i'm assuming you mean if the directory holding the save game files isn't in the same directory as the turing file. like, your saves are in c:/Arakaron/data/save.txt and your program is in something like c:/Arakaron/program/main.t

in that case you would need the full path as shown above. but if the program is in the main Arakaron folder you'd only need to use
code:

open : fs, "data/save.txt", get


and go ahead and keep posting questions if you want (as long as you don't piss off a mod), it's not like there's anything else worth reading here.
AsianSensation




PostPosted: Tue Aug 12, 2003 5:39 pm   Post subject: (No subject)

Mazer wrote:
it's not like there's anything else worth reading here.


lol, of course, since this is the Turing section of this board.
Archi




PostPosted: Tue Aug 12, 2003 9:42 pm   Post subject: (No subject)

So Mazer, what you said bout the foler thingie, the last piece...Would that work for a zipped file? Like I've got no idea where my players would unzip the file to, but I want to have seperate folders...Would that work?
PaddyLong




PostPosted: Tue Aug 12, 2003 10:58 pm   Post subject: (No subject)

it's either relative to the directory where the program is or it's absolute directory ... so if your program is in one folder and then the saved things are in a subdirectory of that folder then it would just be "subfolder/save.txt"

or if you know exactly what directory it is in it's like
"c:/somefolder/subfolder/save.txt"
Archi




PostPosted: Wed Aug 13, 2003 12:12 am   Post subject: (No subject)

thanks..it makes much more sense now...
Another question, I don't wanna clutter the message board with my helpless posts so i'll aks it here...


Would this work?

randint (movement,enx,eny)
I'm trying to make it so my enemy randomly moves while I move. BUt I want to randomly choose whether he moves up or down, thus the rnadint part to decide which stat will be changed...
Mazer




PostPosted: Wed Aug 13, 2003 7:17 am   Post subject: (No subject)

why not do this:

code:

enx += Rand.Int (-1, 1) % randomly move left, move right, or no horizontal movement
eny += Rand.Int (-1, 1) % randomly move up, move down, or no vertical movement
Archi




PostPosted: Wed Aug 13, 2003 10:42 am   Post subject: (No subject)

because I don't want it to move left and up at the same time. or at least, i didn't plan on that...i would prolly make it too easy for it to outrun the player if its lucky.
Mazer




PostPosted: Wed Aug 13, 2003 11:12 am   Post subject: (No subject)

ah...

code:

case Rand.Int (1, 2) of
    label 1 : % left/right
        enx += Rand.Int (-1, 1)
    label 2 : % up/down
        eny += Rand.Int (-1, 1)
end case


that should do it, although it still leaves the possibility of the enemy not moving at all for some turns, but i was too lazy to write the code that would check for that. all you'd need to do is have a variable that stores a random int from say, 0 to 1 and if it's 0 set it to -1. then add it to the enemy's coordinate, whether it's the x or the y.
Archi




PostPosted: Wed Aug 13, 2003 6:52 pm   Post subject: (No subject)

That works exactly like how I want...and it doesn't bother me if the enemy doesn't move.
Now the only thing I have to worry about is whether or not I actually want to make it where u can see your enemies or if you should just be walking around.
Mazer




PostPosted: Wed Aug 13, 2003 9:10 pm   Post subject: (No subject)

you are making an rpg, are you not? if so, i'd suggest making it so you can see the enemy. if there's one thing that pisses me off, it's orange crayons. if there's one thing (about rpgs) that pisses me off it's those damn random battles. i mean, random battles are fine if you wanna role play a freaking barbarian or something, but what about someone like solid snake? using stealth to avoid battle (and then the player will have more time to focus on the story).
kmd-10




PostPosted: Wed Aug 13, 2003 9:26 pm   Post subject: (No subject)

orange crayons? they're the best color for crayons: they're always much smoother than the rest of the colors.
i can't believe they piss you off .. they've always been my preference when i didn't know what color to color something. and i was using crayons.
Archi




PostPosted: Wed Aug 13, 2003 9:33 pm   Post subject: (No subject)

Yea it is a roleplaying game, but its more of a Final Fantasy type RPG.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: