Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I fail at triggering a timed event with a listener. :(

Nuala Shippe
Registered User
Join date: 19 Jun 2008
Posts: 8
01-26-2009 11:05
This is what I have, and it's telling me I have a syntax error where "timer()" starts.

key owner;

default
{
on_rez(integer params){llResetScript();}

state_entry()
{
owner = llGetOwner();
llListen(1,"",owner,"";);
llSetTimerEvent(0.0);
llSetAlpha(0,1);
}

listen(integer channel,string name, key id, string msg)
{


if(channel==1 && llToLower(msg)=="shy";)
{
llSetAlpha(0.5,1);
llSetTimerEvent(15.0);
timer(){
llSetAlpha(0.0,1);
llSetTimerEvent(0.0);
}
}


}
}



If you can see what the problem is, could you also please explain the problem to me? Thank you. :)
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Brackets
01-26-2009 11:25
Like this:

CODE

listen(integer channel,string name, key id, string msg)
{
if(channel==1 && llToLower(msg)=="shy")
{
llSetAlpha(0.5,1);
llSetTimerEvent(15.0);
}
}

timer()
{
llSetAlpha(0.0,1);
llSetTimerEvent(0.0);
}
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-26-2009 11:26
edit: lol, ron was faster, but there ya go
that's because you have a timer event inside of a listen event. they are 2 different things
it should be more like:
CODE

key owner;

default
{
on_rez(integer params){llResetScript();}

state_entry()
{
owner = llGetOwner();
llListen(1,"",owner,"");
llSetTimerEvent(0.0);
llSetAlpha(0,1);
}

listen(integer channel,string name, key id, string msg)
{
if(channel==1 && llToLower(msg)=="shy")
{
llSetAlpha(0.5,1);
llSetTimerEvent(15.0);
}
}

timer()
{
llSetAlpha(0.0,1);
llSetTimerEvent(0.0);
}
}
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-26-2009 11:29
alternatively, if you're only listening for the word "shy"
CODE

key owner;

default
{
on_rez(integer params){llResetScript();}

state_entry()
{
owner = llGetOwner();
llListen(1,"",owner,"shy");//tell the listen to only listen for the word "shy" from the owner
llSetTimerEvent(0.0);
llSetAlpha(0,1);
}

listen(integer channel,string name, key id, string msg)
{
llSetAlpha(0.5,1);
llSetTimerEvent(15.0);
}

timer()
{
llSetAlpha(0.0,1);
llSetTimerEvent(0.0);
}
}
Nuala Shippe
Registered User
Join date: 19 Jun 2008
Posts: 8
01-26-2009 11:46
:D Thank you both so, so much!