Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

~~ Timer failing to work ~~

Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
10-28-2007 22:55
This is the first time I have made a call to llSetTimerEvent() that has failed. The script below is missing the global texture keys due to I do not wish to share them publicly, but they are valid ((that is what the list named "master" is))

My problem comes in the listen or the timer if statement.
When I click on "Random" from he llDialog, it recognizes it in the listen, but does nothing in the timer (if I put a llSay() in the listen it sets it off). I click on something else in the menu, and it works like it should (setting off the "else" statement) saying "!".
The script will not say "." or do the commands it's programmed to.
Switch is of the correct number.

Any Ideas on problems? I even changed the if statement in the timer to reflect something totally different, but it still failed to fire.




CODE

list men = ["5","Random","Off",".7","1","2",".1",".2",".5",".05"];
integer rr ;
float st;
list master = [b01,b1,b2,b3,b4,c1,c2,c3,c4,g1,g2,g3,g4,o1,o2,o3,o4,r1,r2,r3,r4,w1,w2,w3,w4,y1,y2,y3,y4];
// ----
integer switch;
default
{
on_rez(integer x)
{
llResetScript();
}
state_entry()
{
rr = (integer) llFrand(10000000) - 5000000;
switch = 1;
st = 0;
llSetTimerEvent(st);
llListenRemove(llListen(rr,"",NULL_KEY,"") );
llListen(rr,"",NULL_KEY,"");
llSetTexture(b01,1);
}

touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner() )
{
llDialog(llDetectedKey(0),"What would you like?",men,rr);
}
}
listen(integer chan,string name,key id, string mess)
{
if (mess == "Random")
{
switch = 2;
llSetTimerEvent(.5);
}
if (mess == "Off")
{

llResetScript();

}
else
{
switch = 1;
st = (float) mess;
llSetTimerEvent(st);
}
}

timer()
{
if (switch == 2)
{
llSay(0,".");
integer dd = (integer) llFrand(29) + 1;
llSetTexture(llList2Key(master,dd),1 );
}
else
{

llSay(0,"!");
}



}
}

Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
10-28-2007 23:02
This doesn't even work.
So that means the llSetTimerEvent(.5); is not firing in the listen. but HOW is that possable?
CODE

timer()
{

switch = 2;
if (switch == 2)
{
llSay(0,".");
integer dd = (integer) llFrand(29) + 1;
llSetTexture(llList2Key(master,dd),1 );
}
}
Nardok Corrimal
Registered User
Join date: 23 Jun 2006
Posts: 6
10-28-2007 23:38
if (mess == "Off";)

should be else if (mess == "Off";)

that will stop the second if() statement running, which is setting your timer to (float)mess seconds, which is 0