Home   Help Search Login Register  

Author Topic: Small q about hints  (Read 513 times)

0 Members and 1 Guest are viewing this topic.

Stalker

  • Guest
Small q about hints
« on: 12 Aug 2003, 14:03:19 »
I need to know the distance between 2 objects. And this distance must be shown in a hint. How can I do this ?

Offline KTottE

  • Former Staff
  • ****
Re:Small q about hints
« Reply #1 on: 12 Aug 2003, 14:31:02 »
Code: [Select]
hint format["The distance is: %1",object1 distance object2]

Note that if you want this to update regularly you will need to make a script out of it.

checkDistance.sqs:
Code: [Select]
; Our loop
#loop
; Get the distance into a variable
_distance = object1 distance object2

; Display the hint
hint format ["The distance is %1",_distance]

; Wait 0.001 seconds then start over
~0.001
goto "loop"

However, that will return the distance like this : 123.12312343545098
Which is ugly in my opinion, so what you want is this:

checkDistance.sqs
Code: [Select]
; Our loop
#loop
; Get the distance into a variable
_distance = object1 distance object2

; Round off to the closest lower integer.
_distance = _distance - (_distance mod 1)

; Display the hint
hint format ["The distance is: %1",_distance]

; Wait 0.001 seconds then repeat
~0.001
goto "loop"

There, should get you by.
« Last Edit: 12 Aug 2003, 14:32:28 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Small q about hints
« Reply #2 on: 12 Aug 2003, 17:13:21 »
i wouldnt use a 0.001 loop if its mplayer, its way too fast, maybe every second
~1 or even slower depending how often and how accurate you need the info

and having the hint displayed on every loop will also give you continous "Bleep" sounds
« Last Edit: 12 Aug 2003, 17:14:25 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Stalker

  • Guest
Re:Small q about hints
« Reply #3 on: 12 Aug 2003, 17:17:52 »
Tnx a lot. The hint won't apper ingame. It's a little debugger.