Computer Science Canada

Saving Once Again

Author:  Archi [ 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?

Author:  AsianSensation [ Tue Aug 12, 2003 8:48 am ]
Post 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?

Author:  Archi [ Tue Aug 12, 2003 9:18 am ]
Post subject: 

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

Author:  Mazer [ Tue Aug 12, 2003 1:28 pm ]
Post 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.

Author:  AsianSensation [ Tue Aug 12, 2003 5:39 pm ]
Post 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.

Author:  Archi [ Tue Aug 12, 2003 9:42 pm ]
Post 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?

Author:  PaddyLong [ Tue Aug 12, 2003 10:58 pm ]
Post 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"

Author:  Archi [ Wed Aug 13, 2003 12:12 am ]
Post 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...

Author:  Mazer [ Wed Aug 13, 2003 7:17 am ]
Post 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

Author:  Archi [ Wed Aug 13, 2003 10:42 am ]
Post 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.

Author:  Mazer [ Wed Aug 13, 2003 11:12 am ]
Post 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.

Author:  Archi [ Wed Aug 13, 2003 6:52 pm ]
Post 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.

Author:  Mazer [ Wed Aug 13, 2003 9:10 pm ]
Post 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).

Author:  kmd-10 [ Wed Aug 13, 2003 9:26 pm ]
Post 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.

Author:  Archi [ Wed Aug 13, 2003 9:33 pm ]
Post subject: 

Yea it is a roleplaying game, but its more of a Final Fantasy type RPG.

Author:  Mazer [ Thu Aug 14, 2003 11:32 am ]
Post subject: 

kmd-10: but didn't the orange crayons smell different to you in comparison to all the other crayons? ah well, i'm not going to discriminate you for your crayon preferences Wink

archi: so it's definitely going to have turn based battles?

Author:  Archi [ Sun Aug 17, 2003 12:45 am ]
Post subject: 

ohh yea...I thought I had an uploaded version of it here...Its virtually completed except for a few things...But at the moment i'm working on making it more user friendly.

Author:  krishon [ Sun Aug 17, 2003 7:14 pm ]
Post subject: 

bout the saving thing...why dun't u have the text file in the same place as ur game file....i mean its much easier, unless ur tryin to do somethin......

Author:  Archi [ Sun Aug 17, 2003 9:09 pm ]
Post subject: 

yea..it just makes it a lil more bulky and less organized...


: