Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rabagast on February 22, 2014, 03:41:19 AM

Title: Int compare
Post by: Rabagast on February 22, 2014, 03:41:19 AM
Hi!
Is it possible to compare an Int variable 1 - 10 except for example 5?
So it will only use the numbers 1, 2, 3, 4, 6, 7, 8, 9 and 10.
Title: Re: Int compare
Post by: coxy17 on February 22, 2014, 06:12:28 PM
Hi,

im not an expert but ive used a similar setup in my game. You can use a 'Int compare' action.

1. Pick your integer(s) - option to compare two if you need.
2. Equal to is going to be 5
3. less than is 4-1
4. more than is 6-10

Hope it helps e.g. picture showing where it would find the number 5.

Nick
Title: Re: Int compare
Post by: jeanfabre on February 24, 2014, 09:15:53 AM
Hi,

 @coxy17 : I am not making sense of your "5" event here. Cany ou explai more of this?

@Rabagast : is there a mathematical reason or is it special? I would simply use ArrayMaker and list your supported ints, and use the action "Array List contains" to check if the int is there.

 if you are compare a value and don't want it to compare to 5, it means really that if your value is five it's special... so first compare it to 5 indeed and do a logical branch on this and then compare it other ints if you need too.

 saying you want to compare to all but a certain value can be achieve with its' opposite: Is it equal to 5? yes do this, no do that.


bye,

 Jean

Title: Re: Int compare
Post by: coxy17 on February 24, 2014, 06:24:02 PM
Jeanfabre, I was just showing where he would find the value 5 if using an int variable?
Title: Re: Int compare
Post by: jeanfabre on February 25, 2014, 02:50:19 AM
Hi,

 then, int 2 should be "5" cause here the event "5" will be fired if the value is equal to 0.

bye,

 Jean
Title: Re: Int compare
Post by: Rabagast on February 25, 2014, 05:57:13 AM
Hi!
I tried a little experiment with this.

I made a Random Int.
And then I use an Int Compare
Integer 1, I use an Int Variable
Integer 2, I have the number 5.
Then I use two events for Less Than and Greater Than.
But It will still find the number 5, and nothing will happened.
It should be "Except" in the Int Compare, so I can have this
random numbers except one number. Then it would be very easy.
Title: Re: Int compare
Post by: jeanfabre on February 25, 2014, 07:12:40 AM
Hi,

 do the exeption as one comparision before that.

Compare your value with 5 first and fire an event if it's equal, meaning it's going to exit the state, then do your comparision for the min and max, if you reached that action it means it's not 5 because you exited prior reaching that action as you detected it.

bye,

 Jean
Title: Re: Int compare
Post by: Rabagast on February 26, 2014, 01:57:23 AM
Hi!

I was experimenting a bit. This is what I came up with.

If the number I don't want is 4 and the Int Compare in State 5 is equal to 4, then it will go to State 2 and then back to state 5 and it will try again to find another number. If the number is 1, 2 or 3, it will go to State 3.

Was it something like this you had in your mind? :)
Title: Re: Int compare
Post by: jeanfabre on February 26, 2014, 01:34:21 PM
Hi,

 do you actually want to create a pool of numbers? so that taking one removes it form that list so that it's not taken again?

 If yes, use ArrayMaker, it will be easier, have a list of all your numbers, and as you pick then, remove them from the list, then you are certain not to pick it up again.

bye,

 Jean
Title: Re: Int compare
Post by: Rabagast on February 26, 2014, 06:18:45 PM
Hi!

Yes, that would be the best solution!
Do you think you can make an example? Or follow me through this. I think I need to learn arraymaker.
Title: Re: Int compare
Post by: jeanfabre on February 27, 2014, 03:36:03 AM
Hi,

 look at this

http://hutonggames.com/playmakerforum/index.php?topic=6128.msg30253#msg30253

this pick random gameobject out of a pool and place them. the principle is the same for any values.


bye,

 Jean