User Tag List

Results 1 to 6 of 6

Thread: multiple conditions in the expression editor?

  1. #1
    Clicker Fusion 2.5
    ayejes's Avatar
    Join Date
    Feb 2008
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple conditions in the expression editor?

    I was wondering if its possible to put multiple conditions in the expression editor to simplify coding.

    I have the following code in one event to limit where a player can click with mouse for an action to occur which works fine. But I would like to put all of this in the expression editor for one event.

    mouse_x > ( X( "Player" ) + 16 ) - 40
    mouse_x < ( X( "Player" ) + 16 ) + 40
    mouse_y > ( Y( "Player" ) + 16 ) - 40
    mouse_y < ( Y( "Player" ) + 16 ) + 40


    The reason I would like this is because I need to limit this even further. So that there is only four grids that a player can click around the player. The grid just above, below, right and left. So limiting to one grid would be as follows.

    mouse_x > ( X( "Player" ) + 16 ) - 40
    mouse_x < ( X( "Player" ) + 16 ) + 40
    mouse_y > ( Y( "Player" ) + 16 ) - 16
    mouse_y < ( Y( "Player" ) + 16 ) + 16

    I put the hotspot and action point at 0,0, that is what the +16 is for. I do it this way because placing the hotspot or action point at the center of player character was causing issues with other coding.

    So, if I have to write this all out I would have to have 16 lines of code in one event to limit the mouse to being able to only click in four grids around the player. So I was wondering if the four lines can be all put into one expression editor for each grid.

    Thanks.

  2. #2
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    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)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,037
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    a WILD GUESS at what you are trying to do;

    a way of putting multiple conditions in 1 line; is to think about it in a different way.

    you could have 4 invisible actives [markers] of a set size; always positioned to your player; ( these are your detection zones instead of mouse>x-16 etc )
    and just do your 4 conditions all in 1 line...
    mouse overlapping [active marker 1]
    mouse overlapping [active marker 2]
    mouse overlapping [active marker 3]
    mouse overlapping [active marker 4]

  3. #3
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Wow danjo I like your idea. I think a lot users think in terms of the player. But to think in terms of detection zones as a property of the player is forgotten. As a human we have different detections zones of different types and sizes. Our eyes, our ears, out arms and hands, our feet for example. Each has a different range of detection and character. A polar bear is said to be able to smell a seal under 3 feet of ice from a mile away. Exposed prey over 20 miles away.


    Just like we can add behaviors and alt. values, strings, and flags how about we also be able to add zones? Maybe even be able to select different types of zones as a property of the object?

    Good idea danjo

  4. #4
    Clicker Fusion 2.5
    ayejes's Avatar
    Join Date
    Feb 2008
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I am still trying to adjust to a new paradigm of programing using mmf. Even though I have played around with mmf for a while, my brain has been wanting to think everything in hard code.

    Thanks a lot, that makes so things so much easier.

  5. #5
    Clicker

    Fusion 2.5Android Export Module

    Join Date
    Jan 2007
    Posts
    258
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ayejes View Post
    I was wondering if its possible to put multiple conditions in the expression editor to simplify coding.

    I have the following code in one event to limit where a player can click with mouse for an action to occur which works fine. But I would like to put all of this in the expression editor for one event.

    mouse_x > ( X( "Player" ) + 16 ) - 40
    mouse_x < ( X( "Player" ) + 16 ) + 40
    mouse_y > ( Y( "Player" ) + 16 ) - 40
    mouse_y < ( Y( "Player" ) + 16 ) + 40


    The reason I would like this is because I need to limit this even further. So that there is only four grids that a player can click around the player. The grid just above, below, right and left. So limiting to one grid would be as follows.

    mouse_x > ( X( "Player" ) + 16 ) - 40
    mouse_x < ( X( "Player" ) + 16 ) + 40
    mouse_y > ( Y( "Player" ) + 16 ) - 16
    mouse_y < ( Y( "Player" ) + 16 ) + 16

    I put the hotspot and action point at 0,0, that is what the +16 is for. I do it this way because placing the hotspot or action point at the center of player character was causing issues with other coding.

    So, if I have to write this all out I would have to have 16 lines of code in one event to limit the mouse to being able to only click in four grids around the player. So I was wondering if the four lines can be all put into one expression editor for each grid.

    Thanks.
    You could reduce it slightly by reading raw distance. See below

    Abs(Mouse X ) - Abs((Player x)+16) <40
    Abs(Mouse Y ) - Abs((Player Y)+16) <40

    You could also try creating an object with 4 directions only and have it always point in the direction of the mouse. Then adjust the hotspot for each direction so that it aligns with the player the way you want.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2017
    Location
    Milano, Italy
    Posts
    130
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by GamesterX23 View Post
    Abs(Mouse X ) - Abs((Player x)+16) <40
    Abs(Mouse Y ) - Abs((Player Y)+16) <40
    This is wrong to calculate a distance on one axis you need to put the Abs outside the subtraction like this

    Abs((Mouse X ) - ((Player x)+16)) <40
    Abs((Mouse Y ) - ((Player Y)+16)) <40

Similar Threads

  1. Nested Conditionals. Multiple Conditions
    By Grafer in forum Fusion 2.5
    Replies: 1
    Last Post: 10th October 2016, 09:58 AM
  2. Multiple numbers in expression editor
    By Boba Fonts in forum Fusion 2.5
    Replies: 3
    Last Post: 28th October 2015, 10:30 PM
  3. How to check multiple conditions simultaneously?
    By Janette5 in forum Fusion 2.5
    Replies: 4
    Last Post: 1st March 2015, 06:11 AM
  4. Possible to add multiple conditions in the expression editor?
    By Felicium in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 6th December 2014, 01:39 AM
  5. Is there a way to have an event with multiple conditions?
    By randomdude90 in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 9th July 2012, 06:17 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
  •