Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

If statement

Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
05-22-2007 05:59
I know this is elementary but I don't seem to get it. I want an if statement that activates when the object description is empty:

Something like this:
touch_start(integer num)
{
saved_start_param = ((integer)llGetObjectDesc());// constant is set

if((string) saved_start_param == "0";);
{

llSetObjectDesc("Rubbish";);

}
}
Pip Helios
Registered User
Join date: 29 Sep 2006
Posts: 22
05-22-2007 06:20
From: Tarak Voss
I know this is elementary but I don't seem to get it. I want an if statement that activates when the object description is empty:

Something like this:
touch_start(integer num)
{
saved_start_param = ((integer)llGetObjectDesc());// constant is set

if((string) saved_start_param == "0";);
{

llSetObjectDesc("Rubbish";);

}
}

You're turning a string into a integer and then into a string agian? Try....
if(llGetObjectDesc()== "";)

also might want to read up more on typecasting, cool to see you use it but make sure you get it right, number one syntax I get is forgetting to typecast.
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
05-22-2007 06:36
Thanks - I'll take your advice :)
Kidd Krasner
Registered User
Join date: 1 Jan 2007
Posts: 1,938
05-22-2007 08:26
From: Tarak Voss

CODE

touch_start(integer num)
{
saved_start_param = ((integer)llGetObjectDesc());// constant is set

if((string) saved_start_param == "0");
{

llSetObjectDesc("Rubbish");

}
}


The semicolon on the same line as the if is incorrect, remove it. This is in addition to the previous comment about unnecessary typecasting.