aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-12 18:00:46 +0000
committerJustin Clarke Casey2009-01-12 18:00:46 +0000
commitfb8faa8336ddb795ccd6840259b06a2608350a57 (patch)
tree1f4977b9918d416602af88709e15aecf9499b969 /bin/assets/ScriptsAssetSet/KanEd-Test11.lsl
parent* Remove FunSLUDP code since this has moved to http://forge.opensimulator.org... (diff)
downloadopensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.zip
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.gz
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.bz2
opensim-SC-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2913
* Add the KanEd scripts to the standard library * Thanks Fly-Man-
Diffstat (limited to '')
-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