Brutal 164 Posted January 22, 2013 Report Share Posted January 22, 2013 This is really causing me confusion. I run this code in a stand alone environment and it does fine - No errors, no issues. However, if I put this code (which is a self contained unit it seems) in with the code in a larger bot, I get the error of exceeded the range of the list on next list item. Can anyone explain to me why this happens? Quote Link to post Share on other sites
VaultBoss 310 Posted January 22, 2013 Report Share Posted January 22, 2013 Probably you need to CLEAR LIST before using it. I am assuming you are testing it and see it works, using the DEBUGGER and clearing all variables between sessions, but when ported into the actual code, if the code repeats itself somehow (inside a loop or something) your list indexes are overflown... just a guess. Quote Link to post Share on other sites
Brutal 164 Posted January 22, 2013 Author Report Share Posted January 22, 2013 I just gave it a try Vboss. - Same issue. The "set>keywordvar>next list item -- is still throwing the error... I'm at a complete loss on this -- any other ideas? I'll happily try it. Quote Link to post Share on other sites
VaultBoss 310 Posted January 22, 2013 Report Share Posted January 22, 2013 Because you are using $next list item, you might exceed the index, as the function not only returns the item, but also moves the pointer on the list at the same time - so when you get to the last item in the list, the code tries in fact to move forward but there is no place to move. I rarely use $next list item, because of that... hard to keep the score: "Where am I now?" kinda... I use clear cycling instead, where the list item is returned via $list item function and the index is cycledbetween (MAX list length - 1) and 0, decrementing on each loop, using LOOP WHILE. Hope this makes sense? set(#var_CYC_Keyword_CRT, $list total(%lst_Keywords), "Global") loop while($comparison(#var_CYC_Keyword_CRT, ">", 0)) { decrement(#var_CYC_Keyword_CRT) comment("YOUR CODE HERE") ..................................... comment("YOUR CODE HERE") } 2 Quote Link to post Share on other sites
Brutal 164 Posted January 22, 2013 Author Report Share Posted January 22, 2013 vBoss - your example is a little above my pay grade... However! Thanks for sharing it - I can now play around with your method and learn it. As for the issue I was having. It was a complete gooftard moment. I simply needed to reset the list position immediately before execution. (pffft. Spent hours on something so simple) Thanks for all of your help around here man - I really appreciate it. Quote Link to post Share on other sites
VaultBoss 310 Posted January 22, 2013 Report Share Posted January 22, 2013 No problems, mate... glad you solved your issue in any way you could do it. On the other hand, my solution up there is - hands down - THE simplest, cleanest and most beautiful of all loop-ing methods; but not because it's mine......simply because it really condenses code quite a lot, while still providing for the ability to employ other means to split command flowby forcing the cycling index down to 0 inside a branch of an IF, in order to exit the loop before it would normally end,IF/WHEN a certain condition is met (usually you found your item you were seeking...) thus also speeding the execution of the bots where it is used. So basically:easier to write,lesser amount of used variables,easier to debug,precise handling of index/position,smaller size of bot code,faster execution.It has it all... 1 Quote Link to post Share on other sites
ayzo 6 Posted February 4, 2013 Report Share Posted February 4, 2013 (edited) I had this problem too and solved it easily but it is a bug that needs to be fixed. For some reason ubot couldn't handle a "list from text" function unless it had 3 or more values. I had 2 "items" seperated with a "," for example: a,b,c,d,e,f,etc... And I was getting the same error, to fix it all I did was add a 3rd useless item like this: whatever,a,b,whatever,c,d,whatever,e,f,etc... Hope the dev team can fix this little bug. Edited February 4, 2013 by ayzo Quote Link to post Share on other sites
VaultBoss 310 Posted February 4, 2013 Report Share Posted February 4, 2013 There is no bug - that command works perfectly. It must be an error in the logic flow of your code. If you share the code here, we might be able to help you spot it. My guess is you're exceeding the list index, because you somehow use an indexing based on starting with first element numbering with 1, when in fact it is 0, hence the $list total value refers to an nonexistent last element, that is actually one step behind in reality. It looks like adding an extra element that you don't need in the list, you kinda 'moved' the boundary one step ahead this way, and your code seems to work with it, although there was no need to add anything extra, it would have been simpler to just decrement the max list number.But of course, might be other things as well - w/o the code is really hard to tell. Cheers! 1 Quote Link to post Share on other sites
Brutal 164 Posted February 11, 2013 Author Report Share Posted February 11, 2013 Just a heads up for VaultBoss - I went back to your example above. It's no longer above my pay grade. Works beautifully - Thanks! 1 Quote Link to post Share on other sites
VaultBoss 310 Posted February 13, 2013 Report Share Posted February 13, 2013 Thanks guys - I thrive to better myself in everything I do; I'm a perfectionist, what can I say... Strangely though (one would think the opposite should apply) my wife said it was one of my flaws... LOL Phew... women... they marry us for what we were... but then they get bored at what we became, moulded by their hands:"Where is the man I married that long ago?" Can you believe that? LOL ^^^ just kiddin' - I'm no misogynistic type of guy here... Quote Link to post Share on other sites
Cyberdyne v.2.0 0 Posted September 29, 2013 Report Share Posted September 29, 2013 Because you are using $next list item, you might exceed the index, as the function not only returns the item, but also moves the pointer on the list at the same time - so when you get to the last item in the list, the code tries in fact to move forward but there is no place to move. I rarely use $next list item, because of that... hard to keep the score: "Where am I now?" kinda... I use clear cycling instead, where the list item is returned via $list item function and the index is cycledbetween (MAX list length - 1) and 0, decrementing on each loop, using LOOP WHILE. Hope this makes sense? set(#var_CYC_Keyword_CRT, $list total(%lst_Keywords), "Global") loop while($comparison(#var_CYC_Keyword_CRT, ">", 0)) { decrement(#var_CYC_Keyword_CRT) comment("YOUR CODE HERE") ..................................... comment("YOUR CODE HERE") }I'm at a complete loss with this. It only returns a count of where the loop is at, but not the item on the list. Quote Link to post Share on other sites
djgbshows 1 Posted November 30, 2016 Report Share Posted November 30, 2016 (edited) i know this topic is closed but i was struggling with this and tried the methods on here with no luck so i played around and figured out why that error always happens. Its very simple. Set list position to 0 then run your next list item, not sure why it took me a freaking month to figure that crap out smh! lol but i hope this helps someone else. easy said, please refer to good ol wiki!, http://wiki.ubotstud...$next_list_item Edited November 30, 2016 by djgbshows Quote Link to post Share on other sites
djgbshows 1 Posted November 30, 2016 Report Share Posted November 30, 2016 (edited) Btw Happy holidays my friends! Edited November 30, 2016 by djgbshows 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.