Home   Help Search Login Register  

Author Topic: (Accepted) Grid Coordinate Function  (Read 5970 times)

0 Members and 2 Guests are viewing this topic.

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Grid Coordinate Function
« Reply #15 on: 31 May 2007, 05:53:58 »
Function adjusted to account for all possible positions.  The new file has been attached to the original post.  Here is the code:

Code: [Select]
// By Dux
// based on function by uiox (OFP)

private ["_result","_GrandeLettre","_PetiteLettre","_Chiffre","_Chiffre2","_Chiffrestring","_pos","_ArrayMajuscForGrid","_ArrayMajusNegative","_ArrayMinusForGrid","_ArrayNumbers"];

_ArrayMajuscForGrid = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"];
_ArrayMajusNegative = ["Z","Y","X","W"];
_ArrayMinusForGrid = ["a","b","c","d","e","f","g","h","i","j"];
_ArrayNumbers = [9,8,7,6,5,4,3,2,1,0];

_pos = _This select 0;
_Chiffrestring = "";
_GrandeString = "";
_result = "";
_GrandeLettre = floor ((_pos select 0) / 2000);
_PetiteLettre = abs (floor (((_pos select 0) / 200) - (_GrandeLettre * 10)));
if (_GrandeLettre < 0) then
{
_GrandeString = _ArrayMajusNegative select (abs (_GrandeLettre + 1))
}
else
{
_GrandeString = _ArrayMajuscForGrid select _GrandeLettre
};
_Chiffre = floor (((_pos select 1) - 480) / 2000); 
_Chiffre2 = abs (floor ((((_pos select 1) - 480) / 200) - (_Chiffre * 10)));
if (_Chiffre < 0 || _Chiffre > 9) then
{
_Chiffrestring = format ["%1%2",(_ArrayNumbers select (abs (abs _Chiffre - 10))),(_ArrayNumbers select _Chiffre2)]
}
else
{
_Chiffrestring = format ["%1%2",(_ArrayNumbers select _Chiffre),(_ArrayNumbers select _Chiffre2)]
};
_result = (_GrandeString + (_ArrayMinusForGrid select _PetiteLettre) + _Chiffrestring);

_result
« Last Edit: 31 May 2007, 05:59:53 by DucusSumus »