hhh_troll Posted December 19, 2016 Share Posted December 19, 2016 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. Link to comment Share on other sites More sharing options...
hhh_troll Posted December 19, 2016 Author Share Posted December 19, 2016 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 Link to comment Share on other sites More sharing options...
AlecSadler Posted December 19, 2016 Share Posted December 19, 2016 I think what you are looking for is a switch, look it up in the help file. Link to comment Share on other sites More sharing options...
spudw2k Posted December 19, 2016 Share Posted December 19, 2016 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: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
SadBunny Posted December 20, 2016 Share Posted December 20, 2016 (edited) "Return SLOT1 if missing"... Edited December 20, 2016 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
hhh_troll Posted December 20, 2016 Author Share Posted December 20, 2016 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 20, 2016 Moderators Share Posted December 20, 2016 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 How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
hhh_troll Posted December 20, 2016 Author Share Posted December 20, 2016 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. Link to comment Share on other sites More sharing options...
Somerset Posted December 20, 2016 Share Posted December 20, 2016 reported Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 20, 2016 Moderators Share Posted December 20, 2016 @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 How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts