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.

DarkBASIC Discussion / Sven B or TDK_Man Help me, you both are very smart.

Author
Message
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 9th Sep 2005 22:14
In my game I have a save function. How do I delete the file if the user wants it deleted. Below the code doesn't work for the deleting part.



Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 9th Sep 2005 22:59
Try changing your files to be saved as .DAT
I have a config file for my game, it loads it, and if any options are changed, deletes the file and creates a new one.
You shouldn't have any problems with the rest of the program.
Hope this works, please let me know if it doesn't
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 9th Sep 2005 23:00
Er, also try closing your file before deleteing it
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Sep 2005 00:04


Your signature has been erased by a mod because it's larger than 600x120...
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 10th Sep 2005 01:41
No offense dude but Phaelax, your code didn't work. I'm tryin Leeorg right now. Thanks for taking the time to look here though.

Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Sep 2005 02:09 Edited at: 10th Sep 2005 02:12
The main problem is you use the return key as your input for asking if they want to delete the file or not. When you use returnkey() it instantly works and any lines under it (like suspend for key) won't work because the return key is still being held down. This program goes so fast it reads the returnkey from the delete file question and as the user is finished with his inputing his name. Thus the name$ is nothing but a blank line. The file is actually deleted but remade (with a blank name) so fast it doesn't look like it's deleting the file.

When you use "input" it's best not to turn on syncing. Input freezes all actions till the user presses enter... meaning there's no place to add a sync to see the user input.

If you open and write a file there's no need to check for the file being open outside of the "if file exist()"... put "close file 1" inside the "if file exists()" statement because you know for a fact that inside that "if file exists()" statement the file is opened.

If you want programs to use the escape key always add "disable escapekey()" near the top of the program. Without that line pressing ESC will always escape out of a program even when you don't have lines like "if escapekey()=1 then end". I changed your question input to inkey$() so I changed them to a "Y" or "N" question.

I lined up all the loops. It's always good to space it out so you can see where each loop begins and ends... makes debuging and finding nested if errors a lot easier. Write code with spaces and you'll never regret it later.

Hope this helps:

DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 10th Sep 2005 02:12
Dude, your are the man. That helped me out definetely. I owe you props. Ty GROG

Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Sep 2005 02:13
np I added a line so check that message again (talking about do/loops and spacing)
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 10th Sep 2005 03:29
I'm insulted! Calling me 'not' one of the smart ones??

J/k. But you shouldn't say that. There are many other smart programmers, just make the title attractive! Heck, I think I'm a pretty smart programmer!
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 10th Sep 2005 04:10
Xenocythe, You are indeed a good programmer. It's just that I remember the names TDK and Sven B easily that others. They just seem to have a ring to them and I am always seeing them help others out in their games. Sorry for all those who I didn't mention. Besides what I just said, I didn't have all the room in the world to type everyone who is good.

Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Sep 2005 04:39 Edited at: 10th Sep 2005 05:12
Who can spell Xenicothe anyway?...

Just kidding!

And there's very little that can improve on Grog's code either...



TDK_Man

DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 10th Sep 2005 04:52
@TDK
lol be nice hehe anyway TDK HOW goes your IDE I want to use it lol

Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Sep 2005 05:18
He knows I'm only jesting...

Quote: "HOW goes your IDE"


OK - trying to get as much fixed before I release the next version.

And I just noticed another post by Grog and I didn't check what he had added, so the code snippet in my last post may now be redundant.

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Sep 2005 07:00 Edited at: 10th Sep 2005 07:04
Quote: "And there's very little that can improve on Grog's code either..."


Thanks... well it's Sony's code with Leeorg's suggestion and I just changed it a bit. One of the things I enjoy most here is taking other peoples code and finding the bugs.

Your code is MUCH better.

Quote: "And I just noticed another post by Grog and I didn't check what he had added, so the code snippet in my last post may now be redundant."


I just added text in the message... no code changes.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 10th Sep 2005 10:43
Sorry I couldn't help...

School has just begun and I don't have as much time as in the vacation...

Immunity and Annihalation makes Immunihalation...
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 10th Sep 2005 18:16
No worries Sven B. TDK and Grog helped me out. Next time I'll call you.

@Grog, hey lol, I just got that code off the codebase and wanted it to work. You know anyone who needed help when trying to save their RPG game, or any other type of game that they are making.

Games I am releasing:
Dragon Stone I : Journey to Achilles Dungeon - 2006?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Sep 2005 22:01
It's best to not use peoples names in a request. Some people might not post because you specifically ask a certain person.

I only know of this thread (but they were helped):

http://forum.thegamecreators.com/?m=forum_view&t=54497&b=10

Login to post a reply

Server time is: 2025-05-22 08:56:09
Your offset time is: 2025-05-22 08:56:09