Home   Help Search Login Register  

Author Topic: Convert getpos array value to sidechat text?  (Read 656 times)

0 Members and 1 Guest are viewing this topic.

AUS_Viper

  • Guest
Convert getpos array value to sidechat text?
« on: 01 Oct 2004, 11:53:49 »
Hi,

I have searched all regarding the sidechat function, but can't seem to find if this is possible.

I want to return the x,y values of a getpos command and convert it into a text field for use in a sidechat command.

The idea is this - your side has units spread all over a large area that are not part of the same group.  If one of these units spots (detects) the enemy a sidechat message comes up for all saying something like "Enemy spotted at 222234".  Where the 222234 grid reference would be the value taken from a getpos query.

Is it possible?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Convert getpos array value to sidechat text?
« Reply #1 on: 01 Oct 2004, 13:24:24 »
Try:

groupleader sidechat format ["blah blah blah %d,  BLAH, BLAH %d", number1, number2]

Or something like

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Convert getpos array value to sidechat text?
« Reply #2 on: 01 Oct 2004, 13:43:46 »
It is indeed the format command that you need, but %1, %2, etc. rather than %d.

There is a table in the Ed Depot somewhere which shows how coordinates relate to grid squares.   I suspect somebody has made a function that does that rather tedious task automatically.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Convert getpos array value to sidechat text?
« Reply #3 on: 01 Oct 2004, 16:57:57 »
Oops.  Yes indeed.  %1 and %2.  I was mixing my languages.
« Last Edit: 01 Oct 2004, 17:06:31 by THobson »

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:Convert getpos array value to sidechat text?
« Reply #4 on: 01 Oct 2004, 17:55:35 »
For experimentation, place a single unit on an island and in its init line, have this:
Code: [Select]
onMapSingleClick {player sideChat format ["You klicked on position %1",_pos]}Now preview and klick around on the map and Thy Shall See  ;D

In general, as stated in the messages above, you can print out results from getPos using format. Another example to get you going:
Code: [Select]
mypos = getPos player
hint format ["You are at %1",mypos]
« Last Edit: 01 Oct 2004, 18:00:10 by Killswitch »

AUS_Viper

  • Guest
Re:Convert getpos array value to sidechat text?
« Reply #5 on: 02 Oct 2004, 12:00:39 »
Ok thanks guys, I'll give it a try.