printing variables in graphics/tv mode
mosquito56
Posts: 387
I can't find any way to print a variable using the graphics.spin and the tv.spin. Searching and trying things for hours. Just need one line of code or point in the right direction.
Car:=124
gr.text(128,17,string(car))
gr.text(128,17,car))
gr.text(128,17,str(string(car))
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
Car:=124
gr.text(128,17,string(car))
gr.text(128,17,car))
gr.text(128,17,str(string(car))
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
Comments
However, lookout for the delayed action of GRAPHICS! Don't re-use the internal string buffer of Numbers as long as the string is still being output!!
This even fooled Martin once
Post Edited (deSilva) : 1/26/2008 2:04:34 PM GMT
PUB foo | car
car:=124
byte[noparse][[/noparse]@carstring+0]:=(car/100)//10+$30 '30 is ascii for 0 and we display 3 digits here
byte[noparse][[/noparse]@carstring+1]:=(car/10)//10+$30
byte[noparse][[/noparse]@carstring+2]:=(car/1)//10+$30
gr.text(128,17,@carstring)
DAT
carstring byte "000",0
'I think this would display 124. But if car was 99 it would say 099, so add some if's to change leading 0's to $20, spaces.
·I will try it again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
·hexstring[noparse][[/noparse]0] := hex(co >> 4)
·hexstring[noparse][[/noparse]1] := hex(co & $F)
·gr.text(8, 19, @colorstring) "Why is this line @colorstring and not @hexstring?
·gr.colorwidth(2, 6)
·gr.text(1, 19, @colorstring)·· With colorstring defined as "Color" this code ouputs· "Color A3" or whatever the hexcode of the color is under the mouse.
··
··· I think you've hit on the right idea. I had a bad day yesterday and my brain couldn't figure out how to break a number into individual bytes. LOL. Just divide // and pack the datstring the way I want it to look and off to the races. I feel like going Disco dancing, this is soooo retro. When you get used to OOP kinda hard to go back to the old days.
·Mike, I think you came up with the same idea but in a strange language, "English"
Thanx much guys. I worked on this for hours yesterday.
P.S. Got it working, now I just need to figure out how to blank the screen to print the updates.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
Post Edited (mosquito56) : 1/26/2008 2:47:51 PM GMT
colorstring byte "Color "
hexstring byte "00",0
In that case displaying colorstring will also display hexstring.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.