User Tag List

Results 1 to 10 of 10

Thread: Else condition

  1. #1
    No Products Registered

    Join Date
    Jul 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Else condition

    Hi, everyone. Maybe my question is too simple, but I really can't find the solution.

    For example, a global variable = 1, 2 or 3.
    When I press L, if gv=1, it changes to 2,
    ELSE if gv=2, it changes to 3.

    I tried to make 2 different conditions, but it changes from 2 to 3 automatically.
    How to realize "ELSE" condition?

    Thanks.

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,729
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    User presses L
    +Global value A = 1
    > Set Global Value A to 2

    User presses L
    +Global value A = 2
    > Set Global Value A to 3

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    No Products Registered

    Join Date
    Jul 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Безымянный.jpg
    When I press the button, it sets 1 to 2, and then IMMEDIATELY sets 2 to 3.
    It needs "ELSE" condition to set from 1 to 2 when I pressed "L" once, and from 2 to 3 ONLY when I pressed the key once again.
    Where is my mistake?

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Pineapple's Avatar
    Join Date
    Oct 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Swap the order of the conditions:

    User presses L
    +Global value A = 2
    > Set Global Value A to 3

    User presses L
    +Global value A = 1
    > Set Global Value A to 2

    When MMF runs, it goes through the list top to bottom and execute/updates as soon as the condition is met. By swapping the order of these 2 events, it should then work.

  5. #5
    No Products Registered

    Join Date
    Jul 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it works, but when I add third condition (If A=3 set A to 1), or even change conditions to

    User presses L
    +Global value A = 2
    > Set Global Value A to 1

    User presses L
    +Global value A = 1
    > Set Global Value A to 2

    everything is bad.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export Module
    conceptgame's Avatar
    Join Date
    Apr 2011
    Location
    Switzerland
    Posts
    739
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    User presses L is valid for a whole loop so you should blocked the other once one event is triggered. There are several solutions:
    - swapping the event order but it can be quickly a nightmare when the code grows up.
    - use event groups to organize your code:
    User presses L
    > Activate event group "ChangeGVA"
    In event group:
    Global Value A = 1
    > Set Global Value A to 2
    > Disable Event Group "ChangeGVA"
    - use a global value or something similar as flag before all the events:
    Flag = 1
    > Set Flag to 0
    And for every events which should only be activated once, add a Flag = 0 condition and a Set Flag to 1 action.
    - Use only one event with OR operator
    - If you just want to loop the value, use only one action:
    User presses L
    > Set Global Value A to Global Value A mod 4 + 1

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Yima's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I usually solve this problem by having an active object storing the states of all buttons pressed. Each variable is set to 1 if the button is pressed, and 0 if it is not. The code would be something like this:

    User presses L
    +Global value A = 2
    +L pressed of Buttonstates = 0
    > Set Global Value A to 1
    > Set L pressed of Buttonstates to 1

    User presses L
    +Global value A = 1
    +L pressed of Buttonstates = 0
    > Set Global Value A to 2
    > Set L pressed of Buttonstates to 1

    (negate) Repeat while "L" is pressed (repeat while L is not pressed)
    >Set L pressed of Buttonstates to 0

    Only one of the Global value A assignments will happen for each time "L" is pressed.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    tompa's Avatar
    Join Date
    Nov 2011
    Location
    Uppsala, Sweden
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here's another way.

    might help, might not
    Attached files Attached files

  9. #9
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Use groups to solve this problem. One group for each condition. When 1 condition happens, disable the rest of the groups. Then re-enable all groups immediately after the last condition

  10. #10
    No Products Registered

    Join Date
    Jul 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot

Similar Threads

  1. Help condition
    By Misix in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 22nd December 2011, 03:49 PM
  2. Is this condition possible?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th February 2011, 08:31 PM
  3. swf condition
    By Skyhunter in forum SWF/Flash Export Module Version 2.0
    Replies: 4
    Last Post: 5th November 2010, 02:13 AM
  4. what do you do when a condition....
    By Lillmissthang in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 21st February 2010, 01:50 PM
  5. Fullscreen condition
    By Ran_TH in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 24th October 2008, 09:14 AM

Tags for this Thread

Posting Permissions

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