
-----------------------------------
Asok
Tue Feb 25, 2003 12:27 pm

Integer to String conversion
-----------------------------------
The following is a code sample of a score board.  The challenge is getting string variables "currentscore and topscore" to accept intergers such as "currentscore := currentscore + scoreadded" (scoreadded being an integer variable so type problems occur.)

setscreen ("graphics:640;480")
var player : string := "Player 1"
var currentscore : string := "0000000"
var topscore : string := "0000000"
var font1 : int
font1 := Font.New ("Fixedsys:12")
Font.Draw (player, 50, 470, font1, black)
Font.Draw (currentscore, 53, 450, font1, black)
Font.Draw ("Top Score", 450, 470, font1, black)
Font.Draw (topscore, 458, 450, font1, black)

Any help would be greatly appreciated.

-----------------------------------
CyCLoBoT
Tue Feb 25, 2003 12:36 pm


-----------------------------------
why don't u leave all your variables to be integers?

-----------------------------------
Asok
Tue Feb 25, 2003 1:17 pm


-----------------------------------
because Font.Draw will only accept strings. So at some point I need to turn the integer into a string.

-----------------------------------
Dan
Tue Feb 25, 2003 1:46 pm

strint
-----------------------------------
try strint() and/or intstr()


var topscore:int := 1000
var font1 : int 
font1 := Font.New ("Fixedsys:12") 

Font.Draw (intstr(topscore), 0, 0, font1, black)


-----------------------------------
Asok
Tue Feb 25, 2003 2:13 pm


-----------------------------------
intstr works!

*bows* all hail Dan!

Dan thank you so much, you've cleared a problem I've been struggling with for almost a month!
