Difference between revisions of "DCS func addEventHandler"
From DCS World Wiki - Hoggitworld.com
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
|fName= addEventHandler | |fName= addEventHandler | ||
− | |vNum= 1.2. | + | |vNum= 1.2.0 |
|par1= [[DCS_singleton_world|world]] | |par1= [[DCS_singleton_world|world]] | ||
Line 45: | Line 45: | ||
|optType2= | |optType2= | ||
− | |examples= | + | |examples= The following displays a message detailing the event that occurred: |
+ | |||
+ | local e = {} | ||
+ | function e:onEvent(event) | ||
+ | local m = {} | ||
+ | m[#m+1] = "Event ID: " | ||
+ | m[#m+1] = event.id | ||
+ | if event.initiator then | ||
+ | m[#m+1] = "\nInitiator : " | ||
+ | m[#m+1] = event.initiator:getName() | ||
+ | end | ||
+ | if event.weapon then | ||
+ | m[#m+1] = "\nWeapon : " | ||
+ | m[#m+1] = event.weapon :getTypeName() | ||
+ | end | ||
+ | if event.target then | ||
+ | m[#m+1] = "\nTarget : " | ||
+ | m[#m+1] = event.target :getName() | ||
+ | end | ||
+ | trigger.action.outText(table.concat(m), 60) | ||
+ | end | ||
+ | world.addEventHandler(e) | ||
Line 56: | Line 77: | ||
[[Category:Events|addEventHandler]] | [[Category:Events|addEventHandler]] | ||
[[Category:Singleton Functions|addEventHandler]] | [[Category:Singleton Functions|addEventHandler]] | ||
+ | [[Category:Game Patch 1.2.0|addEventHandler]] |