Wiki

Clone wiki

nota / doc / noe / NOE_functions

NOE_functions - generated by docMaker v0.804-str08-tab13-pre04-md44-html10-yml08-sql82-ffg19 (last update 09. 09. 2015, 12:39:55)

Rules:

There are no rules in this doc.

Shortcuts:

NOE functions


blackboard.Get()

Located in: LuaRules/Configs/noe/modules/core/blackboard.lua

Input parameters

  • groupID (number)
  • name (string)

Returned values

  • value (anything)

Description

Get value from custom group memory slot identified by "name" key.

Example use

local isAttacking = blackboard.Get(groupID, "isAttacking")
if (isAttacking) then
    plan.wait(groupID, teamNumber)
else
    plan.bombFacility(groupID, teamNumber)
    blackboard.Set(groupID, "isAttacking", true)
end

Comments


blackboard.Set()

Located in: LuaRules/Configs/noe/modules/core/blackboard.lua

Input parameters

  • groupID (number)
  • name (string)
  • value (anything)

Returned values

  • nothing

Description

Set "value" to custom group memory slot identified by "name" key.

Example use

local isAttacking = blackboard.Get(groupID, "isAttacking")
if (isAttacking) then
    plan.wait(groupID, teamNumber)
else
    plan.bombFacility(groupID, teamNumber)
    blackboard.Set(groupID, "isAttacking", true)
end

Comments


cmdDesc.Add()

Located in: LuaRules/Configs/noe/modules/api/cmdDesc.lua

Input parameters

  • unitID (number)
  • cmdDefDesc(table)
  • initState (string)

Returned values

  • success (bool)

Description

Add command with given descriptionType.

Example use

cmdDesc.Add(unitID, oneCommandDef.desc, initState)

Comments


cmdDesc.UpdateButton()

Located in: LuaRules/Configs/noe/modules/api/cmdDesc.lua

Input parameters

  • unitID (number)
  • cmdDefDesc(table)
  • statusString (string)

Returned values

  • success (bool)

Description

Update command description of given unit based on descriptionType

Example use

cmdDesc.UpdateButton(unitID, oneCommandDef.desc, initState)

Comments


cmdDesc.Remove()

Located in: LuaRules/Configs/noe/modules/api/cmdDesc.lua

Input parameters

  • unitID (number)
  • cmdDefDesc(table)

Returned values

  • success (bool)

Description

Remove command with given descriptionType

Example use

function gadget:Shutdown() -- just clean-up
    for _, unitID in ipairs(Spring.GetAllUnits()) do
        for name, definition in pairs(commandDefs) do
            cmdDesc.Remove(unitID, definition.desc.id)
        end
    end
end

Comments


commands.Attack.Unit()

Located in: LuaRules/Configs/noe/modules/core/commands.lua

Input parameters

  • groupID (number)
  • target (number/3D vector)
  • memberIndex (number), optional
  • options (array of strings), optional

Returned values

  • success (bool)

Description

Unit version of Attack command call (expects group with just one unit)

Example use

["bombFacility"] = function(groupID, teamNumber)
    local myName = unitsUnderGreatEyeIDtoName[groupInfo[groupID].membersList[1]]
    local numberOfAttacker = string.sub(myName, 6)
    local targetName = "target" .. numberOfAttacker
    local x, y, z = spGetUnitPosition(unitsUnderGreatEyeNameToID[targetName].id)
    commands.Attack.Unit(groupID, {x, y, z})

    return true
end,

Comments


commands.Move.Unit()

Located in: LuaRules/Configs/noe/modules/core/commands.lua

Input parameters

  • groupID (number)
  • position (3D vector)
  • memberIndex (number), optional
  • options (array of strings), optional

Returned values

  • success (bool)

Description

Unit version of Move command call (expects group with just one unit)

Example use

commands.Move.Unit(groupID, map["carrierPositions"][3])

Comments


commands.Move.Group()

Located in: LuaRules/Configs/noe/modules/core/commands.lua

Input parameters

  • groupID (number)
  • moveX (number)
  • moveY (number)
  • moveZ (number)
  • pathType (number)
  • formation (string)
  • wating (number)
  • targetX (number)
  • targetZ (number)

Returned values

  • success (bool)

Description

Group version of Move command call (expects group 1+ units)

Example use

if (status == "IOA") then -- incapable of action
    plan.changeTaskStatus(groupID, "returning", false)
    groupInfo[groupID].taskInfo.spotNumber = 1
    local moveX, moveZ = map[returnPoint][1], map[returnPoint][2]
    local moveY = spGetGroundHeight(moveX, moveZ)
    commands.Move.Group(groupID, moveX, moveY, moveZ, 1, thisGroup.formation, waiting)
    -- if not, continue in task
else

Comments


commands.Patrol.Unit()

Located in: LuaRules/Configs/noe/modules/core/commands.lua

Input parameters

  • groupID (number)
  • position (3D vector)
  • memberIndex (number), optional
  • options (array of strings), optional

Returned values

  • success (bool)

Description

Unit version of Patrol command call (expects group with just one unit)

Example use

["patrolCarrier"] = function(groupID, teamNumber)
    commands.Move.Unit(groupID, map["carrierPositions"][3])
    commands.Patrol.Unit(groupID, map["carrierPositions"][2], 1, {"shift"})
    commands.Patrol.Unit(groupID, map["carrierPositions"][1], 1, {"shift"})

    return true
end,

Comments


mathExt.GetDistance2D()

Located in: LuaRules/Configs/functions/mathExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


message.Encode()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • messageToBeEncoded (string, number, bool, table, nil)

Returned values

  • encodedMessage (string)

Description

encode supported data type message into string

Example use

message.Encode({head = {"leftEye", "rightEye"}, torso = true})

Comments


message.Decode()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • encodedMessage (string)

Returned values

  • decodedMessage (string, number, bool, table, nil)

Description

decode recieved message from string back to original data type

Example use

function gadget:RecvLuaMsg(msg, playerID)
    local decodedMsg = message.Decode(msg)
    Spring.Echo("notAspace msg - unitID: " .. decodedMsg.unitID .. ", unitDefID: " .. decodedMsg.unitDefID .. " from player: " .. playerID)
end

Comments


message.SendRules()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • messageToBeSent (string, number, bool, table, nil)

Returned values

  • encodedMessage (string)

Description

send message encoded by message.Encode() by Spring.SendLuaRulesMsg()

Example use

message.SendRules({head = {"leftEye", "rightEye"}, torso = true})

Comments


message.SendUI()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • messageToBeSent (string, number, bool, table, nil)

Returned values

  • encodedMessage (string)

Description

send message encoded by message.Encode() by Spring.SendLuaUIMsg()

Example use

message.SendUI({head = {"leftEye", "rightEye"}, torso = true})

Comments


message.SendGaia()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • messageToBeSent (string, number, bool, table, nil)

Returned values

  • encodedMessage (string)

Description

send message encoded by message.Encode() by Spring.SendLuaGaiaMsg()

Example use

message.SendGaia({head = {"leftEye", "rightEye"}, torso = true})

Comments


message.Receive()

Located in: LuaRules/Configs/noe/modules/api/message.lua

Input parameters

  • encodedMessage (string)
  • playerID (number)
  • context (string), optional

Returned values

  • receiveCustomMessage function return value or nil

Description

call receiver function if defined from receiveCustomMessage library

Example use

function gadget:RecvLuaMsg(msg, playerID)
     message.Receive(msg, playerID, "heroes_abilities")
end

Comments


stringExt.SplitString()

Located in: LuaRules/Configs/functions/stringExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


stringExt.CleanSpaces()

Located in: LuaRules/Configs/functions/stringExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


stringExt.ReplaceSpaces()

Located in: LuaRules/Configs/functions/stringExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


stringExt.ReplaceString()

Located in: LuaRules/Configs/functions/stringExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


Located in: LuaRules/Configs/functions/stringExt.lua

Input parameters

  • TBD

Returned values

  • TBD

Description

TBD

Example use

TBD

Comments


timeExt.Add()

Located in: LuaRules/Configs/functions/timeExt.lua

Input parameters

  • oldTimeInHMSF (HMSF array)
  • deltaInHMSF (HMSF array)

Returned values

  • resultInHMSF (HMSF array)
  • resultInFrames (number)

Description

Sum two time values recieved and return result. Accepts HMSF arrays.

If you have value in frames, use {0, 0, 0, frames} If you have value only in seconds, use {0, 0, seconds, 0}

It will work.

Example use

TBD

Comments


timeExt.AddToCurrent()

Located in: LuaRules/Configs/functions/timeExt.lua

Input parameters

  • deltaInHMSF (HMSF array)

Returned values

  • resultInHMSF (HMSF array)
  • resultInFrames (number)

Description

Sum current time and delta time. You can use same trick described in timeExt.Add with input.

Example use

nextTimeCheck = timeExt.AddToCurrent({0, 0, 5, 0}), -- HMSF + 5 seconds

Comments


timeExt.Current()

Located in: LuaRules/Configs/functions/timeExt.lua

Input parameters

  • returnType (string)

Returned values

  • result (HMSF array or number)

Description

Return current value of simulation time in different formats based on parameter. Possible values of parameter are: "seconds" or "HMSF". If parameter is nil, it returns value in frames.

Example use

TBD

Comments


timeExt.Diff()

Located in: LuaRules/Configs/functions/timeExt.lua

Input parameters

  • minuendInHMSF (HMSF array)
  • subtrahendInHMSF (HMSF array)

Returned values

  • resultInHMSF (HMSF array)
  • resultInFrames (number)

Description

Calculates time diff between two time values. You can use same trick described in timeExt.Add with input.

Example use

TBD

Comments


timeExt.Multiply()

Located in: LuaRules/Configs/functions/timeExt.lua

Input parameters

  • timeInHMSF (HMSF array)
  • multiplier (number)

Returned values

  • resultInHMSF (HMSF array)
  • resultInFrames (number)

Description

Multiply time value by some number. You can use same trick described in timeExt.Add with input.

Example use

TBD

Comments

Updated