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 / What's wrong with this code?

Author
Message
Tim Ballisto
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 17th Jul 2004 11:42
This code puts the name of a monster and some of the monster's stats in a file to retrieve for later use in the program. But it doesn't seem to record it correctly. Can some of you look through this and try to find out what's not working correctly?



Programs for programmers.
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 17th Jul 2004 12:08
i dunno, that code looks pretty good, the only thing i suggest is to change the dim's into datas because i'm pretty sure you can't read arrays.(Don't take my word for it, i'm terrible with arrays and stuff like that.)

anyways,
Hope I helped,
Axelman

CURRENT PROJECT: Enemy At The Gates
Balid
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location: MI, USA
Posted: 17th Jul 2004 13:15 Edited at: 17th Jul 2004 13:23
Tim Ballisto,

I'm sure you looked at the output file. Does it look close to what you think it should look like?

Also I see you use 'read string' for the name and 'read file' for everything else. What if you made all entries strings (writing and reading)?



Balid
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 17th Jul 2004 22:09
change the write and read files to

write long

and

read long


since you are reading and writing integers, that should work fine, I know using long or word works since I use it myself, can`t see any purpose for haveing read file in the commands since it reads in the manual as though it is just read long anyway, looks like it`s the same command with a different name, but that wouldn`t make sense unless it`s doing something that write long doesn`t, since it`s giving problems then it may be the lack of decent documentation that is causeing problems, so I would switch em to write long, that should work.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 18th Jul 2004 14:09
The code looks perfect to me too...

I never understood, or really wanted to, the read long and short and word and dword, so I always just read and write with strings. I just do this:

write string 1,str$(variable)

read string 1,a$:variable=val(a$)

I works for me, and I have huge files that I both read and write into.

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]

Login to post a reply

Server time is: 2025-05-25 00:46:36
Your offset time is: 2025-05-25 00:46:36