User Tag List

Results 1 to 9 of 9

Thread: 'and' function?

  1. #1
    No Products Registered

    Join Date
    Nov 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    'and' function?

    I want it to be so that if
    user clicks on object
    AND
    variable1>0
    then
    create object blah blah blah

    So I did that, with just inserting the 2nd condition, with no OR or anything in between, and its treating it like there IS an OR in between.
    So how do I make it so that BOTH conditions must be fulfilled for it to activate?

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Oct 2006
    Location
    Finland
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    Did you addd the 2nd condition to the same event by pressing the first events number with right mouse and select "add a new condition" or did you make a new event altogether? ...You should add to the same event so it should work.

  3. #3
    Forum Moderator

    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,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    nivram overlaps duffus block
    +Age is > 57
    +Only one action when event loops
    >Create a new nivram

    When both coditions are true, a new nivram is created.

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

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    Alonso's Avatar
    Join Date
    Jul 2006
    Posts
    681
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    Those two conditions should be under the same event. It naturally assumes an "and" operation.

    I'd like to see a "+ event #xx is true" condition, though.

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    when you have multiple conditions in the event editor, it is treated by default as if they have "AND" between them. The "OR" requires you to insert it between them.


    In MMF2, it is not exactly parallel with how it works in other languages. To understand it, you need to grasp how the "Object Selection List" or "Object Scope" works in MMF. Basically, at the start of every line of code, the object scope is set to all objects. The list will include a pointer to every single object in the game.

    When you run a condition, it will take one of two actions:
    A) The condition will resolve "TRUE" and unscope all copies of the object that did not resolve TRUE on a per-object basis
    B) The condition will resolve "FALSE"

    If *any* condition resolves "FALSE" the actions in the event will not execute (MMF does not use "short circuit" or "lazy" evaluation and will eval all conditions even if a previous one was false... but it might not read it at all if it depended on an "immediate" like an "On Loop" condition, which tells MMF2 *when* to parse it)


    This object scope list will keep being modified as the list goes down. So if you start off with 10 objects, your first condition might specify 6 of them- the other 4 objects will be discarded. Your second condition might specify 2 of these 6- the other 4 will be discarded. Your third condition might specify none of these 2- that condition would resolve "FALSE" and no actions would be taken.



    By having this object list manipulation, MMF2's conditions simulate an "AND" inbetween each condition in an *in-order* basis. Having nonrelated conditions like
    "Global Value A > 0"
    and
    "Repeat while Space Bar is pressed"

    will act just like any other language- it will only execute its actions if both are true, and won't do anything if either are false. However, conditions which act upon the same space of objects might sometimes care about order:


    "Object Value A > 0"
    "Pick an Object at Random"

    In that order, it picks a random object out of the pool of objects with value A > 0. In the other order, it picks a random object out of all objects, and then checks if its value A > 0- if it isn't, the line will not resolve.





    Oh yeah, and remember: if even a single condition resolves "FALSE", the line will not execute, whereas for each condition, if even a single object resolves "TRUE", the condition will resolve "TRUE".

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    Quote Originally Posted by Pixelthief
    If *any* condition resolves "FALSE" the actions in the event will not execute (MMF does not use "short circuit" or "lazy" evaluation and will eval all conditions even if a previous one was false...)
    This is incorrect. MMF will stop testing conditions in an event if one is false for all applicable objects.

    On the other hand, with an "OR" in the event, MMF may evaluate both sides even if the first side was true, in order to get an accurate object selection list.

    EDIT: In other words, MMF short-circuit evaluates "and" conditions, but not "or".

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    Quote Originally Posted by Dynasoft
    Quote Originally Posted by Pixelthief
    If *any* condition resolves "FALSE" the actions in the event will not execute (MMF does not use "short circuit" or "lazy" evaluation and will eval all conditions even if a previous one was false...)
    This is incorrect. MMF will stop testing conditions in an event if one is false for all applicable objects.

    On the other hand, with an "OR" in the event, MMF may evaluate both sides even if the first side was true, in order to get an accurate object selection list.

    EDIT: In other words, MMF short-circuit evaluates "and" conditions, but not "or".
    Hrmm wow ok I always thought it was otherwise, but I just tested it with some complex fast looping and indeed you're right, it does use short circuit evaluation. Nevermind that part of my post then.

  8. #8
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    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)
    UrbanMonk's Avatar
    Join Date
    May 2008
    Location
    Southern U.S.A.
    Posts
    847
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    even I knew that pixeltheif! Geez

  9. #9
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 'and' function?

    That's why you should put the most restrictive and less time-consuming conditions on top, to avoid making more tests than needed

Similar Threads

  1. Function Eggtimer problem // Power Function for MMF2 Android?
    By ogrgkyle in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th May 2013, 03:17 AM
  2. Fast Function?
    By Bipolar_Games in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 27th April 2012, 02:50 AM
  3. Remap value function?
    By geothefaust in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 24th August 2011, 08:22 PM
  4. Random function?
    By mdlm in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 14th June 2010, 04:28 PM
  5. Immediate update function?
    By Anders in forum Extension Developers Lobby
    Replies: 5
    Last Post: 21st June 2007, 08:31 AM

Posting Permissions

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