The Daily Click ::. Forums ::. Klik Coding Help ::. The OR condition
 

Post Reply  Post Oekaki 
 

Posted By Message

mastavasta



Registered
  27/07/2010
Points
  113
12th February, 2011 at 20:40:05 -

I know the general uses for the OR condition, but I've never really paid any attention to the difference between "OR(logical)" and "OR(filtered)". Can anyone clarify what they do, and how to take advantage of their differences? Maybe some examples?

Thanks,
mastavasta

 
Go into my head, then come back out and tell me I'm wrong.

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1657

VIP Member
12th February, 2011 at 21:04:48 -

The type of OR used just affects the object scope, and which actions are run.

eg.

Object_A overlaps obstacle
OR
Object_B overlaps obstacle
-> Destroy Object_A
-> Destroy Object_B

Suppose Object_A overlaps an obstacle, but Object_B does not.
If you use a logical OR, then MMF2 deletes both Object_A and Object_B.

However, if you use a filtered OR, then MMF2 only deletes Object_A, because only the condition relating to Object_A is true.
If only Object_B overlaps an obstacle, then only Object_B is destroyed; If both overlap an obstacle, then both are destroyed.

 
n/a

mastavasta



Registered
  27/07/2010
Points
  113
13th February, 2011 at 23:29:47 -

That's amazing, thanks for the help. It seems like MMF2 gets smarter every day.

 
Go into my head, then come back out and tell me I'm wrong.

..::hagar::..

Administrator
Old klik fart

Registered
  20/02/2002
Points
  1791

You've Been Circy'd!Teddy Bear
14th February, 2011 at 17:12:07 -

Hmm I have always wondered this too, thanks Sketchy!

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3271

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
14th February, 2011 at 19:02:50 -

Count my appreciation as well. Think I had this explained to me wrong before!

 
Image

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1657

VIP Member
14th February, 2011 at 19:34:38 -

Copied & pasted from the help file:

The OR operators
A new feature has appeared in Multimedia Fusion 2 since build 244 : the OR operators. The OR operators can simplify a lot your program of events by allowing you to group actions on a single line of events.

The OR operator must be inserted in the group of conditions of an event, like this :

+ Condition 1
+ Condition 2
OR
+ Condition 3
OR
+ Condition 4
+ Condition 5

Upon runtime, this group of events will be true when (Condition 1 and Condition 2) is true, OR Condition 3 is true OR (Condition 4 and Condition 5) is true. If any (or several of them) of these groups of conditions is true, the actions are executed. As you can see, the OR operator allows you to group actions in one line of event instead of being obliged to duplicate them on several lines.

Two kinds of OR
Multimedia Fusion 2 provides two kinds of OR operators, the filtered OR and the logical OR. They work differently and you should understand them before doing complex programming. The difference lays in the way the objects are selected by the conditions.

The Filtered OR operator
This is the operator you should use in most of the cases. Imagine the following conditions and actions :

+ Mouse is over object 1
OR (filtered)
+ Mouse is over object 2
- Destroy object 1
- Destroy object 2

If the mouse is over object 1, then object 1 is destroyed, but object 2 remains there. If the mouse is over object 2, object 2 is destroyed but object 1 remains there. The filtered OR operator explores all the conditions of the event, and marks all the objects as inspected. The objects contained in false condition are marked as well, but the action related to them will not occur. This is the reason why actions in a event with the filtered OR operator will only affect the objects selected in the conditions that are true.

The Logical OR operator
This operator does not mark the objects in false conditions. As the objects are not marked, the default behavior of Multimedia Fusion 2 when it encounters an action dealing with non-marked objects, is to affect ALL the occurences of the given objects. In our example, if we replace the filtered OR by a logical OR, you will have as a result :
If the mouse is over object 1, then both objects are destroyed, if the object is over object 2, then both objects are destroyed. Imagine mouse is over object 1, object 1 is selected. The actions are called. The Destroy object 1 action finds a selected object (the one under the mouse) and deletes it. The Destroy object 2 action find NO selected object: it destroys all the occurences of object 2.

Using either one of the OR operator is up to you, and it depends on the program you are making.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3271

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
14th February, 2011 at 20:00:50 -

Is there a way to only have the OR effect one portion of a condition? (Or have I misunderstood and you've already explained that you can? )

For example, this:

+ Condition 1
+ Condition 2
OR
+ Condition 3
OR
+ Condition 4
+ Condition 5

Fires the action when any one set is true. Is it possible to do something like this?

+ Condition 1
-------------
+ Condition 2
OR
+ Condition 3

So that condition 1 always has to be true, but either of the other can be true for the event to fire? Seems like this is always the functionality I need.

 
Image

GamesterXIII



Registered
  04/12/2008
Points
  1105

I am an April Fool
14th February, 2011 at 20:29:27 -


Originally Posted by OldManClayton

+ Condition 1
-------------
+ Condition 2
OR
+ Condition 3

So that condition 1 always has to be true, but either of the other can be true for the event to fire? Seems like this is always the functionality I need.



+ Condition 1
+ Condition 2
OR
+ Condition 1
+ Condition 3


lol

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3271

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
14th February, 2011 at 20:35:04 -

Which is the same thing as having two separate conditions.

 
Image

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1657

VIP Member
14th February, 2011 at 21:01:46 -

Pretty much - but if you used two separate events, then the actions would run twice if both conditions 2 and 3 were true. If you used an OR then they'd still only run once. You can imagine what would happen if you had an action adding to a counter or something.

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1105

I am an April Fool
15th February, 2011 at 13:55:50 -


Originally Posted by OldManClayton
Which is the same thing as having two separate conditions.



Thats pretty much what you asked for.

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5685

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
15th February, 2011 at 14:54:07 -

Thank you Sketchy! I never really use OR and your first explanation was straight to the point.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
   

Post Reply



 



Advertisement

Worth A Click