hey,
I don't have db in front of me but I have source code I edited. credit to the DB user's who's code was used in this
(including UW Design)
All you have to do is assign the object number of the object to Obj_Number and subsequently, assign a name to Obj_Name$. The mouseclick while endwhile clause would be where the do loop clause usually goes but I did not use do loop so as to speed up the program. I did not create an object in the code since you most likely have made one already nor made a matrix nor object or camera movement code so
make sure to place the different parts of this source code to their corresponding parts in your program:
sync on: sync rate 1000
sync rate 0
hide mouse: flush video memory
always active on: autocam off
cls 0: set normalization on
basetime = timer()
displaynametime = basetime
Obj_Number =
Obj_Name$ = "put the name here"
while mouseclick()<>2
set cursor 0,0
oldtime = basetime
basetime = timer()
if displaynametime < basetime
if object in screen(Obj_Number)
if (object screen y(Obj_Number) > 0) and (object screen y(Obj_Number) < screen height())
text_raise(object screen x(Obj_Number),object screen y(Obj_Number),Obj_Name$,0)
`center text object screen x(Obj_Number),object screen y(Obj_Number),Obj_Name$
text_shadow(0,0+50,str$(statistic(1)),0)
endif
endif
displaynametime = displaynametime + 80
endif
sync
endwhile
`---------------------------------------------
`write text to screen with a border (centered)
`---------------------------------------------
function text_border(x,y,string$,centered)
if centered=0
ink 0,0
`draw outline
text x+1,y+1,string$
text x-1,y-1,string$
text x+1,y-1,string$
text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : text x,y,string$
else
ink 0,0
`draw outline
center text x+1,y+1,string$
center text x-1,y-1,string$
center text x+1,y-1,string$
center text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : center text x,y,string$
endif
endfunction
`---------------------------------------
`write text to screen with a drop shadow
`---------------------------------------
function text_shadow(x,y,string$,centered)
if centered=0
`draw shadow
ink 0,0 : text x+1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : text x,y,string$
else
`draw shadow
ink 0,0 : center text x+1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : center text x,y,string$
endif
endfunction
`----------------------------------------
`write text to screen with a raised bevel
`----------------------------------------
function text_raise(x,y,string$,centered)
if centered=0
`draw bevel
ink rgb(0,0,0),0 : text x+1,y+1,string$
ink RGB(200,200,200),0 : text x-1,y-1,string$
ink RGB(75,75,75),0 : text x+1,y-1,string$
ink RGB(130,130,130),0 : text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : text x,y,string$
else
`draw bevel
ink rgb(0,0,0),0 : center text x+1,y+1,string$
ink RGB(200,200,200),0 : center text x-1,y-1,string$
ink RGB(75,75,75),0 : center text x+1,y-1,string$
ink RGB(130,130,130),0 : center text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : center text x,y,string$
endif
endfunction
`-----------------------------------------
`write text to screen with a lowered bevel
`-----------------------------------------
function text_lower(x,y,string$,centered)
if centered=0
`draw bevel
ink RGB(200,200,200),0 : text x+1,y+1,string$
ink RGB(0,0,0),0 : text x-1,y-1,string$
ink RGB(130,130,130) ,0 : text x+1,y-1,string$
ink RGB(75,75,75),0 : text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : text x,y,string$
else
`draw bevel
ink RGB(200,200,200),0 : center text x+1,y+1,string$
ink RGB(0,0,0),0 : center text x-1,y-1,string$
ink RGB(130,130,130) ,0 : center text x+1,y-1,string$
ink RGB(75,75,75),0 : center text x-1,y+1,string$
`draw actual letter/number
ink rgb(255,255,255),0 : center text x,y,string$
endif
endfunction
set mipmap mode 1: set matrix texture 1,1,1: set spot light 1,0,90: set normalization on: sync rate 0: statistic(1): flush video memory
autocam off: always active on: hide mouse: set window on