Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Stack-Heap Collision problem

Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
10-25-2006 23:25
ok, trying to script a simple touch activated light and it works, but only once.
imeddiatey following the first click of the switch,it throwsa Stack-Heap Collision Error
script below, any help appreciated
CODE

vector color = <1.0, 1.0, 1.0>;
float intensity = 1.0;
float radius = 10.0;
float falloff = 0.0;
integer channel = 1232;

// do not edit below this line
toggleLight()
{
if (llGetPrimitiveParams([PRIM_FULLBRIGHT, 0]))
{
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
llSetPrimitiveParams([PRIM_POINT_LIGHT, 1, color, intensity, radius, falloff]);

}
else
{
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
llSetPrimitiveParams([PRIM_POINT_LIGHT, 0, color, intensity, radius, falloff]);

}

}
default
{
state_entry()
{
llListen(channel, "", NULL_KEY, "" );
}
listen(integer a, string n, key id, string m)
{
if ((m == "Touched"))
{
toggleLight();
}
}
}
Ohforf Uram
n00b
Join date: 27 Jun 2006
Posts: 82
10-26-2006 00:56
hint : llGetPrimitiveParams returns a list...
_____________________
Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
10-26-2006 01:29
hehe, yeah, hadn't noticed that in the wiki at first....
finally figured it out and used PRIM_POINT_LIGHT (since it actually returns a true/false) and then check the value of the first index
thanks though