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 / Save/load help

Author
Message
medsouz
14
Years of Service
User Offline
Joined: 10th May 2010
Location:
Posted: 29th May 2010 05:26
I already got this code:



But the loading function doesnt work and the saving works fine.


Switching from Lua scripting to BASIC Programming is a HUGE change..
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 29th May 2010 10:20 Edited at: 29th May 2010 10:51
hi med, I dont get the if statement you are using .. and you have no CLOSE FILE statement. If you only call the function to open and read files, I think you can skip the if-clause. you might want to add a condition to check the file was opened correctly and respond if not - but that's a different matter.
I think the following should work ok for you ..

EDIT: you aren't closing your save file either .. the process is - open file to [operation] #filenumber, #filepath - do operation - close file #filenumber -



if effort>reward : gosub home : endif
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Jun 2010 17:37
Using functions also requires that you understand how they work (you really should use subroutines until you do).

For example, the variable Loading is local to LoadGame() and will never be anything other than 0 (zero) when the function is called - so all lines which use it are redundant.

Check out numbers 1 to 4 here:

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

TDK

Login to post a reply

Server time is: 2024-09-28 18:16:13
Your offset time is: 2024-09-28 18:16:13