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.

Author
Message
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 5th Feb 2006 02:05
*grids teeth and prepares for angry responses* Is it possible to save? I searched this subject and came across ingame saving, as in rembering a variable. Is it possible to save, then quit, then load you save game file?

dont assume cause ull make an ass out of you and me!
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 5th Feb 2006 02:21




If you want anything DB related hosted, log in (with ws ftp or something) www.lysergium.net with username public@lysergium.net and password public. you'll be directed to lysergium.net/public
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 5th Feb 2006 02:36
uh, please explain, i have no clue what this does, and it doesnt do anything in the editor, probalby casue i need to do somthing with it, but i cant if you dont explain.

dont assume cause ull make an ass out of you and me!
MMORPG programs
19
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 5th Feb 2006 03:42
not meant to be a editor program just an example
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 5th Feb 2006 04:56
The easiest way is to put everything you want to save in an array and use the "save array" and "load array" commands.




flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 5th Feb 2006 15:15
ga, im so confused, im making a game made up of variables, like a tycoon game, only without as much visual. would the numbers be in an array like this?


dont assume cause ull make an ass out of you and me!
fantasy
18
Years of Service
User Offline
Joined: 2nd Feb 2006
Location: London -UK
Posted: 5th Feb 2006 21:27
if this saves a game and loads in DBpro
can it be imported to FPS creator for a save and load feature
as i see FPS creator was made in DBPro
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 5th Feb 2006 22:59
Variables are not arrays. To get an array you need to "dim" it.

Like if you want to store 5 names you first make the array:


When it says "dim" that tells Darkbasic the next word is the array name. The "$" means that this array is a string of text. The "(4)" means that you want the array to have 5 elements (the number you have +1 because zero is the first element in the array).

You define the array just like you do a variable but you specify which field you want to use:


Those names are now stored in the array "Friend$". If you want to print the array you can use a for/next loop and change the number it uses per loop (I added a "wait key" if you wanted to copy the code snips and run them):


The for/next loop makes t=0 at first and will add 1 to t until it gets to 4.

When you want to save the information stored in the array you use the same method I showed above. The syntax is "save array filename$,array(0)"... in this case it's:


The filename can be anything you want. To load the array you do the same exact thing but use "load array" instead:


Using the above code snips what would you need to do to print just "Amanda"?


flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 6th Feb 2006 02:59
you would set the thingmagicky.. oh heres code.

ok, i think that works, but is there a way so when you quit out of the game entirely, you can still get to you information?

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Feb 2006 04:30
Quote: "ok, i think that works, but is there a way so when you quit out of the game entirely, you can still get to you information?"


Did you even try to run your code in Darkbasic?

Yes, you can still get the information because you're creating a file with the information. Once that file is made you can load it as often as you want to get the data.

You've created what we call "spaghetti code"... it's code that's difficult to follow because of all the "goto"s. There's no need to use "goto" at all. If you use "gosub" when you want to go back to the line right after the "gosub" you use "return". But with the code you have you don't even need any "gosubs".

Anytime you want to use an array you "dim" it at the top of the code. Using "load array" before the array is even "dim"ed won't work.

The answer to my question is "print Friend$(1)" to print "Amanda".




flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 6th Feb 2006 23:58
omg, it works, speeckless, thank you sooooo much. I did try the other code and it worked fine. Well, i typed it twice, onec in DBP and once in the forum, the one i used in DBP work fine, and i pretty mush compied that one word for word, dont know why i didnt copy paste. I will now go analize your code to figure it out, cause if i cant save/load to work, your charater in the game will be helpless... FOREVER!!!! THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!! YOUVE JUST OPEND UP SOOOO MANY DOORS FOR ME!!!!!! rpgs, stadegy, high scores, and such!!!! THANK YOU!!!!!!!! much!!!!!! I WISH I COULD!!!!!!!!! THANK YOU!!!

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Feb 2006 01:31
Np.


flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 10th Feb 2006 02:31
grrr! i was trying numbers instead of words, i changed all the $s to #s, but then it said the file didnt exist when i tried to load, and the string command, on in code, wouldnt work if i chaned the $ to #, but also couldnt work when everything else was ine # format..


dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Feb 2006 02:38
The "str$()" command converts the variable "t" to a string. So if you want to make "Friend$(t)" into "Friend#(t)" it also needs to be converted to a string to print it out... "str$(Friend#(t))".


Login to post a reply

Server time is: 2024-11-27 06:35:37
Your offset time is: 2024-11-27 06:35:37