# If row has 2 number 1's trigger command

Member, PRO Posts: 595

Assuming the outcome in this case is true,
How to code this please.

• Member Posts: 597

What have you tried thus far? There are several ways to do this.. but I want to see if you understand the logic of what you are wanting to achieve.

If you have to break it down. How do you think we would achieve it?

Essentially, to demonstrate the Logic needed, here is solution (but not recommend) that breaks down what you want to happen.

Rule:
If TableCellValue(Table,1,1) = 1

add New Rule nested. Any conditions valid.
If TableCellValye(Table,1,2) = 1
If TableCellValue(Table,1,3) = 1

If true, then do logic in this rule.

Create a new seperate rule:

Rule: (ALL conditions are valid)
If TableCellValue(Table,1,2) = 1
If TableCellValue(Table,1,3) = 1

Then add logic for true.

The first rule checks if the first column matches with any of the other columns.
And the second rule checks if it equals column 3 (Since rule one already checks if columns 1 and 2 equal).

If that makes sense, we can then look at how to make it more efficient. And be applied to your specific game.

Best,
Two.E

• Member, PRO Posts: 595

@Two.E

This is the approach i used.
Thing is the total possibilities here is 27, so it's quite a stretch.
And If the possibilities was in the hundreds this method you mentioned would not be feasible.

I was looking for a way using one or two behaviors to achieve this.

I'm thinking possibly using loop over table?

I can't seem to wrap my head around it though..

• Member Posts: 597

Great!

It really depends on what you are trying to achieve.
I assume you are trying to create a slot machine game?

How many rows, is it just three columns? What are the Line wins you are trying to achieve?

• Member, PRO Posts: 595
edited February 2019

I assume you are trying to create a slot machine game?

How many rows, is it just three columns? What are the Line wins you are trying to achieve?

It's more like a 3 wheels spinning game (micro Sic Bo game), each wheel has 3 numbers.
I used the normal method, and after quite a headache I achieved what I wanted.

I'm just glad I designed wheels with 3 numbers not 4, I would've been completely lost.

The original game is 3 x 6-sided dices, that would've been a disaster to code.

• Member, BASIC Posts: 39

It sounds like creating a loop using tableSearch is what can help you. However, it's still not entirely clear to me what you want. If I'm not mistaken, the structure I'm thinking of can be just as easily used for 6 columns and lots of rows, but it kinda depends on what you want.

Q1: How do you fill the columns with the numbers 1, 2 and 3? Because that's what you do, right?
Q2: What is the goal of spinning the wheel?

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,945

Yep, I'm not sure either.

What do the first five rows of your table look like? Are you wanting to check a single row at a time or many rows instantly?

For example, if all you need to know is if a single table row is either 1#1, 11#, or #11 (where # is any number), that's very simple to do.

But if you actually need to check every row in the table each turn/cycle to see if any two numbers match (2#2, 22#, or #22 OR 3#3, 33#, or #33) that's a little more complex. But ultimately, it shouldn't matter if you have 3 or 50 possible values as long as it's coded efficiently.

Honestly, you're doing yourself a disservice by keeping the details to yourself. With more info and examples, we can help you craft a method that will do what you need.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User