Bob The Builder 62 Posted August 3, 2011 Report Share Posted August 3, 2011 I'm having some problems with my first bot and loops. I am using Loop Cycles: List Total I call Next list item to populate a variable. At the end of the list, it pushes past the end of the list and throws an error. Here is the bot, it basically goes to MX Toolbox and checks the MX records of each site in sites.txt and scrapes it into a table, I am saving it to a file for now until I figure this loop issue out, then I will actually do some checks against the data instead of actually saving it. This bot is going to run daily to check mx records of my clients and make sure they are set properly. The loop keeps bombing saying it is going past the end of the loop.MX Check.ubot Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 3, 2011 Report Share Posted August 3, 2011 try the attached.MX-Check-lowridertj.ubot Quote Link to post Share on other sites
Bob The Builder 62 Posted August 3, 2011 Author Report Share Posted August 3, 2011 try the attached. That works, but I don't understand why. I see you created a temp variable set to 0. You use that variable as the position for pulling the current list item. What confuses me though is I don't see INC called anywhere to increment that variable, yet your code works. Looking at this, it looks like it would pull item 0 over and over again until World War III. I would expect INC -> #temp to be called some where if you are using #temp to control the position in the list. On another note, what did you think of the code, did I do anything convoluted, or was I in the right direction? The list in loops is very confusing as it doesn't appear to work like traditional programming. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 3, 2011 Report Share Posted August 3, 2011 Sorry here is the fixed. I also think it was nicely setup and coded. wans't much to adjust to get it working right for ya.MX-Check-lowridertj.ubot Quote Link to post Share on other sites
JohnB 255 Posted August 3, 2011 Report Share Posted August 3, 2011 That works, but I don't understand why. I see you created a temp variable set to 0. You use that variable as the position for pulling the current list item. What confuses me though is I don't see INC called anywhere to increment that variable, yet your code works. Looking at this, it looks like it would pull item 0 over and over again until World War III. I would expect INC -> #temp to be called some where if you are using #temp to control the position in the list. On another note, what did you think of the code, did I do anything convoluted, or was I in the right direction? The list in loops is very confusing as it doesn't appear to work like traditional programming. He He...Nice catch Bob! TJ...take a nap already! http://ubotstudio.com/forum/public/style_emoticons/default/smile.gif Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 3, 2011 Report Share Posted August 3, 2011 wish i could. Quote Link to post Share on other sites
JohnB 255 Posted August 3, 2011 Report Share Posted August 3, 2011 wish i could. I know! Quote Link to post Share on other sites
Bob The Builder 62 Posted August 3, 2011 Author Report Share Posted August 3, 2011 Sorry here is the fixed. I also think it was nicely setup and coded. wans't much to adjust to get it working right for ya. Is there a way to use a list in a loop without using a control variable for the loop iteration?I thought Next List Item was how you did it, but it over steps the list end when using list total items as the loop cycle condition. By the way, thanks a lot TJ for the quick response. I'll be able to add the additional functionality now to complete the bot and make use of it. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 3, 2011 Report Share Posted August 3, 2011 i use the variable like that for list item as it is more precise and i dont have to use set list position. 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.