Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can one increment the index integer of llList2Vector?

Derin Swenson
Registered User
Join date: 10 May 2006
Posts: 25
09-14-2006 11:04
here is the snippet of code I wanted to do to increment down a list outputing it in a llList2Vector function....but I can't seem to increment the index integer in the function...or the synatax is off and I can't think of the correct way to do it.


CODE

for (y = 1; y <= yloop; y++)
{
integer yl2v = 0;
vector temppos = llList2Vector(yvectors, 0 + yl2v);
yl2v++;
}
Rich Cordeaux
Registered User
Join date: 8 May 2006
Posts: 26
09-14-2006 11:21
You're declaring and initializing yl2v *inside* the loop, that's why. So it's set to 0, you read the list index, you increase it by 1, and then it's set back to 0.

Move the integer yl2v = 0; line before the for statement and it will work.

Also, why on earth do you have '0+yl2v'?

And there's no need of what you're doing with the extra variable, basically.

This does the same thing, more simply:
CODE

for (y = 0; y < yloop; y++)
{
vector temppos = llList2Vector(yvectors, y);
}
Derin Swenson
Registered User
Join date: 10 May 2006
Posts: 25
09-14-2006 11:27
ahhh hehe there is need for what I'm doing but I guess I did it in a a very noobish way, this is my first attempt at playing with vectors and loops at that lol.....thank you I actually knew not to declare variables in loops lol.....lets just chalk it up to temp insanity.....thanks for pointint it out to me

I originally had the function using the loop variable...yeah like that but it didn't work for me hrmmm ok let me try it out if not I will declare the variable outside of the loop, as an intellegent person would have done in the first place.. Thanks again for helping out a new scripter
Derin Swenson
Registered User
Join date: 10 May 2006
Posts: 25
09-14-2006 11:37
OH and I do need the extra yl2v variable because the y variable needs to start at 1 to work well with the other loops and math of the script. ANd as we all know the index of a script starts at 0. I knew there was a reason why I used an extra variable lol.

Thanks for the help, again it worked :).
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
09-14-2006 19:01
From: Derin Swenson
OH and I do need the extra yl2v variable because the y variable needs to start at 1 to work well with the other loops and math of the script. ANd as we all know the index of a script starts at 0. I knew there was a reason why I used an extra variable lol.
Then you can probably do it this way, depending on what else needs to be done :)
CODE
for (y = 1; y <= yloop; y++)
{
vector temppos = llList2Vector(yvectors, y - 1);
}
_____________________
Derin Swenson
Registered User
Join date: 10 May 2006
Posts: 25
09-14-2006 19:03
awesome lol simple, I'm just not used to coding I guess...thanks :) this helped me out immensely