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 / Text variable?

Author
Message
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 12th Dec 2006 01:27
I know this is a dumb question, but how do you get a text command to display a number variable, like health? i tried

but that doesnt work. any ideas?


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 12th Dec 2006 01:45



You have to use the STR$ command, which turns any float, integer, or boolean into a string. When using the text command, you have to have a string.

In fact, here is a better example:



The '+' can join strings.

-Mansoor Siddiquie

flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 12th Dec 2006 03:58
ah, i see, thanks a million man.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 3rd Jan 2007 00:49
sorry for bumping this, but how do yo make it so its a text variable, not a number. I tried just switching the # to a $ on the value.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Jan 2007 02:03
You can't just switch variable types without altering the lines of code which alter the variable's contents...



TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 3rd Jan 2007 02:26
Yeah the "$" means it's a string. The "#" means it's a float... a number that has a decimal point. It's really better to make health an integer (without the # sign). Most games use only whole numbers for health... you rarely see 77.3 health or 99.9 health.

If you convert it to a string anytime you want to do math you have to convert it to a number before you do the math. If you keep it a number and only convert it when you want to print with the "str$()" it would be a lot easier to work with.

Login to post a reply

Server time is: 2024-09-25 15:19:01
Your offset time is: 2024-09-25 15:19:01