Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple sequence of events....

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-10-2006 09:10
Hi all...

I wish to have a simple sequence of events happen...

Imagine a jack-in-the-box...


Starting the sequence causes a music file to play...

-and- causes the crank to turn.

when the crank has finished turning n-times...
the lid opens.

when the lid is done opening... the jack in the box comes out.

then the music finishes.


I assume that this requires a few scripts located in a few linked objects... yes?


Could some kind soul please show what this structure would look like in LSL?

Please... keep in mind that I'm not a code newbie... but I am a TOTAL LSL newbie... a syntactically correct example would be fantastic...

Many thanks to anyone who can help.

Ryder
Oodlemi Noodle
Frizzle Fry
Join date: 8 Feb 2006
Posts: 179
05-10-2006 09:19
me too. and make it interesting cux everytime i try to learn to script i get bored out of my mind
Starax Statosky
Unregistered User
Join date: 23 Dec 2003
Posts: 1,099
Taking a dump V1.0
05-10-2006 14:22
This poo script should help:



default
{
state_entry()
{
llSay(0,"I'm walking upstairs..";);
llSetTimerEvent(8);
}


timer()
{
state Phase2;
}



}


state Phase2
{
state_entry()
{
llSay(0,"I'm entering the bathroom";);
llSetTimerEvent(3);
}


timer()
{
state Phase3;
}


}



state Phase3
{
state_entry()
{
llSay(0,"I'm pulling my pants down";);
llSetTimerEvent(2);
}


timer()
{
state Phase4;
}


}



state Phase4
{
state_entry()
{
llSay(0,"I'm sitting on the toilet";);
llSetTimerEvent(2);
}


timer()
{
state Phase5;
}


}


state Phase5
{
state_entry()
{
llSay(0,"I'm having a poo...";);
llSetTimerEvent(12);
}


timer()
{
state Phase6;
}


}



state Phase6
{
state_entry()
{
llSay(0,"I'm wiping my bum...";);
llSetTimerEvent(3);
}


timer()
{
state Phase7;
}


}



state Phase7
{
state_entry()
{
llSay(0,"I'm flushing the toilet.";);
llSetTimerEvent(3);
}


timer()
{
state Phase8;
}


}



state Phase8
{
state_entry()
{
llSay(0,"I'm pulling my pants up.";);
llSetTimerEvent(2);
}


timer()
{
state Phase9;
}


}



state Phase9
{
state_entry()
{
llSay(0,"I'm putting the toilet seat up, just to annoy my partner.";);
llSetTimerEvent(2);
}


timer()
{
state Phase10;
}


}




state Phase10
{
state_entry()
{
llSay(0,"I'm leaving the bathroom.";);
llSetTimerEvent(4);
}


timer()
{
state Phase11;
}


}



state Phase11
{
state_entry()
{
llSay(0,"I'm going back downstairs...";);
llSetTimerEvent(5);
}


timer()
{
state Phase12;
}


}




state Phase12
{
state_entry()
{
llSay(0,"All done!!.";);
}


}
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
Thx
05-10-2006 19:12
I appreciate the poo script! (could come in handy :-)

So, instead of the llSay command... what command would I use, for example, to move an object up?

thx
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-10-2006 19:19
llSetPos

You should have a look at the wiki. There's tons of useful information on it.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-10-2006 19:26
Yea... looking there now... have been... for about a half hour. Nothing yet on how to use it. Getting error messages...
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-10-2006 19:28
Try "llSetPos( llGetPos() + <0,0,3> );"

That will cause the object to move up 3 meters. It sets the position to the current position, plus a vector, which is +3 on the z axis.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-10-2006 21:11
Cool... now... how do I test *part* of a vector?

for ( i = 1, llGetPos() ***z axis of vector*** > 100, i++ )


Thx
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
05-10-2006 23:17
http://secondlife.com/badgeo/wakka.php?wakka=vector

and maybe

http://secondlife.com/badgeo/wakka.php?wakka=LSLTutorials

But to answer your question directly (although it in in the first link too).

vector pos=llGetPos();
pos.z

is the way you address one part of the vector (the others being pos.x and pos.y, and for rotations, rot.s is the final element).

I'm not sure what your for loop is trying to do, but I suspect it won't work at all... which is why I included the link to the tutorials.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-11-2006 12:26
Thanks...

the test should work... it's just to see if the z vector is > 100 meters... running an elevator using a for statement, and it needs to know when to stop :-)

-Ryder-