Scripting errors (not Kitely's, mine)

Creating scripts
Post Reply
User avatar
Michael Timeless
Posts: 113
Joined: Thu Sep 24, 2015 5:13 am
Location: Crestwood, Illinois
Has thanked: 393 times
Been thanked: 153 times
Contact:

Scripting errors (not Kitely's, mine)

Post 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.
These users thanked the author Michael Timeless for the post:
Ilan Tochner
User avatar
Ilan Tochner
Posts: 6515
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4960 times
Been thanked: 4468 times
Contact:

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

Post 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.
These users thanked the author Ilan Tochner for the post:
Michael Timeless
User avatar
Michael Timeless
Posts: 113
Joined: Thu Sep 24, 2015 5:13 am
Location: Crestwood, Illinois
Has thanked: 393 times
Been thanked: 153 times
Contact:

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

Post 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
User avatar
Tess Juel
Posts: 272
Joined: Sun Sep 11, 2016 4:24 pm
Has thanked: 252 times
Been thanked: 440 times

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

Post 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
These users thanked the author Tess Juel for the post (total 2):
Ilan TochnerMichael Timeless
Post Reply