smallballz 0 Posted October 7, 2010 Report Share Posted October 7, 2010 hi guys, how do you store the "current" list item into a variable? my bot has too many loops and my list is getting bigger and confusing... http://www.leeroo.com/images/718_single.png Quote Link to post Share on other sites
Praney Behl 314 Posted October 7, 2010 Report Share Posted October 7, 2010 If you are trying to store all the items then in the last node of the image you should have the selected list instead of #current_item variable. But if you are trying to save the whole list in a variable then you have to : set "variable_name";inserts -> insert list -> list_name; That may help.. Praney Quote Link to post Share on other sites
IRobot 43 Posted October 7, 2010 Report Share Posted October 7, 2010 how do you store the "current" list item into a variable? To store the current $list item in a variable, if you are looping through a list, use:Set variable Variable: #current_item Content: $next list item Quote Link to post Share on other sites
smallballz 0 Posted October 7, 2010 Author Report Share Posted October 7, 2010 thank you guys @Praney : i am trying to save the current/active item during the loop, not the whole list @irobot : #current_item starts with the second list item with $next_list_item #current_item starts stores the second list item as first item because $next_list_item is already begin used once in the loop? can i do something like $next_list_item minus 1? Set variable Variable: #current_item Content: $next list item (minus 1) Quote Link to post Share on other sites
IRobot 43 Posted October 7, 2010 Report Share Posted October 7, 2010 #current_item starts stores the second list item as first item because $next_list_item is already begin used once in the loop? Use the set variable just after the $list total, so that the variable #current_item can be used in both places. Quote Link to post Share on other sites
JohnB 255 Posted October 7, 2010 Report Share Posted October 7, 2010 I would solve this by using the set command outside the loop as such: Set #listposition = 0 Instead of using $Next List Item I would use $List Item with the position set to #listposition. At the end of your loop (inside the loop) use inc--->#listposition What it all means is your #listposition variable increments by one with every cycle of the loop. Under this format, it will grab position 0 as well. HTH. John 1 Quote Link to post Share on other sites
smallballz 0 Posted October 7, 2010 Author Report Share Posted October 7, 2010 cool! that's what i was looking for, make perfect sense now. thank you !!! Quote Link to post Share on other sites
Super Dave 26 Posted October 15, 2010 Report Share Posted October 15, 2010 #current_item starts stores the second list item as first item because $next_list_item is already begin used once in the loop? The reason why your items were one digit off is because list ITEM #s start at 0, while list POSITIONS start at 1. 1. [0] First 2. [1] Second 3. [2] Third To store the VALUE of the current POSITION you have to take an ITEM that's one LESS than the current POSITION number:http://imgur.com/OcNEt.jpg 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.