forums

TNT Basic Forums > Programming Q&A
On the Fly TEXT
< Last Thread     Next Thread >
Author
Thread        Post A Reply

09-08-2002 01:37

Posted by:
eLL

Click Here to Email eLL   Find more posts by eLL


Hey i'm getting ready to build an engine for use in several games
i need to know the following, does the Does the
Draw Text command allow you to substitute Variables in place of numerical X,Y values?

such a function would be of use for doing [non mmorpg] Online RPG's and placing the name over head of an opponent before engaging them. also useful for taunting/communicating. also in using always well placed dialog boxes/bubbles.

if you know the answer to this by all means,
ellrx@yahoo.com, email me.

09-08-2002 05:25

Posted by:
Holmes

Click Here to Email Holmes   Find more posts by Holmes

Yeah, it does work

Yeah, it works just fine with variables!

graphics mode 640,480

int x = 50
int y = 100

while not mouse button
draw text x,y,"Yeah, it does work with variables!"
y = y+1
draw frame
wend

09-08-2002 17:03

Posted by:
Mark Tully

Find more posts by Mark Tully

Variables

Hi,

You can concatenate strings together using the '+' operator.

Eg.

str name = "TNT Basic"
int age = "9"

draw text 100,50,"My name is "+name+" and I am "+as string(age)+" months old"

Thanks,

Mark

09-08-2002 20:16

Posted by:
eLL

Click Here to Email eLL   Find more posts by eLL

Very Matrixy indeed


thanx for the example, and if anyone every downloaded the 'matrix screen saver', it's pretty much just those 8 lines of code with a string generator and columns numerated through an algorithm based on the avalable screen width.

This solves all of my text woes...but
do the other calls support this nicety(substituting str/int variables etc in their stead? If so this makes it incredibly easy to execute/implement bells and whistles like:

traps traps and more traps (heat/pressure sensitive floors & sound sensitive devices)

09-10-2002 19:24

Posted by:
Mark Tully

Find more posts by Mark Tully

Strings

Any command that takes a string can use this method. You can use the '+' operator to join several strings (or functions that return strings) anywhere where you can use a string.

Thanks

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.