From fb8faa8336ddb795ccd6840259b06a2608350a57 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 12 Jan 2009 18:00:46 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2913 * Add the KanEd scripts to the standard library * Thanks Fly-Man- --- bin/assets/ScriptsAssetSet/KanEd-Test11.lsl | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 bin/assets/ScriptsAssetSet/KanEd-Test11.lsl (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test11.lsl') 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 @@ +integer dialog_channel= 427; // set a dialog channel +list menu = [ "Go up", "Go down" ]; +vector startPosition; +float groundLevel; + +default +{ + state_entry() + { + // arrange to listen for dialog answers (from multiple users) + llListen( dialog_channel, "", NULL_KEY, ""); + + startPosition = llGetPos(); + groundLevel = llGround( startPosition ); + } + + touch_start(integer total_number) + { + llDialog( llDetectedKey( 0 ), "What do you want to do?", menu, + dialog_channel ); + } + + listen(integer channel, string name, key id, string choice ) + { + vector position = llGetPos(); + + // if a valid choice was made, implement that choice if possible. + // (llListFindList returns -1 if choice is not in the menu list.) + if ( llListFindList( menu, [ choice ]) != -1 ) + { + if ( choice == "Go up" ) + { + if( position.z < ( startPosition.z + 10.0 ) ) + { + llSetPos( llGetPos() + < 0, 0, 1.0 > ); // move up + } + } + else if( choice == "Go down" ) + { + if( position.z > ( groundLevel + 1.0 ) ) + { + llSetPos( llGetPos() + < 0, 0, -1.0 > ); // move down + } + } + } + else + { + llSay( 0, "Invalid choice: " + choice ); + } + } +} + -- cgit v1.1