Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Map v7D_Enh_Landmark2Map  

v7D_Enh_Landmark2Map

Script (Fast Response Version)

Category: Map
By : Void Singer
Created: 2010-02-01 Edited: 2010-02-01
Worlds: Second Life

the Zip file

Download all files for v7D_Enh_Landmark2Map
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. v7D_Enh_Landmark2Map_1.lsl
Get file # 2. v7D_Enh_Landmark2Map_2.lsl
1 /*//( v7-D Enhanced Landmark Mapper v1.1f )//*/
2
3 /*//-- Requirements:
4 3 linked Prims (minimum)
5 1 Named "prev" (this will be your previous landmark button)
6 1 Named "next" (this will be your next landmark button)
7 any other prim in the object will trigger the map destination for the
8 currently displayed Landmark name. Recommended to rename landmarks.
9 //*/
10
11 integer gIdxTgt; /*//-- Index of Target --//*/
12 list gLstLMs; /*//-- List of Landmarks --//*/
13 list gLstLoc; /*//-- Listt of Locations--//*/
14
15 key gKeySec; /*//-- Key for Security checking dataserver calls --//*/
16 float gFltTmt = 5.0; /*//-- Float for Timeout (dataserver calls & inventory changes) --//*/
17
18 default{
20 llOwnerSay( "Rebuilding Database" );
22 /*//-- Gab Landmark Names For Display --//*/
23 if(gIdxTgt){
24 while(gIdxTgt){
25 gLstLMs = (list)llGetInventoryName( INVENTORY_LANDMARK, --gIdxTgt ) + gLstLMs;
26 }
27 /*//-- Get First LM Location --//*/
28 gKeySec = llRequestInventoryData( llList2String( gLstLMs, gIdxTgt = (gLstLMs != []) - 1 ) );
29 /*//-- (gLstLMs != []) == llGetListLength( gLstLMs ) --//*/
30 /*//-- negative indices would've been nice if they were supported by the Req.Inv.Data call --//*/
31 llSetTimerEvent( gFltTmt );
32 }
33 else{
34 gLstLMs = (list)"Out Of Order, No Landmarks Present";
35 gLstLoc = (list)<128.0, 128.0, 0.0>;
36 state sReady;
37 }
38 }
39
40 dataserver( key vKeySec, string vStrLoc ){
41 /*//-- verify we're getting our data, not another scripts --//*/
42 if(gKeySec == vKeySec){
43 /*//-- Store Location Vector --//*/
44 gLstLoc = (list)((vector)vStrLoc) + gLstLoc;
45 if(gIdxTgt){
46 /*//-- Get Next LM Location --//*/
47 gKeySec = llRequestInventoryData( llList2String( gLstLMs, --gIdxTgt ) );
48 llSetTimerEvent( gFltTmt );
49 }
50 else{
51 /*//-- Clear Timeout Because Timers Cross States --//*/
52 llSetTimerEvent( 0.0 );
53 state sReady;
54 }
55 }
56 }
57
58 timer(){
59 llOwnerSay( "Dataserver Response Timed Out, auto retry in " + (string)((integer)gFltTmt) + " seconds" );
60 llSleep( gFltTmt );
62 }
63
64 state_exit(){
65 /*//-- Set The Initial Display --//*/
66 llSetText( llList2String( gLstLMs, gIdxTgt ), <1.0, 0.0, 0.0>, 1.0 );
67 llOwnerSay( "Ready" );
68 }
69 }
70
71 state sReady{
72 touch_start( integer vInt ){
73 /*//-- Check if a prim named "prev" or "next" was touched --//*/
74 integer vIntTst = llSubStringIndex( "prevnext", llGetLinkName( llDetectedLinkNumber( 0 ) ) );
75 if(~vIntTst){
76 /*//-- Update Index Target --//*/
77 gIdxTgt += ((vIntTst > 0) - (vIntTst < 0));
78 /*//-- ((vIntTst > 0) - (vIntTst < 0)) same as: -1 for "prev", +1 for "next" --//*/
79
80 /*//-- Update Display --//*/
81 llSetText( llList2String( gLstLMs, (gIdxTgt %= (gLstLMs != [])) ), <0.0, 1.0, 0.0>, 1.0 );
82 /*//-- (gLstLMs != []) == llGetListLength( gLstLMs ) --//*/
83 /*//-- "gInCnt %= " allows us to wrap our references so they don't go out of range --//*/
84 }
85 else{
86 /*//-- Trigger map for any other touched prim in this object --//*/
88 }
89 }
90
91 changed( integer vBitChg ){
92 if(vBitChg & CHANGED_INVENTORY){
93 /*//-- give the user more time to add new LMs before we recompile our database lists. --//*/
94 /*//-- We could check the count too, but don't in case the change was a change of name --//*/
95 llSetTimerEvent( gFltTmt );
96 }
97 }
98
99 timer(){
101 }
102 }
103
104 /*//-- License Text --//*/
105 /*// Free to copy, use, modify, distribute, or sell, with attribution. //*/
106 /*// (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/
107 /*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
108 /*// All usages must contain a plain text copy of the previous 2 lines. //*/
109 /*//-- --//*/

v7D_Enh_Landmark2Map

Script (Small Code Version)

Category: Map
By : Void Singer
Created: 2010-02-01 Edited: 2010-02-01
Worlds: Second Life

1 /*//( v7-D Enhanced Landmark Mapper v1.1s )//*/
2
3 /*//-- Requirements:
4 3 linked Prims (minimum)
5 1 Named "prev" (this will be your previous landmark button)
6 1 Named "next" (this will be your next landmark button)
7 any other prim in the object will trigger the map destination for the
8 currently displayed Landmark name. Recommended to rename landmarks.
9 //*/
10
11 integer gIdxTgt; /*//-- Index of Target LM --//*/
12 string gStrLMN; /*//-- String of Landmark Name --//*/
13 vector gPosLoc; /*//-- Position of Location --//*/
14 key gKeySec; /*//-- Key for Security checking dataserver calls --//*/
15
16 uUpdateLM( integer vIntCng ){
18 if(vIntCnt){
19 gIdxTgt = gIdxTgt = (vIntCnt + (gIdxTgt + vIntCng)) % vIntCnt;
20 /*//-- " + vIntCnt" correct for positive index needed by Req.Inv.Dat. --//*/
21 /*//-- " % vIntCnt" range limit for current LM count --//*/
22 gStrLMN = llGetInventoryName( INVENTORY_LANDMARK, gIdxTgt *= (gIdxTgt >= 0) );
23 /*//-- (gIdxTgt >= 0) to protect against mass deletions of LMs enabling negative indices --//*/
24 gKeySec = llRequestInventoryData( gStrLMN );
25 llSetTimerEvent( 5.0 );
26 }
27 else{
28 /*//-- Uh Oh, set a default of current sim, center, ground level --//*/
29 llSetText( "Out Of Order, No Landmarks Present", <1.0, 0.0, 0.0>, 1.0 );
30 gPosLoc = <128.0, 128.0, 0.0>;
31 }
32 }
33
34 default{
36 uUpdateLM( 0 );
37 }
38
39 dataserver( key vKeySec, string vStrLoc ){
40 /*//-- verify we're getting our data, not another scripts --//*/
41 if(gKeySec == vKeySec){
42 /*//-- Clear the timeout --//*/
43 llSetTimerEvent( 0.0 );
44 /*//-- Store/Display New Target --//*/
45 gPosLoc = (vector)vStrLoc;
46 llSetText( gStrLMN, <1.0, 0.0, 0.0>, 1.0 );
47 }
48 }
49
50 touch_start( integer vInt ){
51 /*//-- Check if a prim named "prev" or "next" was touched --//*/
52 integer vIntTst = llSubStringIndex( "prevnext", llGetLinkName( llDetectedLinkNumber( 0 ) ) );
53 if(~vIntTst){
54 uUpdateLM( (vIntTst > 0) - (vIntTst == 0) );
55 }
56 else{
57 /*//-- Trigger map for any other touched prim in this object --//*/
59 }
60 }
61
62 timer(){
63 llOwnerSay( "Dataserver Response Timed Out. Unable To Change Destination; Try Again In A Moment" );
64 /*//-- Clear the key so we don't update when it might interfere with a user --//*/
65 gKeySec = "";
66 }
67 }
68
69 /*//-- License Text --//*/
70 /*// Free to copy, use, modify, distribute, or sell, with attribution. //*/
71 /*// (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/
72 /*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
73 /*// All usages must contain a plain text copy of the previous 2 lines. //*/
74 /*//--

Back to the Best Free Tools in Second Life and OpenSim.