Jump to content
• Sign Up

# Logic Help

## Recommended Posts

I am an amateur and need some help formulating the logic.

I need to figure out a more efficient code other than a lengthy nested if then statement

Slot1           If slot 1 to slot 4 is "A" then press "B"
Slot2           If not then remove slot 1 and check if slot 2 to 4 is "A" then press "B"
Slot3           If not then remove slot 2 and check if slot 3 to 4 is "A" then press "B"
Slot4           If not then remove slot 3 and check if slot 4 is "A" then press "B"
then return Slot 3 and check if "A" then press "B"
then return Slot 2 and check if "A" then press "B"
then return Slot 1 and check if "A" then press "B"

Example is

Slot 1 to Slot 4 is not "A"
remove Slot 1 is still not "A"
remove Slot 2 is "A"
Press B
Return Slot 2
Check again if slot 2 to 4 is "A" and so forth

Sorry for the confusing format but any help would be appreciated.

#### Share this post

##### Share on other sites

BUTTON press turns SLOT value to 0

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON
4             3            2             1                10
IS "total" <= 5
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present

SLOT2    SLOT3    SLOT4        TOTAL    BUTTON
3            2             1                 6
IS "total" <= 5
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present

SLOT3    SLOT4        TOTAL    BUTTON
2             1                3
IS "total" <= 5
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present

SLOT2    SLOT3    SLOT4        TOTAL    BUTTON
3             0            0                 3
IS "total" <= 5
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON
4             0            0             0                 4
IS "total" <= 5
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON
0             0            0             0                 0

#### Share this post

##### Share on other sites

I think what you are looking for is a switch, look it up in the help file.

#### Share this post

##### Share on other sites

Logic is a little peculiar.  What is this logic suppose to apply to?  Can you give a real world scenario?

Spoiler

Things I've Made: Transparency Machine
Misc Code Snippets:
Projects: SubnetCalc
Cool Stuff:

#### Share this post

##### Share on other sites

"Return SLOT1 if missing"...

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

#### Share this post

##### Share on other sites

There are 4 slots with variables

There is a Total that displays the total of the 4 variables

There is a button that can be pressed to set the variables to 0

I need to press the button when the total sums to 5 or less
I can remove the variable in a slot to reduce the total sum but want to put it back after the button is pressed.

1,2,3,4 as values is a sum of 10 so if I remove the variables one at a time I will end up with SLOT 4 with variable value 4 before I press the button
So when the button is pressed the variable in slot 4 becomes 0 and I want to return the variables removed earlier so it will look like 1,2,3,0 sum of 7

Then it will cycle and remove variables till it is 5 or less in this case it will remove SLOT 1 and 2 and be left with 3,0 and the button will be pressed again
so upon returning the other variables it will be 1,2,0,0 which will be sum 3 and the button will be pressed again to have 0,0,0,0

#### Share this post

##### Share on other sites

Sounds a whole lot like a slot machine game. Am I close?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

#### Share this post

##### Share on other sites

Close enough  I am trying to automate a game. I have been practicing with the simpler mouse clicks and delays. I want to learn and level up to the more complicated stuff. I have been able to apply a few other scripts like Lasker's image search.

reported

Spoiler

#### Share this post

##### Share on other sites

@hhh_troll you seem not to have bothered to read the forum rules. Please do so now, especially the part about game automation, and you will see why this thread is locked.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

#### Share this post

##### Share on other sites
This topic is now closed to further replies.

• ### Recently Browsing   0 members

No registered users viewing this page.

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...