Print("") command displayed within area of entity

Blitz3D Forums/Blitz3D Beginners Area/Print("") command displayed within area of entity

Chad(Posted 2006) [#1]
I can't figure this one out. I've got an entity that I would like when I get within a certain distance to use the Print("") command and display on the screen. I have included some code I would like you to look at and help me from here unless I am totally off, then in which case you can help me completely. So could someone help me out?

If entitya < 3,0,0 Then Print("Hello, what is your name?")
name$=Input("")
Print("Nice to meet you ") +name$


entitya is a .b3d model btw, I don't know if that makes any difference or not. I want it within 3 blitz units on the x axis.

Thanks,
Chad


t3K|Mac(Posted 2006) [#2]
maybe you should use EntityDistance(), that works from all directions/angles. just comparing coordinates is not enough.


Buggy(Posted 2006) [#3]
I'm not sure that you're even comparing coordinates right now. I don't think an entity is equivalent to its three coordinates. You can't compare these things. Use EntityDistance().


jfk EO-11110(Posted 2006) [#4]
exactly.
dis#=entitydistance(camera, entitya)
If dis < 3,0,0 Then
 Print("Hello, what is your name?")
 name$=Input("")
 Print("Nice to meet you ") +name$
 delay 2000
endif



mindstorms(Posted 2006) [#5]
jfk, the distance is a float, so shouldn't it be this?

(it at least compiles.)
wanted_distance = 10
dis#=entitydistance(camera, entitya)
If dis < wanted_distance Then
 Print("Hello, what is your name?")
 name$=Input("")
 Print("Nice to meet you ") +name$
 delay 2000
endif



Chad(Posted 2006) [#6]
Thanks guys, I'll play around with these examples. Thanks,
Chad


_PJ_(Posted 2006) [#7]
Print is a 2D command and I think draws to the front buffer. I would suggest using the Text command.


Sir Gak(Posted 2006) [#8]
Malice, I agree. Print just defaults to the top of the screen. You can, however, position Print with the "Locate" command. Others have complained about the slow-ness of Text, so maybe you could run some comparison timing tests between using Text and the Locate&Print combo, and see if there are any significant performance issues of one compared to the other.