Home   Help Search Login Register  

Author Topic: Event Handlers ?  (Read 820 times)

0 Members and 1 Guest are viewing this topic.

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Event Handlers ?
« on: 17 May 2003, 23:29:50 »
I have learned quite a bit about editing since I started, but there is one thing I still no nothing about... something I have seen in quite a few script snippets:  addEventHandler and removeAllEventHandlers.  What are event handlers?  What does any of this mean?  Can anyone help me out here?

Thanks,
DucusSumus

Knut Erik

  • Guest
Re:Event Handlers ?
« Reply #1 on: 17 May 2003, 23:55:23 »
object addEventHandler handler
Operand types:
    object: Object
    handler: Array
Compatibility:
    Version 1.85 required.
Type of returned value:
    Number
Description:
    Format of handler is [type,command]. Check scripting topic Event handlers for more information. Index of currently added handler is returned.

Example:
    player addEventHandler ["killed",{_this exec "playerKilled.sqs"}]



Here ya go m8

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re:Event Handlers ?
« Reply #2 on: 18 May 2003, 01:00:33 »
Right, I have read that from the command ref., but I still have absolutely no idea what they are, or what they're purpose is... can anyone give an explanation?

Thanks,
DucusSumus

OneStiffRod

  • Guest
Re:Event Handlers ?
« Reply #3 on: 18 May 2003, 02:20:10 »
Yeah, this is a custom event that you can make happen...

I'm not sure on what the 'type' means in:
player addEventHandler [type,command]

but the command is just a reference to a script you've made, so whenever the 'type' is envoked your custom script plays...

Not sure, but you might be able to use it to map keys like say if you press the 'I' button it would play your script.

An event handler just catches certain events and then you can tell it what to do with them - so based on the ref example when a player is killed a "killed" notification/event is sent out and that can be captured and act as a trigger for something.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Event Handlers ?
« Reply #4 on: 18 May 2003, 08:06:23 »
Use the forum search function, you'll pick up a few tips.

Event handlers launch a command or script when an event happens.

Events include (I think) killed, hit, fired and probably others.   So you can call a script when any of these happens to the loon to whom the eventhandler has been added.

Plenty of reviewed ArmA missions for you to play

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Event Handlers ?
« Reply #5 on: 21 May 2003, 02:17:52 »
Didn't mind to start a new thread on this q, does concern only a few addons that might use eventHandlers for an effect.

Has anyone managed to get the "fired" eventhandler to work with NP2s radio (sebprc25) or BAS delta&ranger packs radio (bas_satcom)?

I once thought this was possible, but nothing happens when you "click the tangent" IE fire, except the static noise. Shame, would've been useful.. I tried it simply with adding a "fired" eventhandler to a unit, and when he uses the weapon above, he gets some actions. I know I got it working, only the script doesn't seem to go off with them radios.
« Last Edit: 21 May 2003, 02:20:27 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.