Difference between revisions of "DCS func setCode"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
Line 36: Line 36:
 
[[DCS_Class_Spot|'''Spot Functions:''']] {{listofScriptingSpotFuncs}}
 
[[DCS_Class_Spot|'''Spot Functions:''']] {{listofScriptingSpotFuncs}}
  
|examples=  
+
|examples= The following creates a function that could be called to change the laser code to a passed value or if nothing is passed a default value like something an idiot would use for their luggage.
 +
 
 +
    local ray = Spot.createLaser(jtac, {x = 0, y = 1, z = 0}, Unit.getByName('target'):getPoint(), 1337)
 +
    local function changeCodePlease(code)
 +
        local c = code or 1234
 +
        ray:setCode(c)
 +
    end
  
 
|notes=  
 
|notes=  
 
}}
 
}}
 
[[Category:Class Functions|setCode]]
 
[[Category:Class Functions|setCode]]

Revision as of 00:49, 1 November 2021

Scripting Root

Envrioment: Mission Scripting
Function: setCode Added with: 1.2.6
Member Of: Spot
Syntax: function Spot.setCode(Class Self , number code )
Description: Sets the number that is used to define the laser code for which laser designation can track. Default and max value is 1688


Return Value: function
Return Example: none
Examples: The following creates a function that could be called to change the laser code to a passed value or if nothing is passed a default value like something an idiot would use for their luggage.
   local ray = Spot.createLaser(jtac, {x = 0, y = 1, z = 0}, Unit.getByName('target'):getPoint(), 1337)
   local function changeCodePlease(code)
       local c = code or 1234
       ray:setCode(c)
   end
Related Functions: Spot Functions: createLaser. createInfraRed, destroy, getCategory, getPoint, setPoint, getCode, setCode
Notes: