Scripting errors (not Kitely's, mine)
Posted: Thu Aug 19, 2021 2:53 pm
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.
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.