User Tag List

Results 1 to 9 of 9

Thread: How do I stop second event running immediately after?

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Drakiah's Avatar
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do I stop second event running immediately after?

    Hi there,
    I'm sure this has probably been answered somewhere already, but I can't find it. Apologies if so.
    Basically, I have an inventory system that, in the case causing me problems here, lets you equip/unequip accessories.
    I have equipping all set up fine, but once I started trying to program in unequipping a problem occurred:
    The equip and unequip events run at the same time, so it gets unequipped immediately after. (This only happens when selecting the equipped accessory to unequip it, not when I select other ones to switch what's equipped)

    Image3.png

    I would assume that, because equipping sets an Alterable Value to 1, which the unequip event checks for, it immediately runs that event because it's next in the list, and is still checking for events meeting conditions.
    Is there any way to make the event handling stop after running a specific one?

    Hope this makes sense, thanks!

  2. #2
    Clicker Fusion 2.5Android Export Module

    Join Date
    Sep 2010
    Posts
    537
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    sometimes things will work fine if you just change the order of the events. If you're lucky it might help :-) I always reverse the order when I have stuff like that happening. For example, you're doing a shopping system and choose "Buy" in a list object...What usually happens is that you might buy the first available item in the list as well because you might use the same button to choose options and perform actions...so fusion handles the events so fast that it will go into buy mode AND purchase the first item in the list. Just putting the "buy item" code above "Buy" option fixes it for me. I hope I made sense just now

  3. #3
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jan 2015
    Location
    Australia
    Posts
    166
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Drakiah View Post
    I would assume that, because equipping sets an Alterable Value to 1, which the unequip event checks for, it immediately runs that event because it's next in the list, and is still checking for events meeting conditions.
    Correct, that would be why this happens. One quick solution would be:

    - Line 203 - Change from "Set Equipped to 1" to "Set Equipped to 2"
    - Line 204 - keep this line as is

    Then insert a New Line 205 (or anywhere else, so long as it's after 204)
    - IF Equipped of (Inventory ART Equipped) = 2, THEN (Inventory ART Equipped) Set Equipped to 1

    One extra step, and so long as it's after line 204 it won't trigger it in the same frame tick. You might want to put it directly after though, depending on whether events further down the line rely on it being set to 1 and have to trigger in the same frame tick

    Quote Originally Posted by Klownzilla View Post
    sometimes things will work fine if you just change the order of the events. If you're lucky it might help :-)
    This *might* work but I suspect in this case this will cos the player to equip the item immediately after unequipping it, rather than the opposite

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Drakiah's Avatar
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by marbenx View Post
    - Line 203 - Change from "Set Equipped to 1" to "Set Equipped to 2"
    Unfortunately that wouldn't work in the current state, as the "Art Equipped" number is refering to the slot that is equipped, so changing that to 2 instead of 1 would make it equip the Art in slot 2 instead.
    If no easier solution presents itself, perhaps I could make it so that 1 equips Art1, 2 unequips Art1, 3 equips Art2, 4 unequips Art2, etc. Or something like that.

    Either way, I appreciate the suggestions/help!

    (Also, you are correct, it equips fine, but the same issue happens when trying to unequip. It immediately re-equips it)
    Quote Originally Posted by marbenx View Post
    This *might* work but I suspect in this case this will cos the player to equip the item immediately after unequipping it, rather than the opposite

  5. #5
    Clicker Fusion 2.5Android Export Module

    Join Date
    Sep 2010
    Posts
    537
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well...sometimes when things are not working like I want, I just go "Ah to hell with it" and just create an active object with 2 frames for the disapperaing sequence and when on first key press+ alt value =0 ---> equip item/set alt value to 1 and create active object. object is destroyed----> set alt value to 2/enable the unequip. A real coder will just shake his head now I guess...but hey....if something works...well...it works and sometimes I just don't want to bother with delicate solutions for every little thing

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Drakiah's Avatar
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Klownzilla View Post
    I just go "Ah to hell with it" and just create an active object with 2 frames for the disapperaing sequence
    We are quite similar in that way, it seems. Whenever I can't figure something out, I just make some weird way around it.
    Like before I knew how to do a number randomiser, I used to have it pick something at random by...
    Having a bunch of active objects moving around outside the play area (one for money, one for health, etc), and another object in the middle of them which, when I want the randomiser to happen, shoots a bullet. Whichever object happens to be in front of the bullet at the time, it would trigger whatever that object was set to trigger.

    Gotta love creativity, allowing unorthodox workarounds!

  7. #7
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jan 2015
    Location
    Australia
    Posts
    166
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Drakiah View Post
    Unfortunately that wouldn't work in the current state, as the "Art Equipped" number is refering to the slot that is equipped, so changing that to 2 instead of 1 would make it equip the Art in slot 2 instead.
    If no easier solution presents itself, perhaps I could make it so that 1 equips Art1, 2 unequips Art1, 3 equips Art2, 4 unequips Art2, etc. Or something like that.
    Ah, I see. Another solution then might be to
    - add a new active object (or use global value, use a flag, anything really)
    - a new condition in lines 203 and 204 check checks to make sure the value is 0/false
    - a new action in lines 203 and 204 that changes the value to 1/true
    - a new line in 205 that changes the value back to 0/false

    The same solution, but using a different object/value/flag instead

  8. #8
    Clicker Fusion 2.5Android Export Module

    Join Date
    Sep 2010
    Posts
    537
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Drakiah View Post

    Gotta love creativity, allowing unorthodox workarounds!
    Oh yes. I just love that there's always "the least attractive" solution whenever you're scratching your head. You try to find the most effective way to do something but just knowing you have the "non-coder" option makes everything so much easier. That way of thinking has actually helped me a lot IRL as well...especially at work. Game making requires you to look at things from many different angles and it forces you to see more than just the problem you're currently facing "Ok if I do this then I must do that in order to achieve this" whenever I have problems at work I usually come up with a solution for most things quite fast. Anyway, It took me a long while to realise just how useful the list objects are for example, for loads of things...not for just displaying items in a list. Can't do a game without 'em IMHO

  9. #9
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Drakiah's Avatar
    Join Date
    Feb 2015
    Location
    United Kingdom
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by marbenx View Post
    Ah, I see. Another solution then might be to
    - add a new active object (or use global value, use a flag, anything really)
    - a new condition in lines 203 and 204 check checks to make sure the value is 0/false
    - a new action in lines 203 and 204 that changes the value to 1/true
    - a new line in 205 that changes the value back to 0/false

    The same solution, but using a different object/value/flag instead

    That sounded promising, and it at least got as far as staying equipped, instead of immediately unequipping afterwards, but was still not unequippable afterwards...
    I guess, since both the equip (line 203) and unequip (line 204) events are checking for if the flag is off, it checks the event that's trying to equip it first since it's first in the list, so then it's always skipping over checking the unequip on and going straight to the event to turn the flag back off.

    I also tried this for the previous suggestion, changing the new value to 2 when you equip it, and then line 205 sets it to 1, then unequipping checks if it's 1, and sets it to 0. Unfortunately, for whatever reason, that makes it rapidly equip/unequip it while the button is pressed, despite it not being set to "Repeat while pressed". This is confusing.

    For now, I've just set it so that the back/cancel button unequips, since I have a dedicated button for opening/closing the inventory anyway. I will keep experimenting though, there must be some solution.

    Thanks for the continued help

Similar Threads

  1. Stop event for Animation broke?
    By Perry in forum Fusion 2.5
    Replies: 14
    Last Post: 26th November 2017, 06:23 PM
  2. Replies: 3
    Last Post: 17th April 2017, 06:42 PM
  3. After running, stop the error automatically exit BUG
    By wuxuechen in forum Fusion 2.5
    Replies: 0
    Last Post: 31st January 2017, 09:48 AM
  4. Replies: 2
    Last Post: 16th March 2015, 10:51 AM
  5. Stop application if another exe isn't running?
    By Xeeko in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 12th August 2012, 12:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •