Example Code: Convert Position To Map Grid

From Bohemia Interactive Community
Revision as of 12:35, 23 September 2007 by MAF_bi_wiki (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Problem

How to get map's grid from object's position. For example get "Fe 26" from [10987.8, 15092.8, 0.0017395].

Solution

nothing at this time.

Implementations

  • SQS Script

Arguments: Position

_str = ""

;OX
_x = floor ((_this select 0) / 200)
_t = floor (_x / 10)
?_t == 0: _str = _str + "A"
?_t == 1: _str = _str + "B"
?_t == 2: _str = _str + "C"
?_t == 3: _str = _str + "D"
?_t == 4: _str = _str + "E"
?_t == 5: _str = _str + "F"
?_t == 6: _str = _str + "G"
?_t == 7: _str = _str + "H"
?_t == 8: _str = _str + "I"
?_t == 9: _str = _str + "J"
_t = _x mod 10
?_t == 0: _str = _str + "a"
?_t == 1: _str = _str + "b"
?_t == 2: _str = _str + "c"
?_t == 3: _str = _str + "d"
?_t == 4: _str = _str + "e"
?_t == 5: _str = _str + "f"
?_t == 6: _str = _str + "g"
?_t == 7: _str = _str + "h"
?_t == 8: _str = _str + "i"
?_t == 9: _str = _str + "j"

_str = _str + " "

;OY
_str = _str + str (104 - floor (((_this select 1) + 520) / 200))

Hint _str