Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

for loop question

Gwylym Loon
Registered User
Join date: 6 Jun 2007
Posts: 81
07-08-2009 08:49
I want to increment a loop by more than one. Am parsing through a list that has more than one element per set.

When I do something similar to the following the counter never increments. It stays at 0.

list blah=["1","a","2","b","3","c"];

default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
llSay(0, "Touched.";);
integer i;
for (i=0; i<=llGetListLength(blah)-1; i+2) {
llOwnerSay(llList2String(blah,i)+":"+(string)i);
}

}
}


Can the counter be incremented by more than just 1?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
07-08-2009 08:53
From: Gwylym Loon
I want to increment a loop by more than one. Am parsing through a list that has more than one element per set.

When I do something similar to the following the counter never increments. It stays at 0.


You want "i = i + 2" or "i += 2" in the third part of the for loop. It has to be a complete statement that increments the variable, not just an expression that contains a new value for the variable.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore