Biks 9 Posted February 23, 2011 Report Share Posted February 23, 2011 I've got some bots that do a series of different things while it's looping. It's fairly long and I have lots of WAIT FORs while it waits for the site to do its thing. Occasionally I'll get an error message from the site - database misconfigured or something. I know I can tell Ubot to search for any messages during this process, but how can I get Ubot to go to the end of the loop and continue and not just STOP the loop? As it stands now, if I get an on-screen error message, it goes through the entire loop which is about 2 minutes long as it tries to find all the missing sections. (Obviously I have stop for errors turned off.) Would be nice if I could do IF "this message" appears, then GOTO a particular spot. (like the end of the loop) Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted February 23, 2011 Report Share Posted February 23, 2011 do if (search page error)than chose by attribute, and click chosenelse () loop within the loop running continuously within your 2 minute loop you have running on the site already looping itself to check for the error, and if found clicks it and the main loop continues on. Quote Link to post Share on other sites
UBotBuddy 331 Posted February 24, 2011 Report Share Posted February 24, 2011 A "GoTo" is bad in any language. Quote Link to post Share on other sites
Biks 9 Posted February 24, 2011 Author Report Share Posted February 24, 2011 if (search page error)than chose by attribute, and click chosenelse () I've already got a series of those in there. There's nothing to click. It's an onscreen message only. No buttons. What I've done is an account creator for 300 StatusNet sites. My Ubot works flawlessly for most, but there's a few StatusNet sites that are configured improperly, so my Ubot doesn't know what to do when it sees an error screen. (not a javascript dialog box) It then wastes 2 minutes while it tries to find what I told it to look for. So there's nothing to click. I want it to IGNORE the rest of the Ubot and just skip to the end. (if I get an error message) I vaguely remember when programming BASIC, you could tell it to GOTO line 30 or whatever, and continue from there. I want to tell Ubot to jump to the last "box" and go from there. A "GoTo" is bad in any language. I don't get it. (I'm not a programmer) Why is it bad in any language? Quote Link to post Share on other sites
UBotBuddy 331 Posted February 24, 2011 Report Share Posted February 24, 2011 You are correct about Basic having that command. It was bad then and it is still a bad command. The reason it is bad is because it promotes bad programming logic. If you cannot design adequate logic then throw in a Goto until you get it right. In other words, a "goto" provides a false sense of logic. I could go on but i am too tired to crawl up on my soap box and my high horse is back in the stable for tonight. LOL Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted February 24, 2011 Report Share Posted February 24, 2011 The search on page should work for you so long as you know what the error message contains.image, similar words in error messages etc. then you can have it skip to the next one in the loop cycle Quote Link to post Share on other sites
Biks 9 Posted February 24, 2011 Author Report Share Posted February 24, 2011 then you can have it skip to the next one in the loop cycle OK, cool. That's what I'm askin'. What and where is the SKIP command? Quote Link to post Share on other sites
theninjamanz 29 Posted March 1, 2011 Report Share Posted March 1, 2011 OK, cool. That's what I'm askin'. What and where is the SKIP command? USE IFs everywhere. That way If there is a problem it will always be skipped. I tend to write positive and failed URLS to a file, and you can tag these onto a few nodes below the one that captures whether there is success or not. Quote Link to post Share on other sites
UBotBuddy 331 Posted March 2, 2011 Report Share Posted March 2, 2011 You can also use a Loop and if you set it's variable to zero then its contents will not execute. Plus, it is quicker logic than building in the IF logic. You will still need that logic but you can jump blocks of code by setting a variable to zero. I would just group related IF is a single Loop with a related loop variable. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.