#Triggers - docu changes

This commit is contained in:
Applevangelist 2023-10-17 16:58:14 +02:00
parent a7f01eb04a
commit f6b5c69d4e
2 changed files with 29 additions and 18 deletions

View File

@ -6198,21 +6198,32 @@ do -- SET_ZONE
-- @param Wrappe.Controllable#CONTROLLABLE Objects Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET\_UNIT, SET\_GROUP, SET\_CLIENT
-- @return #SET_ZONE self
-- @usage
-- -- Create a new zone and start watching it every 5 secs for a certain GROUP entering or leaving
-- local triggerzone = ZONE:New("ZonetoWatch"):Trigger(GROUP:FindByName("Aerial-1"))
--
-- -- function to handle FSM event "EnteredZone"
-- function triggerzone:OnAfterEnteredZone(From,Event,To,Group)
-- MESSAGE:New("Group has entered zone!",15):ToAll()
-- end
--
-- -- function to handle FSM event "LeftZone"
-- function triggerzone:OnAfterLeftZone(From,Event,To,Group)
-- MESSAGE:New("Group has left zone!",15):ToAll()
-- end
--
-- -- Stop watching the zone
-- triggerzone:TriggerStop()
-- -- Create a SET_GROUP and a SET_ZONE for this:
--
-- local groupset = SET_GROUP:New():FilterPrefixes("Aerial"):FilterStart()
--
-- -- Trigger will check each zone of the SET_ZONE every 5 secs for objects entering or leaving from the groupset
-- local zoneset = SET_ZONE:New():FilterPrefixes("Target Zone"):FilterOnce():Trigger(groupset)
--
-- -- Draw zones on map so we see what's going on
-- zoneset:ForEachZone(
-- function(zone)
-- zone:DrawZone(-1, {0,1,0}, Alpha, FillColor, FillAlpha, 4, ReadOnly)
-- end
-- )
--
-- -- This FSM function will be called for entering objects
-- function zoneset:OnAfterEnteredZone(From,Event,To,Controllable,Zone)
-- MESSAGE:New("Group "..Controllable:GetName() .. " entered zone "..Zone:GetName(),10,"Set Trigger"):ToAll()
-- end
--
-- -- This FSM function will be called for leaving objects
-- function zoneset:OnAfterLeftZone(From,Event,To,Controllable,Zone)
-- MESSAGE:New("Group "..Controllable:GetName() .. " left zone "..Zone:GetName(),10,"Set Trigger"):ToAll()
-- end
--
-- -- Stop watching after 1 hour
-- zoneset:__TriggerStop(3600)
function SET_ZONE:Trigger(Objects)
--self:I("Added Set_Zone Trigger")
self:AddTransition("*","TriggerStart","TriggerRunning")

View File

@ -573,15 +573,15 @@ end
-- @param Wrappe.Controllable#CONTROLLABLE Objects Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET\_UNIT, SET\_GROUP, SET\_CLIENT
-- @return #ZONE_BASE self
-- @usage
-- -- Create a new zone and start watching it every 5 secs for a certain GROUP entering or leaving
-- -- Create a new zone and start watching it every 5 secs for a defined GROUP entering or leaving
-- local triggerzone = ZONE:New("ZonetoWatch"):Trigger(GROUP:FindByName("Aerial-1"))
--
-- -- function to handle FSM event "EnteredZone"
-- -- This FSM function will be called when the group enters the zone
-- function triggerzone:OnAfterEnteredZone(From,Event,To,Group)
-- MESSAGE:New("Group has entered zone!",15):ToAll()
-- end
--
-- -- function to handle FSM event "LeftZone"
-- -- This FSM function will be called when the group leaves the zone
-- function triggerzone:OnAfterLeftZone(From,Event,To,Group)
-- MESSAGE:New("Group has left zone!",15):ToAll()
-- end