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 / a big huge loading problem

Author
Message
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 4th Aug 2004 01:20
well as the thread says.

sync on
sync rate 0
backdrop on
color backdrop 0
a = 255
b = 100
c = 100
choice = 1
leftkeypressed = 0
rightkeypressed = 0
`-------------------- Select screen -------------------------------
do


`if key e pressed
if keystate(18) = 1
if keypressed = 0
choice = 3
endif
endif
`if key l pressed
if keystate(38) = 1
if keypressed = 0
choice = 2
endif
endif
`if key n is pressed
if keystate(49) = 1
if keypressed = 0
choice = 1
endif
endif
`cycle through next option and update choice
if rightkey() = 1
if keypressed = 0
inc choice, 1
if choice > 3 then choice = 1
endif
else
leftkeypressed = 0
endif

`cycle through previous option and update choice
if leftkey() = 1
if keypressed = 0
dec choice, 1
if choice < 1 then choice = 3
endif
else
rightkeypressed = 0
endif

`set colors for print options
select choice
case 1 : a = 255 : b = 100 : c = 100 : selected$ = "new game highlighted" : endcase
case 2 : a = 100 : b = 255 : c = 100 : selected$ = "load game highlighted" : endcase
case 3 : a = 100 : b = 100 : c = 255 : selected$ = "exit game highlighted" : endcase
case default : a = a : b = b : c = c : selected$ = selected$ : endcase
endselect

`pressing enter prints the selected option
if keystate(28) = 1
if choice = 3 then end
selected$ = "exit was selected"

endif
if choice = 2, if keystate(38) = 1
filename$ = "currentsave.save"
open to read 1,filename$
rem read floats ------
read float 1,savedata1#
read float 1,savedata2#
read float 1,savedata3#
position object 1,savedata1#,savedata2#,savedata3#
close file 1
endif
selected$ = "load game was selected"
endif
if choice = 1
selected$ = "new game was selected"
endif


`reset keypressed
if scancode() = 0
keypressed = 0
else
keypressed = 1
ink rgb(255,255,255), 0
set cursor 5,5
print selected$
endif

`print options
ink rgb(a,a,a),0 : center text 200, 400, "[N]ew Game"
ink rgb(b,b,b),0 : center text 330, 400, "[L]oad Game"
ink rgb(c,c,c),0 : center text 450, 400, "[E]xit Game"

sync
loop

Chaos Games
AsriCE
21
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Brunei
Posted: 4th Aug 2004 04:17
What do you mean by exact?

The only problem I can see here from your perspective is that the code returns an error stating "File does not exists". Is that it? If that's the case, then the problem is that you're trying to read a file that does not exists in your hard drive. Before reading the file, make sure that the file is there before hand. If not, you need to create one by using the "Open To Write" command.

Use the "File Exist()" command before "Open To Read".



Hope that helps

AsriCE Crew,
- Adi

There's only one hope.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 4th Aug 2004 05:20
Well, I did spot this funny line;

if choice = 2, if keystate(38) = 1

Say what? Ifs can't be joined like that...

Any truly great code should be indisguishable from magic.
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 4th Aug 2004 10:18
thanks

Chaos Games
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 4th Aug 2004 10:31
ok how would i get it to show the saved games and be able to select one?

Chaos Games
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 5th Aug 2004 09:48
Uh....

Well first, you'd have to decide what constitutes a saved game. The easiest method is like SAVEGAME001.DAT, SAVEGAME002.DAT and so on, so you can do a If exists() on each possible file. The harder way is to do a CHECKLIST FOR FILES and then test each file name for your SAVEGAMEXXX.DAT name, or PLAYERNAME.DAT as the case my be. Again, you'd have to check each one and then display the result, but the checklist gives you all the names so might be faster for you to code.

Good Luck,
S.

Any truly great code should be indisguishable from magic.
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 5th Aug 2004 09:56
sandrad thanks youre pretty darn good.

Dragonseige

Login to post a reply

Server time is: 2024-09-22 19:29:18
Your offset time is: 2024-09-22 19:29:18