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 / high score

Author
Message
Zero_Cool
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 30th Jan 2003 17:04
since people dont seem to look at anything over 5 minuetes old i am re-posting this
--------------------------------------------------------------------------------

I see how that one work but the way i want mine set up is like in "3d pinball for windows". I want mine set up so it basicly saves the high scores to a file then reads it when its called.so like i have the names saved to a file like highscores.txt .dat or whatever, it checks to see if your score makes it on there, if so it asks your name then deletes the lowest one, adds yours in to the proper place and then saves the file. Then when i want to read it and display it to the screen. is this even possible? if so please respond. also thanks for the time easily confused to add the code.
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 30th Jan 2003 18:04
Yes, its possible and fairly easy...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 31st Jan 2003 00:08
Try this hope it help
copy it and paste in DB


`.......................................................

` hope you find this a help to you

` by xmen

`......................................................



dim NAME$(21)
dim score(21)
dim input$(1)
dim oldname$(20)
dim oldscore(20)




`...................................Name of players................

NAME$(1)="xmen"
NAME$(2)="big"
NAME$(3)="soft"
NAME$(4)="hard"
NAME$(5)="bad"
NAME$(6)="nice"
NAME$(7)="sweet"
NAME$(8)="darkbasic"
NAME$(9)="darkbasic pro"
NAME$(10)="empty"
NAME$(11)="old"
NAME$(12)="sweet score"
NAME$(13)="darkbasic cool"
NAME$(14)="darkbasic pro dont no"
NAME$(15)="empty"
NAME$(16)="empty"
NAME$(17)="empty"
NAME$(18)="empty"
NAME$(19)="secand to last"
NAME$(20)="last"

`....................................Score of players................

SCORE(1)=50000
SCORE(2)=40000
SCORE(3)=30000
SCORE(4)=20000
SCORE(5)=10000
SCORE(6)=5000
SCORE(7)=4000
SCORE(8)=3000
SCORE(9)=2000
SCORE(10)=1000
SCORE(11)=900
SCORE(12)=800
SCORE(13)=700
SCORE(14)=600
SCORE(15)=500
SCORE(16)=400
SCORE(17)=300
SCORE(18)=200
SCORE(19)=100
SCORE(20)=50


sync on

`....................................Function that ask for name...........

input("Enter Name..")

`................................Score of Player......................

score=rnd(700000)
newscore(score)

`.................................Show score...........................
`gosub load

gosub setup


`...........................Just a loop waiting for mouseclick.......................


repeat

sync
until mouseclick()

gosub save

`........................................Save Score.....................

SAVE:
FILENAME$="c:\your file"

IF FILE EXIST(filename$) THEN DELETE FILE filename$

open to write 1,filename$
for num=1 to 21
write string 1,name$(num)
write long 1,score(num)
next num
close file 1

RETURN

`.......................................Load Score.....................

LOAD:

FILENAME$="c:\your file"

open to read 1,filename$

for num=1 to 21
read string 1,name$(num)
read long 1,score(num)
next num
close file 1

RETURN




SETUP:
ink rgb(0,0,120),1
box 100,10,bitmap width()-100,bitmap height()-100

ink rgb(0,0,100),1
box 102,12,bitmap width()-102,bitmap height()-102

ink rgb(0,0,80),1
box 103,13,bitmap width()-103,30

ink rgb(0,0,200),1
box 103,32,bitmap width()-103,bitmap height()-103

ink rgb(255,255,255),1
box 114,43,bitmap width()-114,bitmap height()-114

ink rgb(255,255,255),1

set text font "times new roman"
set text size 16
set text to bold

Text bitmap width()/2-50,15,"HIGHT SCORE"


FOR NUM=1 TO 20
ink rgb(0,0,0),1

Text 120,28+NUM *TEXT HEIGHT(NAME$(NUM)),str$(num)+" "+NAME$(NUM)

`line 120,28+NUM *TEXT HEIGHT(NAME$(NUM)), bitmap width()-115,28+NUM *TEXT HEIGHT(NAME$(NUM))

ink rgb(250,0,0),1
Text bitmap width()-200,28+NUM *TEXT HEIGHT(NAME$(NUM)),str$(score(NUM))

NEXT NUM

RETURN



`........................................INPUT NAME.....................

FUNCTION INPUT(t$)

Done=0
set text font "system"
c$=""
cs3$=""

tw=text width(t$)+12
if len(t$)<10 then tw=99:wt=28
ti=0
dtime=0

ink rgb(120,120,120),1
box 230,130,234+tw,180

ink rgb(220,220,210),1
box 231,131,233+tw,179

ink rgb(170,170,140),1
box 232,132,232+tw,145


ink rgb(255,255,255),1
box 232,148,232+tw,178
ink rgb(255,255,255),1

if len(t$)<10 then center text 284,130,t$

if len(t$)=>10 then text 237+wt,130,t$:tw=88


repeat

if a$="" then ky=0 else ky=1

a$=inkey$()

if scancode()=14 and ky=0 then d$=left$(c$,len(c$)-1):c$=d$ :ink rgb(255,255,255),1

if scancode()<>14 and ky=0 then b$=a$

if a$<>"" and ky=0 and text width(c$)<330
c$=c$+b$
ink rgb(255,255,255),1
box 232,148,232+tw,178

ink rgb(0,0,0),1
center text 280,155,c$
input$(1)=c$

if text width(c$)>100
CS3$=CS3$+A$
ink rgb(120,120,120),1
box 230-text width(CS3$),130,234+tw+text width(CS3$)+20,180

ink rgb(220,220,210),1
box 231-text width(CS3$),131,233+tw+text width(CS3$)+20,179

ink rgb(170,170,140),1
box 232-text width(CS3$),132,232+tw+text width(CS3$)+20,145

ink rgb(255,255,255),1
box 232-text width(CS3$),148,232+tw+text width(CS3$)+20,178
ink rgb(255,255,255),1

if len(t$)<10 then center text 285+text width(CS3$)/text width(T$),130,t$
if len(t$)=>10 then center text 285+text width(CS3$)/text width(T$)+wt,130,t$:done=1

ink rgb(0,0,0),1

center text 280,155,c$
endif
endif

sync

until returnkey() or Done=1
Done=0
endfunction

`......................................Function to change score........

FUNCTION NEWSCORE(score)
for scr=1 to 20
oldname$(scr)=name$(scr)
oldscore(scr)=score(scr)
next scr
for scr=1 to 20

if score=>score(scr)
pos=scr
exit
endif
next scr

for newscr=pos to 20

name$(pos)=input$(1)
score(pos)=score

name$(newscr+1)=oldname$(newscr)
score(newscr+1)=oldscore(newscr)

next newscr

ENDFUNCTION
Zero_Cool
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 31st Jan 2003 01:56
First of all thanks for the code it is awesome now, I might be missin sumthin but i keep getting an error "function decleration" or sumthin like that. if someone could try this and figure it out that would be great. thanks

xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 31st Jan 2003 17:44
repeat

sync

until mouseclick()


is just a loop you can put some code in there

example:

repeat
mc=mouseclick()

if mc=1 then gosub save

until gameend
Zero_Cool
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 2nd Feb 2003 01:02
sry it took so long to respond again, when i try it it doesnt seem to wanna save, can i get some help on that

Login to post a reply

Server time is: 2024-11-23 23:55:05
Your offset time is: 2024-11-23 23:55:05