Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / help with some code i have written

Author
Message
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 25th Feb 2005 05:07
I have written some code as part of a save subrountineand its this:

rem declare save varibles
cam$="cam"
map$="map"
dat$=".Dat"

Rem main sequence
set text size 20
set text font "Arial"
if path exist("\saves")=0 then make directory "saves"
if path exist("\savedata")=0 then make directory "savedata"
cd "saves"
set cursor 5, 5
dir
Set cursor 400, 40
Print "Enter filename: ";
input f$
File$=F$+map$+dat$
set dir "savedata"
save array File$, ObjectData#(200, 9)
CamFile$=F$+cam$+dat$
save array CamFile$, CameraData#(1,6)
cd "Saves"
Save$(1,1)=F$+Map$+Dat$
Save$(1,2)=F$+Cam$+Dat$
save array F$, Save$(1,2)
wait key
end

the problem is at the line iv put in bold it closes and says runtime error 8003 could not find path and the line in bold is the one it says it cant fidn the path for. i thought it was because i have used the dir command mayb bt i duno cna anyone help me fixed this part of the code plz?

Thanks
Adam
Monsieur Mort
19
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 25th Feb 2005 05:19
The fact that it can't find the path means that your path doesn't exist. You're trying to open a folder in the same directory as that in which your program is saved called savedata, but the program can't find it. Make sure that folder exists. If it doesn't, make it and your code should be fine. If it does exist, then you might want to try using set dir "\savedata" or set dir "/savedata" instead. I haven't used set dir before myself so I dont' know if you need to include a slash or backslash but it seems plausible. So:

1) Make sure your foler exists in the right place
2) Try putting a slash or backslash in front of savedata
3) Come back here and we'll try to help some more.

Why do you sink I ave zees outRAGEOUS accente?!
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 25th Feb 2005 05:30
hi thnx for ur reply the folder does exist because the code at the top of my program creates it if it dusnt and in the code the "cd" in the code does the same as set dir and it dusnt work if i change it to that ether and it doesnt work even if i use saves and that should because the code above has already set it to thta directory and prints the contents to the screen but it only flashes because i havent looped the print bit. i thought it was because i used the dir command to read the contents of the directory bt i jus deleted dat an it still wont work i no wat u mean bout i cant exist bt it does an like i sed if it susnt the programs makes it so its weird

Thanks
Adam
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 25th Feb 2005 05:35
ok now its really strange its refusing to change directory all together after the line iv bolded because i jus deleted it and it saved the arrays like it says after the code in bold but then it stops again on the code that was ment to change the directory back which is cd "Saves" cna anyone help?

Thanks
Adam
Monsieur Mort
19
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 25th Feb 2005 05:35
You're right, sorry I didn't read the rest of the code, just assumed the problem was in that line. Could the problem be that while you're checking if "\savedata" exists, the folder you're creating is just "savedata"? There might be a problem about the swap from no slashes so some. Try fiddling around with the slashes, that's all I can think of to advise you.

Why do you sink I ave zees outRAGEOUS accente?!
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 25th Feb 2005 05:49
iv messsed around with slashes and had interesting results useing ether slash made the program run but no directorys are created and no files are saved anyone got any ideas plz?

Thanks
Adam
Monsieur Mort
19
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 25th Feb 2005 06:03
Assuming you tried putting slashes in _all_ instaces of "saves" and "savedata" then I'm all out of ideas for the moment. Sorry.

Why do you sink I ave zees outRAGEOUS accente?!
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 25th Feb 2005 06:09
ye i did but like i sed it worked but it didnt create a directory or save the files oviusly because there was no directory

Thanks
Adam
Soy Cocktail
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location:
Posted: 27th Feb 2005 08:51
It seems to me that you are coing into the folder of the current directory ie. the place where the exe is, lets say c:\. Then you go into c:\saves, then you try to go into savedate, but you didn't go back up in the folder tree, so its trying to acess c:\saves\savedata and not c:\savedata

Hope that makes sense and that I didn't make a mistake somewhere.

Aku Soku Zan
Storm 6000
19
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 27th Feb 2005 18:28
nothnx alot thats fine now

Thanks
Adam

Login to post a reply

Server time is: 2024-09-23 13:15:31
Your offset time is: 2024-09-23 13:15:31