Jump to content
The simFlight Network Forums

Event Trigger Clearing


Recommended Posts

I know there's an event.cancel() function to cancel all events assigned to a function. But is there a way to cancel the event handler for a specific type of event only?

For example, if i'm watching event.control(X, "func") an event.control(Y, "func") and event.control(Z, "func") can I somehow cancel events for control X only, without canceling all event on the function "func"?

If not, maybe this could be done with something like event.control(X, "") or event with a separate function to cancel per function, like event.cancelControl(X, "func")

Link to comment
Share on other sites

I know there's an event.cancel() function to cancel all events assigned to a function. But is there a way to cancel the event handler for a specific type of event only?

The function will (normally) only be handling one type of event.

For example, if i'm watching event.control(X, "func") an event.control(Y, "func") and event.control(Z, "func") can I somehow cancel events for control X only, without canceling all event on the function "func"?

No. Just make the full function a non-event called function, and have several simple functions like

function controlX(val, param)

func(val,param)

end

function controlY(val, param)

func(val,param)

end

etc.

The internal structures controlling event detection are not really very amenable to doing it a different way. If you simply want to ignore certain controls just do so in your main event function. If this isn't viable for you, can you explain why you need this alternative method of doing things? I always like to fully understand reasons for things. Maybe I could then look at another way..

Regards

Pete

Link to comment
Share on other sites

I can't do this because the controls to monitor (and even whether to monitor) are coming from a "configuration" array... I'll work around the limitation.

If I can understand the reason (I always like to know there's a good reason), I'm willing to consider some amendment which will do something like you ask, possibly just for "event.control" (I don't think it is very easy with most event types, but with that it should be -- I can check). Maybe on the lines of

event.control(control, "proc", CANCEL), or your event.controlCancel(control, "proc")

I need the "proc" name because that's how they are indexed for access. There may actually be other "proc"s receiving the same control, which would not want cancelling.

Regards

Pete

Link to comment
Share on other sites

If I can understand the reason (I always like to know there's a good reason), I'm willing to consider some amendment which will do something like you ask, possibly just for "event.control" (I don't think it is very easy with most event types, but with

No worries... it's the failure script I'm working on, but it's using both offset and control. The configuration defines what to do for a failure (e.g. set FSX failure mode, or set flap control to 0) and if it's not a standard FSX failure, there's the option to re-"force" it on an event. The event function is global (e.g. failure_force) and if a failure needs to be reset, I have to recreate all the existing events since I have to cancel all events on failure_force. It's not problem, as I will likely allow only a full failure reset, not individual ones as I originally planned. I was just contrasting the API with standard stuff like addListener/removeListener type paradigms in call-back scenarios.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.