aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test11.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test11.lsl52
1 files changed, 52 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl
new file mode 100644
index 0000000..e4b4048
--- /dev/null
+++ b/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl
@@ -0,0 +1,52 @@
1integer dialog_channel= 427; // set a dialog channel
2list menu = [ "Go up", "Go down" ];
3vector startPosition;
4float groundLevel;
5
6default
7{
8 state_entry()
9 {
10 // arrange to listen for dialog answers (from multiple users)
11 llListen( dialog_channel, "", NULL_KEY, "");
12
13 startPosition = llGetPos();
14 groundLevel = llGround( startPosition );
15 }
16
17 touch_start(integer total_number)
18 {
19 llDialog( llDetectedKey( 0 ), "What do you want to do?", menu,
20 dialog_channel );
21 }
22
23 listen(integer channel, string name, key id, string choice )
24 {
25 vector position = llGetPos();
26
27 // if a valid choice was made, implement that choice if possible.
28 // (llListFindList returns -1 if choice is not in the menu list.)
29 if ( llListFindList( menu, [ choice ]) != -1 )
30 {
31 if ( choice == "Go up" )
32 {
33 if( position.z < ( startPosition.z + 10.0 ) )
34 {
35 llSetPos( llGetPos() + < 0, 0, 1.0 > ); // move up
36 }
37 }
38 else if( choice == "Go down" )
39 {
40 if( position.z > ( groundLevel + 1.0 ) )
41 {
42 llSetPos( llGetPos() + < 0, 0, -1.0 > ); // move down
43 }
44 }
45 }
46 else
47 {
48 llSay( 0, "Invalid choice: " + choice );
49 }
50 }
51}
52