Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

collision controled crash

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-15-2007 18:38
CODE

integer crashed;

default
{
state_entry()
{
crashed = FALSE;
}
link_message(integer from, integer int, string message, key id)
{
if(message = "start")
{
crashed = TRUE;
}
else if(message = "stop")
{
crashed = FALSE;
}
}
collision(integer num)
{
if(crashed == FALSE)
{
llSay(0,"no crash");
}
else if(crashed == TRUE)
{
llSay(0,"crashed");
}
}
}


it somewhat works, what it is saposed to do is, if the integer is set to true anytime something hits that prim it will say crash and when the integer is set to false it will say no crash, it is controled by a message from another script i have integer starts out as false i hit the prim it says no crash, i get it set to true it says crashed like it should but for some reason it refuses to go back to false and keeps saying crashed, any idea what is wrong?
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-15-2007 19:40
From: Stephen Zenith


/54/ef/223660/1.html

x = y is an assignment. If you want to do a comparison, use x == y. e.g.

if((message == "start";) & (started == FALSE))



Regardless of anything else that may be happening, Mrc, it appears that the same comparison problem that Stephen pointed out in your earlier thread has creeped in here too. :)

if(message = "start";)
else if(message = "stop";)

Perhaps that is the source of the prob
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
11-15-2007 23:23
To avoid such comparison problems I suggest to do the comparison the other way round...

if ("whatever" == Message)

Because you cannot assign a value to a string but can to a variable.

So

if ("whatever" = Message)

WILL give you an error when you try to compile it.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-16-2007 02:47
it worked

damit lol, i swear lsl hates me