Vousk-prod.

Actions : how to bypass a .then without executing what's inside

Recommended Posts

Hello everyone,

 

I have this :

 

object.actionManager.registerAction(action1).then(action2)

 

Sometimes, because of an external event, I need to bypass action2, going then back listening for action1, but I can't simulate action2 trigger, because action2 must not be executed.

 

Do you see a way to do that ?

 

 

 

Share this post


Link to post
Share on other sites

Hola,

 

if you have a direct access to the action, you could execute its _executeCurrent(evt) function with no event (or just create an ActionEvent using the ActionEvent.CreateNew(...) )

If not, maybe try using the processTrigger() with the original trigger's trigger number, but that might trigger other actions as well.

I think storing this action somewhere for future reference and using _executeCurrent() would be the safest bet. This is just from looking at the source, there might be a much better and easier way!

Share this post


Link to post
Share on other sites

Hmmm, but I need that no one of the actions combined in action2 is executed, so I cannot use _executeCurrent on action2. Or maybe I misunderstood your proposition ?

 

For now the only solution I see is to replace all combined actions in action2 (there are many PlayAnimation actions, SetState actions and ExecuteCode actions combined in it) by one ExecuteCodeAction, which laucnh all these actions only if not met a special condition I set before simulating the action2 trigger. But that's pretty annoying because I need to replace all that marvelous pre-usable Actions by their hand-coded equivalent (I mean replace those PlayAnimationAction by scene.beginAnimtion(...), SetSateAction by obj.state = ..., etc). It would be easier if we can simply say an actionManager to go listening to "next action" for a particular registered action.

I'll certainly try a PR for something like that if DK doesn't say "oh it's already possible with..."

 

Edit : (and only when I'll be able to compile again BJS ts files on my computer... :( , for now I experienced pb with gulp - bugs on npm, need to reinstall everything I think -, and palantir's eclipse plugin couldn't compile anymore since update because of ts errors - cf http://www.html5gamedevs.com/topic/12197-typescript-errors-since-typescript-plugin-update/ -)

Share this post


Link to post
Share on other sites

Oh yes ! That brilliant ! A condition on every action2's combined actions I can set before simulating the action2 trigger.

I was pretty sure that someone would have a simple solution to that. Thanks DK !

 

BTW is it possible to simulate a OnPickTrigger on an object ?

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.