Difference between revisions of "MIST hex hash"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Mission Scripting |fName= mist.hex.hash| |vNum = Mist 4.6 |desc= Converts a {q, r, s} table into a string of "q r s". Useful for indexing a table with the string name...")
(No difference)

Revision as of 01:07, 1 September 2026


mist.hex.hash

Added with: Mist 4.6
Description
Converts a {q, r, s} table into a string of "q r s".

Useful for indexing a table with the string name of a hex grid.

Syntax
string mist.hex.hash(table qrs )
Valid Input Values:
Return value:
string
Return example:
Usage Examples:
The following would convert a groups current point into a qrs value that is then hashed and stored in a bigger table of hexagons listing which groups are within them.
  local hexTable = {}
  01:07, 1 September 2026 (UTC)01:07, 1 September 2026 (UTC)01:07, 1 September 2026 (UTC)01:07, 1 September 2026 (UTC)01:07, 1 September 2026 (UTC)Grimes (talk) 01:07, 1 September 2026 (UTC)
  local listOfGroups = {"test1", "bob", "mav", "skeeter", "TwoThousandBMPTs", "an aircraft carrier"}	
  
  for i = 1, #listOfGroups do 	 
      local someGroup = Group.getByName(listOfGroups[i])
      local point = mist.getLeadPos(someGroup)
      local hash = mist.hex.hash(mist.hex.pointToHex(point))
      if not hexTable[hash] then
           hexTable[hash] = {groups = {
Notes:
{{{notes}}}
Related Functions
{{{funcs}}}

Scripting Engine

MIST Root Page


      end 
      table.insert(hexTable[hash].groups, {[listOfGroups[i]] = {point = point, hash = hash}})
  end

|notes=

|funcs= to, getRadius, setRadius, add, subtract,scale, rotate_left, rotate_right, neighbor, getNeighborCount, diagonalNeighbor, length, distance, round, lerp, cubeScale, cubeRing, cubeSpiral, lineDraw, cubeToAxial, axialToCube, pointToHex, makeVek2, makeVec3, makeVec3GL, hash, hashToHex, draw

}}