Join us in Phaze Demesnes or follow us:

Home   Show All
Category: Contributor: Creator
Building Set_and_Move  

Set_and_Move

Set and Move.lsl

Category: Building
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life + OpenSim

the Zip file

Download all files for Set_and_Move
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Set_and_Move_1.lsl
1
2 integer lkey;
3
4 init()
5 {
6 llOwnerSay ( "Touch the object and set to store its current position" );
7 llOwnerSay ( "choose 'move 2' to return to its stored position" );
8 llOwnerSay ( "rm script to remove the script from the object" );
9 llOwnerSay ( "Position is stored in object desc if you want to change it manually" );
10 }
11
12 default
13 {
15 {
16 init();
17 }
18 on_rez( integer param )
19 {
20 init();
21 }
22
23 touch_start(integer total_number)
24 {
25 if ( llDetectedKey(0) == llGetOwner() )
26 {
27 lkey = llListen( 8192, "",llGetOwner(),"" );
28 llSetTimerEvent( 60 );
29 llDialog( llGetOwner(), "Object Options:",
30 [ "set pos", "move 2 pos", "rm script" ],8192);
31 }
32 }
33 listen ( integer ch, string nm, key id, string message )
34 {
35 llListenRemove( lkey );
36 if ( message == "set pos" )
37 {
39 llOwnerSay ( "Position stored as " + llGetObjectDesc() );
40 }
41 if ( message == "move 2 pos" )
42 {
44 do {
45 llSetPos( pos ) ;
46 } while ( llVecDist( llGetRootPosition(), pos ) > 0.01 );
47 llOwnerSay ( "Object moved to " + (string)pos );
48 }
49 if ( message == "rm script" )
50 {
52 }
53 }
54 timer()
55 {
56 llListenRemove( lkey );
57 llSetTimerEvent( 0 );
58 }
59 }
60 // END //