# playMaker

### Author Topic: [SOLVED]Compare Int Problem  (Read 1615 times)

#### Splankton

• Sr. Member
• Posts: 258
##### [SOLVED]Compare Int Problem
« on: September 05, 2013, 12:44:59 PM »
Hi,
I have a FSM on start that generates a random number into a variable (randomNumber) with a FINISHED event. That goes to the next FSM, that has a compare int action, that compares (randomNumber) to a Global variable (pickups).  Problem is, because (pickups) starts from 0 and increments +1 everytime the player picks up, the (randomNumber) is always greater than (pickups)
So, how can I compare the (randomNumber) against a variable, that can change?
By the way, the random number is set between 5-10.  I have set the compare Int to send an event when it is equal to pickup.
Can anyone help?
« Last Edit: September 06, 2013, 09:22:52 AM by Splankton »

#### Lane

• Hero Member
• Posts: 2488
• Yup.
##### Re: Compare Int Problem
« Reply #1 on: September 05, 2013, 01:19:53 PM »
What are you trying to make happen?

When is pickups int increased? The randomNumber int would only always be greater if pickups int was not increased independently. What's to correlation between the two?

Seems like it's comparing them fine, but is pickups int depending on randomNumber int somehow to increase? Otherwise you simply wait until pickups int has reached 5 or more to begin throwing the equal compare. Weird chance setup.

#### Splankton

• Sr. Member
• Posts: 258
##### Re: Compare Int Problem
« Reply #2 on: September 05, 2013, 02:24:32 PM »
All I need is when the player picks up items which is (pickups) that value is counted from 0.  I have this working, so when the randomNumber is generated, I want to wait until the pickups reach that random number, so I can use the int compare equal.

#### Lane

• Hero Member
• Posts: 2488
• Yup.
##### Re: Compare Int Problem
« Reply #3 on: September 05, 2013, 02:42:03 PM »
I don't really see what isn't working.

Pickups number goes up when you pickup something, a random number is generated at some point that is between 5 and 10, and there is an int compare to see if pickups is equal to the random number. If you run the Int Compare every frame then it will trigger when you get enough pickups to match the random number.

#### Splankton

• Sr. Member
• Posts: 258
##### Re: Compare Int Problem
« Reply #4 on: September 06, 2013, 03:57:53 AM »
I don't really see what isn't working.

Pickups number goes up when you pickup something, a random number is generated at some point that is between 5 and 10, and there is an int compare to see if pickups is equal to the random number. If you run the Int Compare every frame then it will trigger when you get enough pickups to match the random number.

Exactly, that's how I'd thought it should work, but it just flows into greater than as soon as it starts.  Is there a way to hold the compare action until it becomes equal? I've tried every frame.
Hos does the int compare work if all I have flowing out is equal with greater and less than selected as none?

#### Splankton

• Sr. Member
• Posts: 258
##### Re: Compare Int Problem
« Reply #5 on: September 06, 2013, 09:21:40 AM »
I have it working now.  I just made the greater and less than set to none and equal to every frame.  So thanks for the help