Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help whit on_rez. Syntax error

Snake Ornitz
Basic builder/scripter
Join date: 26 Oct 2005
Posts: 7
05-06-2006 13:27
i wana make so when ive rezzing a prim whit this script in it it shall say "Starting..." here is the code: there is something wrong on the line whit the on_rez
CODE

key owner; //Made by Snake Ornitz. Testing how prims can take and send commands.

default
{
state_entry()
{
on_rez(integer start_param)
owner=llGetOwner();
llListen(0,"",owner,"");
}
listen(integer channel, string name, key id, string message)
{
if(message=="Die")
{
llDie();
} else
if(message=="Colorb")
{
llSetColor(<0.0, 0.0, 1.0>, ALL_SIDES);
} else
if(message=="Colorr")
{
llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
} else
if(message=="Colorg")
{
llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES);
}
if (start_param !=0)
{
llWhisper("Starting up..");
}
}
}
Yeti Freeloader
Registered User
Join date: 6 Dec 2005
Posts: 13
05-06-2006 13:32
on_rez is an event just like state_entry or listen, so make sure it's not in another event.
Snake Ornitz
Basic builder/scripter
Join date: 26 Oct 2005
Posts: 7
05-06-2006 13:47
But now ive getting syntax error on that line ill writen the on_rez:
CODE

key owner; //Made by Snake Ornitz. Testing how prims can take and send commands.

default
{
state_entry()
{
owner=llGetOwner();
llListen(0,"",owner,"");
}
listen(integer channel, string name, key id, string message)
{
if(message=="Die")
{
llDie();
} else
if(message=="Colorb")
{
llSetColor(<0.0, 0.0, 1.0>, ALL_SIDES);
} else
if(message=="Colorr")
{
llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
} else
if(message=="Colorg")
{
llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES);
}
on_rez(integer start_param);
{
if (start_param !=0)
{
llWhisper("Starting up..");
}
}
Yeti Freeloader
Registered User
Join date: 6 Dec 2005
Posts: 13
05-06-2006 14:02
ok first remove the semi-colon from the event declaration. And you are missing a couple of closing curly-braces. Also the brace issue, it's much easier to notice them when you use consistant even blocking like so . . . (the syntax errors should be fixed also, though can't get into game to test)

CODE
key owner; //Made by Snake Ornitz. Testing how prims can take and send commands.

default
{
state_entry()
{
owner=llGetOwner();
llListen(0,"",owner,"");
}

listen(integer channel, string name, key id, string message)
{
if(message=="Die")
{
llDie();
}
else if(message=="Colorb")
{
llSetColor(<0.0, 0.0, 1.0>, ALL_SIDES);
}
else if(message=="Colorr")
{
llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
}
else if(message=="Colorg")
{
llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES);
}
}

on_rez(integer start_param)
{
if (start_param !=0)
{
llWhisper("Starting up..");
}
}
}