GetSearchLightColor
Jump to navigation
Jump to search
This function gets the color of a searchlight element.
Syntax
int int int int getSearchLightColor ( searchlight theSearchLight )
Required Arguments
- theSearchLight: the searchlight to get the color of.
Returns
Returns four integers representing the red, green, blue and alpha components of the searchlight's color, each ranging from 0 to 255. Invalid arguments raise an error.
The default color is red 200, green 200, blue 255 and alpha 0.
Example
This example creates a searchlight above the player and displays its default color.
addCommandHandler("getlightcolor", function()
local x, y, z = getElementPosition(localPlayer)
local searchLight = createSearchLight(x, y, z + 10, x, y, z, 0, 5)
if not searchLight then
return
end
local r, g, b, a = getSearchLightColor(searchLight)
outputChatBox(("Searchlight color: R=%d, G=%d, B=%d, A=%d"):format(r, g, b, a))
-- Remove the demonstration light after 10 seconds.
setTimer(destroyElement, 10000, 1, searchLight)
end)
See also
- createSearchLight
- getSearchLightEndPosition
- getSearchLightEndRadius
- getSearchLightStartPosition
- getSearchLightStartRadius
- setSearchLightEndPosition
- setSearchLightEndRadius
- setSearchLightStartPosition
- setSearchLightStartRadius