×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

bsave and bload in rpgs

bsave and bload in rpgs

bsave and bload in rpgs

(OP)
i need my help with a rpg im making. i need to no if there is a way to create a file in the users computer and then save every thing for the game in that folder everytime the user saves the game. i also need to no if there is a way to save a string instead of numbers. i have heard that the sadd function used with def seg and varseg works but i have tryed this multiple times and it did not work. i have one more question. would it be possible if when my program started it would instantly search for all files and list them by the names and stats for the users to choose from.
i think that this would make my rpg alot better.

RE: bsave and bload in rpgs

>i need to no if there is a way to create a file in the users computer and then save every thing for the game in that folder everytime the user saves the game.
- Yes, it is. And what do you mean saying "every thing for the game "?

>i also need to no if there is a way to save a string instead of numbers.
- Yes. Actually it you PRINT #1,X
then X would be saved as string

>i have heard that the sadd function used with def seg and varseg works but i have tryed this multiple times and it did not work.
-No idea, I use simpler things (see above)

>i have one more question. would it be possible if when my program started it would instantly search for all files and list them by the names and stats for the users to choose from.
- There was a subroutine posted here that behaves much like "open file" dialog: lists files, allows select. I wasn't able to find it.

RE: bsave and bload in rpgs

(OP)
thanks for the help but i dont understand what you mean by <print #1,x> could you please explain it.by every thing for the game i mean stats, character names , and maybe, if im brave enough, upgrades for the game.

RE: bsave and bload in rpgs

BSAVE and BLOAD are used for large blocks of RAM, usually large arrays.

Here is how you would save things like stats, names, et cetera.

First of all to create a folder for your game:
SHELL "createdir c:\folder"
You only need this command once, not in the game itself, this command should go in a setup program or something.

To save:
OPEN "c:\folder\game.cfg" FOR OUTPUT AS #1
PRINT #1, name$
PRINT #1, lives
PRINT #1, weapon
'and so on
CLOSE #1

To load:
OPEN "c:\folder\game.cfg" FOR INPUT AS #1
INPUT #1, name$
INPUT #1, lives
INPUT #1, weapon
'...
CLOSE #1

RE: bsave and bload in rpgs

(OP)
k i understand that but im not sure what you mean by setup.
i wouldnt no what to do to create a setup program but thanks for the information on the open command.

RE: bsave and bload in rpgs

(OP)
i tryed the open command and it says that the path is wrong. is there some way to do this with bsave and bload.
i read a tutorial and it said that if you use SADD instead of VARPTR it will save strings.

if any body nos how to list all of the saved game files for the user like i said at the top then please tell me
cus that would be realy usefull.

RE: bsave and bload in rpgs

"c:\folder" is a hypothetical name, you have to direct it to a pre-existing folder, or you could just use "c:\"

A simple setup program would be something like:

INPUT ; "What folder is your game currently in?", a$
SHELL "createdir yourgame"
SHELL "copy" + a$ + "game.exe c:\yourgame\"

It would create a folder for your game, and move the game to it.

RE: bsave and bload in rpgs

"c:\folder" is a hypothetical name, you have to direct it to a pre-existing folder, or you could just use "c:\"

A simple setup program would be something like:

INPUT ; "What folder is your game currently in?", a$
SHELL "createdir c:\yourgame"
SHELL "copy" + a$ + "game.exe c:\yourgame\"

It would create a folder for your game, and move the game to it.

RE: bsave and bload in rpgs

open would be best to use.  you can control what you want to input in it better.  the syntax is...

open "file.txt" for input as #1

this will open a file for reading, and if there is no file by that name, it'll create that file.  then, you can read/write to it using get/put.   

put #1, hp
put #1, mp
put #1, strength

when you're finished, you close off the file.

close #1.

i'm a bit rusty with that command.  if i made a mistake, feel free to correct me qbasicking!

RE: bsave and bload in rpgs

(OP)
i tryed bsave for creating a file for open. it looked like this:

//Start//
def seg = varseg(mystats)
bsave "c:/rpg/mystat.dat", varptr(mystats), 10
def seg

open c:/rpg/mystats.dat" for output as #1
print #1, maxhp
print #1, maxmp
print #1, level
....
close #1
//stop//

this works but it is realy slow. is there a better way of doing this.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close