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.

Code Snippets / score Snippets

Author
Message
xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 31st Jan 2003 00:11
I did this for a newcomer hope it can help someone

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

` 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 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$)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$)+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
kazaa
20
Years of Service
User Offline
Joined: 17th May 2003
Location: United States
Posted: 17th May 2003 16:53
Does This work in DBC?

sicjoshsic
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 17th May 2003 19:09
can't see any reason why not...

Login to post a reply

Server time is: 2024-04-24 20:58:32
Your offset time is: 2024-04-24 20:58:32