corrade-lsl-templates – Diff between revs 29 and 37
?pathlinks?
Rev 29 | Rev 37 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /////////////////////////////////////////////////////////////////////////// |
1 | /////////////////////////////////////////////////////////////////////////// |
|
2 | // Copyright (C) Wizardry and Steamworks 2014 - License: CC BY 2.0 // |
2 | // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
|
3 | /////////////////////////////////////////////////////////////////////////// |
3 | /////////////////////////////////////////////////////////////////////////// |
|
4 | // |
4 | // |
|
5 | // This is an automatic grid follower for the Corrade Second Life / OpenSim |
5 | // This is an automatic grid follower for the Corrade Second Life / OpenSim |
|
6 | // bot. You can find more details about the bot by following the URL: |
6 | // bot. You can find more details about the bot by following the URL: |
|
7 | // http://was.fm/secondlife/scripted_agents/corrade |
7 | // http://was.fm/secondlife/scripted_agents/corrade |
|
8 | // |
8 | // |
|
9 | // The follower script works together with a "configuration" notecard and |
9 | // The follower script works together with a "configuration" notecard and |
|
10 | // that must be placed in the same primitive as this script. |
10 | // that must be placed in the same primitive as this script. |
|
11 | // You are free to use, change, and commercialize it under the CC BY 2.0 |
11 | // You are free to use, change, and commercialize it under the GNU/GPLv3 |
|
12 | // license at: https://creativecommons.org/licenses/by/2.0 |
12 | // license at: http://www.gnu.org/licenses/gpl.html |
|
13 | // |
13 | // |
|
14 | /////////////////////////////////////////////////////////////////////////// |
14 | /////////////////////////////////////////////////////////////////////////// |
|
Line 15... | Line 15... | |||
15 | |
15 | |
|
16 | /////////////////////////////////////////////////////////////////////////// |
16 | /////////////////////////////////////////////////////////////////////////// |
|
17 | // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
17 | // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
|
18 | /////////////////////////////////////////////////////////////////////////// |
18 | /////////////////////////////////////////////////////////////////////////// |
|
19 | string wasKeyValueGet(string k, string data) { |
19 | string wasKeyValueGet(string k, string data) { |
|
20 | if(llStringLength(data) == 0) return ""; |
20 | if(llStringLength(data) == 0) return ""; |
|
21 | if(llStringLength(k) == 0) return ""; |
21 | if(llStringLength(k) == 0) return ""; |
|
Line 24... | Line 24... | |||
24 | if(i != -1) return llList2String(a, i+1); |
24 | if(i != -1) return llList2String(a, i+1); |
|
25 | return ""; |
25 | return ""; |
|
26 | } |
26 | } |
|
Line 27... | Line 27... | |||
27 | |
27 | |
|
28 | /////////////////////////////////////////////////////////////////////////// |
28 | /////////////////////////////////////////////////////////////////////////// |
|
29 | // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
29 | // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
|
30 | /////////////////////////////////////////////////////////////////////////// |
30 | /////////////////////////////////////////////////////////////////////////// |
|
31 | string wasKeyValueEncode(list data) { |
31 | string wasKeyValueEncode(list data) { |
|
32 | list k = llList2ListStrided(data, 0, -1, 2); |
32 | list k = llList2ListStrided(data, 0, -1, 2); |
|
33 | list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); |
33 | list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); |
|
Line 39... | Line 39... | |||
39 | } while(llGetListLength(k) != 0); |
39 | } while(llGetListLength(k) != 0); |
|
40 | return llDumpList2String(data, "&"); |
40 | return llDumpList2String(data, "&"); |
|
41 | } |
41 | } |
|
Line 42... | Line 42... | |||
42 | |
42 | |
|
43 | /////////////////////////////////////////////////////////////////////////// |
43 | /////////////////////////////////////////////////////////////////////////// |
|
44 | // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
44 | // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
|
45 | /////////////////////////////////////////////////////////////////////////// |
45 | /////////////////////////////////////////////////////////////////////////// |
|
46 | vector wasCirclePoint(float radius) { |
46 | vector wasCirclePoint(float radius) { |
|
47 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
47 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
|
48 | float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
48 | float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
|
49 | if(llPow(x,2) + llPow(y,2) <= llPow(radius,2)) |
49 | if(llPow(x,2) + llPow(y,2) <= llPow(radius,2)) |
|
50 | return <x, y, 0>; |
50 | return <x, y, 0>; |
|
51 | return wasCirclePoint(radius); |
51 | return wasCirclePoint(radius); |
|
Line 52... | Line 52... | |||
52 | } |
52 | } |
|
53 | |
53 | |
|
54 | /////////////////////////////////////////////////////////////////////////// |
54 | /////////////////////////////////////////////////////////////////////////// |
|
55 | // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
55 | // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
|
56 | /////////////////////////////////////////////////////////////////////////// |
56 | /////////////////////////////////////////////////////////////////////////// |
|
57 | integer wasIsAvatarInSensorRange(key avatar) { |
57 | integer wasIsAvatarInSensorRange(key avatar) { |
|
58 | return llListFindList( |
58 | return llListFindList( |
|
Line 73... | Line 73... | |||
73 | ) |
73 | ) |
|
74 | ) <= 96; |
74 | ) <= 96; |
|
75 | } |
75 | } |
|
Line 76... | Line 76... | |||
76 | |
76 | |
|
77 | /////////////////////////////////////////////////////////////////////////// |
77 | /////////////////////////////////////////////////////////////////////////// |
|
78 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
78 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
79 | /////////////////////////////////////////////////////////////////////////// |
79 | /////////////////////////////////////////////////////////////////////////// |
|
80 | // escapes a string in conformance with RFC1738 |
80 | // escapes a string in conformance with RFC1738 |
|
81 | string wasURLEscape(string i) { |
81 | string wasURLEscape(string i) { |
|
82 | string o = ""; |
82 | string o = ""; |
|
Line 355... | Line 355... | |||
355 | if(!wasIsAvatarInSensorRange(CORRADE)) state on; |
355 | if(!wasIsAvatarInSensorRange(CORRADE)) state on; |
|
356 | // Corrade is in sensor range, so execute move. |
356 | // Corrade is in sensor range, so execute move. |
|
357 | llInstantMessage(CORRADE, |
357 | llInstantMessage(CORRADE, |
|
358 | wasKeyValueEncode( |
358 | wasKeyValueEncode( |
|
359 | [ |
359 | [ |
|
360 | "command", "autopilot", |
360 | "command", "walkto", |
|
361 | "group", wasURLEscape(GROUP), |
361 | "group", wasURLEscape(GROUP), |
|
362 | "password", wasURLEscape(PASSWORD), |
362 | "password", wasURLEscape(PASSWORD), |
|
363 | // move in a radius around the current primitive. |
363 | // move in a radius around the current primitive. |
|
364 | "position", llGetPos() + wasCirclePoint((integer)RANGE), |
364 | "position", llGetPos() + wasCirclePoint((integer)RANGE), |
|
- | 365 | "vicinity", 1, |
||
365 | "action", "start" |
366 | "timeout", 2500 |
|
366 | ] |
367 | ] |
|
367 | ) |
368 | ) |
|
368 | ); |
369 | ); |
|
369 | llSensorRepeat("", CORRADE, AGENT, (integer)RANGE, TWO_PI, 1); |
370 | llSensorRepeat("", CORRADE, AGENT, (integer)RANGE, TWO_PI, 1); |
|
370 | llRequestAgentData(CORRADE, DATA_ONLINE); |
371 | llRequestAgentData(CORRADE, DATA_ONLINE); |