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 / Can DBP or DBPro do these things:

Author
Message
hyperstork
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location:
Posted: 16th Jan 2003 03:59
Hello, I've been looking through the Help files with both DB demos and am not sure (or getting a help error) when looking for answers to a couple questions. Maybe you folks with more experience can help/advise:

1) Can it be written into a program so a person can save data to a file, like a txt file, that can be called up later (in other words, can you "save your game" when playing a DB product)? It looked like you could save arrays, but I wanted the user to be able to save data such as their character's name, etc as well in a "save file." Which leads to question#2:

2) Can you allow the user to input text to name their character(s), change names of variables stored in the game, etc? Or are they stuck with the variables/names I hardcode into the program?

3) How much memory for text can you write into a program? My last programming was in Visual Basic 9 years ago, and I really had to cram as it ran out of memory. I wanted to start real simple and do a sort of "interactive book," with lots of text and choices for the player, sort of like one of those "choose your own adventure" type books, but able to hold more data, etc. Would this work, or would memory chop me short?

Thanks for any help, and my apologies if I missed these answers somewhere else...
Arrow
21
Years of Service
User Offline
Joined: 1st Jan 2003
Location: United States
Posted: 16th Jan 2003 04:19
Yes, maybe, and I don't know. About the vars, do you mean change the values, like pname$ = ~input user name here~, or x = 10? Then yes but if you mean change the var itself inside the game, no. I'm sure on the text, but I'ld think the PC specs would play importance in that aspect.

This is Truth!
This is my Belief!
...at least for now.
Xsniper
21
Years of Service
User Offline
Joined: 29th Dec 2002
Location:
Posted: 16th Jan 2003 04:20
I'll try to answer all 3 of your questions as briefly as possible, and then again more in depth.

1.) yes
2.) yes
3.) yes

Ok now for some indepth answers:

1.) There is no direct function in DB or DBP that says "save game" but that doesn't mean you can't do it. Saving your game really depends on the game in general but it is broken up into a pretty simple process. You would use the built in commands for opening a file to write and then you simply dump all your variable data into the file in whatever format or fashion you choose to use. Then when you make your load game function you just reopen that file and refill your variables with the data listed in the file.

2.)There is a command called "Input" that allows for user input. Just do 'Input "Please Input Character Name:", characterName$ and the program will ask the user for a name and when they type it in it will be stored in the variable characterName$.

3.)Sure you can make a choose your own adventure game with db or dbp, you can make any type of game with it. You just have to take the time to plan out what you want to make and figure out what coding methods you'll need to learn to produce the game. Anything is possible. Also for a "choose your own adventure" game memory should not be an issue with todays computers. BTW Visual Basic 9? Last I heard was Visual Basic 6 and I think there is a newer one than that, but I know they didn't skip 3 numbers to 9 ^_-

Hope this helps.

MattIsFun
21
Years of Service
User Offline
Joined: 4th Jan 2003
Location:
Posted: 16th Jan 2003 05:07
Perhaps he meant 9 years ago

hyperstork
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location:
Posted: 16th Jan 2003 13:21
Yes, 9 years ago, it was a DOS version of VB actually.

These answers help- I had to do something similar to save variables in the VB program way back when, but with a little testing it worked perfectly, anfd people still use the program.

Thanks for the replies...

VietStylist
21
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Australia
Posted: 16th Jan 2003 14:34
Yep. All done fairly easily.
For the first one, you simply save all of you variables using the write byte, write string, write float, etc. commands to a file in a certain order. Then loading it will simply be using the read byte... commands in that order. You could also implement some encryption into it so that no one can cheat in your game easily, like increasing the credits, etc. Keep in mind that it is already quite encrypted when using the byte, float, word and dword commands (numbers), since it will appear as the strange box character that you sometimes get when opening up the wrong file.

INPUT can be used but it is very very amatuer. It will completely pause you program causing all sorts of glitches. But since you have dbpro (which I reckon is excellent) you can use that text buffer utillity. I think it's called ENTRY$(). It simply records all the things that you've typed putting it in a buffer, which you retrieve with that command. If you're finished with it, then you can clear it using CLEAR ENTRY$() or something like that.

For the third one, you should write the strings onto a file and read them in with the read byte, etc. commands again. This makes it much more manageable.

Vs

333 Mhz , 96 mb ram , 15 inch monitor , intergrated intel810 graphics chipset ...
BBoy VietStylist 1.9k'86
n3t3r453r
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 16th Jan 2003 15:09
Hmm... Were there dos version of VB??? NINE YEARS AGO??? i thought there were no VB at all...
Fluffy Paul
21
Years of Service
User Offline
Joined: 16th Dec 2002
Location: United Kingdom
Posted: 16th Jan 2003 17:09
Woah, hold all of your horses!
You guys are forgetting the functions which save an array to a file! They're great because you don't have to worry about bytes and floats and words and stuff because you can just save and load them with a command. Bearing in mind that all my programs just totally use arrays for everything it makes saving the program's state to disk very easy indeed.

Login to post a reply

Server time is: 2024-05-17 03:12:09
Your offset time is: 2024-05-17 03:12:09