# Having two Colliding variables - How to have a "greater than" and "less then"

In My game, choices are one of it’s key elements. In my game, to be breif, I want the domenating variable out of the 2 to be displayed. All the sprites and animationes are set up, and all that needs doing is the code. Originally, I planned to use an expression to do the < and > thing that you will see in the editor. But unfortunatley, it did not work. So i wanted to know is it even possible? This is, very very difficult to explain so bellow will be the link to the game and in the level called new level is the level you need to select. When this has been done, go into the UI editor and click on what I have named the “Path Display”. After having observe what i have attempted to do, please press “Play” and walk into the purple cube. After you have done this enter the editor again and see the very simple code for the purple cube.

Once all of the code has been veiwed and judged on, can someone please tell me if this is possible. Once you see What I have tried to do you will get a better understanding of what I mean. screenshots of code would be super helpful, along with a detailed explanation of basically how the thing works. Now, if this does prove to be unachievable, I would really appreciate an alternate (and potentially easier) way to have this feature in my game.

The Game: https://flowlab.io/game/view/1387014

@TinkerSmith Sorry to disrupt you during work but this really was what I was looking for thank you! I’ll keep you updated if I ever need any more help on expressions!

@“The Kodex” LOL, that was easy then

Anytime, love tinkering with logic equations

@“The Kodex” , I can’t check it out now, I am at work and only got my phone.
If not sorted by then I have a look later. For that, what object carries the code in question?

In the meantime, a simple ‘Greater Than’ expression could look like this
`(`IF`)?`THEN`:`ELSE is written as:
`(A>B)?A:B`

Meaning in this case: IF A is greater than B THEN return A ELSE return B

Reminds me, @Grazer (sorry, me again), since we can only evaluate 2 parameters at a time in an expression … and now we also have Global Variables … is there any way to refer to them from within the Expression Block directly, by Name for example? I have no idea how you internally manage them, just a thought of mine to extend the options one has within the block and to be able to use more than just A and B.

I’ll see if I can help.

I’m unable to see what you’ve tried to do atm, but have you tested greater than and less than method theory would work with 2 filters? If so, I could look at the code later. TinkerSmith may be able to help with the code in the expression.

@“JR 01” Thanks for the breif synopsis, @TinkerSmith maybe you can help with trying ro achive this using expressions or point out another way. Sorry I forgot to shout out @“JR 01” and @Superstargames . @grazer maybe you can help with this as well? I hope so!

Hey @TinkerSmith For some reason this does not wan to work could you try to apply this yourself and then screenshot what I need to do if this works.

Now before you do, what I want to happen is, well : In the Game, the player makes choices which are essentially good or bad. In the Game, god is refereed to as Merciful, and bad as Violence. At the top of the UI, it is to display which you have more as through an image; Path of the Hunter (Violence) or Path of the Merciful. Essentially, I want it so whichever variable is more, Violence or Mercy, the Path Display is to switch to an animation which tells you. It is probably easier to see what I mean once inside the game. In the beginning of the level, there is a purple default block. Walk into this. To test if what you have done has worked, this SHOULD make the image at the top say Path of the Hunter.

@“The Kodex”
You can space out the formula so it’s easier to see, so something like this:

@“The Kodex” no worries, I have a look at my next break
Before I dig in, what object carries the code in question?
Or I see @“JR 01” already had a look, is it sorted?

@TinkerSmith Thank you, and the object is in the UI layer, ans known as the Path Display. JR 01 Just reccomended to clean up the Editor.

@“The Kodex” only had a minute between meetings, but the most obvious reason why it doesn’t work is that your equation blocks ‘eval’ input is not connected
Expressions need it, they don’t start automatically when the input changes.

P.S. I really like @“JR 01” 's suggestion to replace the 2 equation blocks with the setup he shows. I am a big fan of easy to read diagrams AND only ONE eval input to worry about

Would look like this:

P.S. and if you get into the habit to name your variables one would not have to trace back the whole diagram to see what they are supposed to be

Lol I didn’t mean to, I went into my own test game to make diagram just to show how it works. Glad it helped more than intended

@TinkerSmith Thank You so Much! You too have been so helpful. I wish I were as good as you guys on flowlab.

LOL, you are so good in helping out, you even help by accident HAHA

Just one suggestion for @Kodex. If you use @“JR 01”'s layout maybe use +1/-1 instead of 20/10.
For readability it is more clear that it is used for a logical comparison (Change filter accordingly).

Specific values I would only use if they have another function beside the comparison, like positioning, etc.

I know, I know, readability seems to be my theme, let me know when I start to annoy.