Page 1 of 1

Scripting errors (not Kitely's, mine)

Posted: Thu Aug 19, 2021 2:53 pm
by Michael Timeless
I am not a scripter. However, I've tried to create one to change a black and White image to a color image when any avatar comes within 3 meters of the image. So, far, I've had little luck and I'm not quite sure where I'm screwing it up.

The script and the two images are in the object, "BW Image" and "Color Image." The BW image is the default the color comes "alive" as someone approaches. Naming them didn't work so I went back to a generic "Inventory_Texture" calling llGetInventoryName for the choice and then setting it with llSetTexture But still erroring out. Here is what I have so far.

integer number;
string name;
integer choice = 0;

default
{
touch_start(integer total_number)
{
llSensor("", NULL_KEY, AGENT, 3.0, PI/2);
}

sensor( integer detected )
{
while(detected--)
{
number = llGetInventoryNumber(INVENTORY_TEXTURE);
}
{
if (choice < number)
{
name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
choice = choice + 1;
}
else
{
name = llGetInventoryName

(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
choice = 0;
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}
}

Currently this results in a syntax error at line 35 where the image is "changed." Not sure if this should just be "changed inventory" or not.

Any suggestions welcome.

Re: Scripting errors (not Kitely's, mine)

Posted: Thu Aug 19, 2021 3:26 pm
by Ilan Tochner
Hi Michael,

The lack of indentation in your code makes it very hard to read it. Please use the "</>" button I. The forums editor and.copy.paste your code I to the code block with its original indentation. Also, as we can't tell what line 35 is without counting please quote the exact error message you're getting.

Re: Scripting errors (not Kitely's, mine)

Posted: Thu Aug 19, 2021 4:08 pm
by Michael Timeless
Ilan
Thanks for the quick response to my mess. Tess Juel came to the rescue and was able to sort it all out. She is going to post the entire script because it may be helpful to others as well. I always enjoy the helpful hands that everyone here extends when help is needed. Thanks Tess and Ilan.

Mike

Re: Scripting errors (not Kitely's, mine)

Posted: Thu Aug 19, 2021 4:58 pm
by Tess Juel
Michael Timeless wrote:
Thu Aug 19, 2021 4:08 pm
She is going to post the entire script because it may be helpful to others as well.
And here it is