Added files

This commit is contained in:
Fred Beckhusen
2015-12-12 16:58:38 -06:00
parent 767e53f17d
commit 1ec08494b4
191 changed files with 25371 additions and 47 deletions

View File

@@ -0,0 +1,23 @@
// :SHOW:1
// :CATEGORY:NPC
// :NAME:Hypergrid Story One
// :AUTHOR:Ferd Frederix
// :KEYWORDS:Game, Collider
// :CREATED:2015-11-24 20:36:34
// :EDITED:2015-11-24 19:36:34
// :ID:1089
// :NUM:1852
// :REV:3.0
// :WORLD:Opensim
// :DESCRIPTION:
// Sample NPC Card
// :CODE:
1,1,"@spawn=Namaka ♥|<127, 126, 23>|Namaka"
2,1,"@spawn=Dylan ♥|<127, 129, 23>|Dylan"
1,1,"@sit=dancerock"
2,2,"@sit=dancerock"
1,1,"@say=Hi, I am Namaka"
2,5,"@say=I am Dylan!... and now we leave"
1,1,"@delete"
2,1,"@delete"

View File

@@ -0,0 +1,145 @@
// :SHOW:1
// :CATEGORY:NPC
// :NAME:Hypergrid Story One
// :AUTHOR:Ferd Frederix
// :KEYWORDS:Game, Collider
// :CREATED:2015-11-24 20:36:34
// :EDITED:2015-11-24 19:36:34
// :ID:1089
// :NUM:1853
// :REV:3.0
// :WORLD:Opensim
// :DESCRIPTION:
// Sample NPC Card
// :CODE:
<llsd>
<map>
<key>serial</key>
<integer>0</integer>
<key>height</key>
<real>1.6691286563873291</real>
<key>wearables</key>
<array>
<array>
<map>
<key>item</key>
<uuid>0d67c6b9-90a6-4430-b124-5d3865253563</uuid>
<key>asset</key>
<uuid>501d4ff3-7669-4f2b-3de8-6077183b4314</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>3d56f323-beb2-4a4f-9b33-bedd01ef6d87</uuid>
<key>asset</key>
<uuid>9aa403be-7096-d638-d7b5-ab2739926664</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>3cc100b5-efb9-4357-84de-d53c763a9fe1</uuid>
<key>asset</key>
<uuid>9fe42dc9-32b9-863b-bbe3-2ed225aaa4dc</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>657b06b0-ec8b-4f13-8fcc-8cab56e76145</uuid>
<key>asset</key>
<uuid>2ba00144-a1c5-4c60-b70b-54f888d57104</uuid>
</map>
</array>
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array>
<map>
<key>item</key>
<uuid>f0d962ee-8899-4853-b643-5f1e8414f386</uuid>
<key>asset</key>
<uuid>9942fa1d-a7e6-0dee-2345-9b2449a137fb</uuid>
</map>
</array>
<array />
</array>
<key>textures</key>
<array>
<uuid>46697265-7374-6f72-6d00-000000000000</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>837d151d-b151-4f28-bd64-d64315dcd787</uuid>
<uuid>b74b9a80-b354-4a55-9a11-b04ddf9ad824</uuid>
<uuid>8e200c7a-6b01-43df-9196-1f9ad1df19b6</uuid>
<uuid>46a5b8b7-5f50-4799-8b0b-27f56cceb424</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c3632e30-d73b-4d09-a96e-2024652f9562</uuid>
</array>
<key>visualparams</key>
<binary encoding="base64">ADNV/wB/Hpk/AP//P3UBAJyEIEwAP0S8LIhRR316nv/L/wB/AAB/AAAAAAAAAAB6QnWEia1/AAAArABKAAAAAAAAAABehFWHAF4Asq0AAImZbVV/fw84AGTY1szMzDMZWUzMAIIAAMSLf+NjVAB/cn9/f4mHe0SMf10vT4JJoD8AAAAAf38AAAAAfwCfAAAAAEdJSTVxa3xwQgBTAFR6ANbMxgAAaJN/4v/G////////////zAD//////////////wD//////wCCf/8ZZP////9UAAAAMwD///8AABkAGRczABkXMwAAGQAZFzMAABkAGRczABkXMwAZFzMAfw==</binary>
<key>attachments</key>
<array>
<map>
<key>point</key>
<integer>17</integer>
<key>item</key>
<uuid>06817d22-cc5c-4964-83a5-da7f9917c3d3</uuid>
<key>asset</key>
<uuid>07f0840d-9dc5-4011-8524-15918532ba04</uuid>
</map>
<map>
<key>point</key>
<integer>29</integer>
<key>item</key>
<uuid>4d02b390-6aea-4c35-aae2-02c36034340d</uuid>
<key>asset</key>
<uuid>546bdf75-8b2a-4365-9724-ede209e5b694</uuid>
</map>
<map>
<key>point</key>
<integer>2</integer>
<key>item</key>
<uuid>17d0f3ce-76f7-429a-8d88-ecdf67014c1b</uuid>
<key>asset</key>
<uuid>3ca39d60-c6c5-40be-817d-cc60ecb60cdb</uuid>
</map>
<map>
<key>point</key>
<integer>23</integer>
<key>item</key>
<uuid>78959931-fcc8-40cf-a2b7-9bc694da2152</uuid>
<key>asset</key>
<uuid>895b3226-52df-4967-97cc-fc798799363f</uuid>
</map>
<map>
<key>point</key>
<integer>1</integer>
<key>item</key>
<uuid>7bdd00a1-1936-4638-b363-9bfba9d9e203</uuid>
<key>asset</key>
<uuid>94e3709f-e90b-4395-b94f-9c9940cba790</uuid>
</map>
</array>
</map>
</llsd>

View File

@@ -0,0 +1,111 @@
// :SHOW:1
// :CATEGORY:NPC
// :NAME:Hypergrid Story One
// :AUTHOR:Ferd Frederix
// :KEYWORDS:Game, Collider
// :CREATED:2015-11-24 20:36:34
// :EDITED:2015-11-24 19:36:34
// :ID:1089
// :NUM:1855
// :REV:3.0
// :WORLD:Opensim
// :DESCRIPTION:
// Sample NPC Card
// :CODE:
<llsd>
<map>
<key>serial</key>
<integer>0</integer>
<key>height</key>
<real>1.6885325908660889</real>
<key>wearables</key>
<array>
<array>
<map>
<key>item</key>
<uuid>98bc81c9-7ff5-40df-924f-9d17eac6ede0</uuid>
<key>asset</key>
<uuid>66c41e39-38f9-f75a-024e-585989bfab73</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>162d13a2-f3bb-42d2-910f-330b8eb7f902</uuid>
<key>asset</key>
<uuid>77c41e39-38f9-f75a-024e-585989bbabbb</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>bd8d42c6-f40f-4906-879c-aae4cfe5f33d</uuid>
<key>asset</key>
<uuid>d342e6c0-b9d2-11dc-95ff-0800200c9a66</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>436a7dea-3484-42b3-812b-7d307b353d4f</uuid>
<key>asset</key>
<uuid>4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>2afd4704-daae-4c78-8f7b-a79d7c1514d9</uuid>
<key>asset</key>
<uuid>00000000-38f9-1111-024e-222222111110</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>f937460d-207b-4e82-b6c0-7789afc0aebc</uuid>
<key>asset</key>
<uuid>00000000-38f9-1111-024e-222222111120</uuid>
</map>
</array>
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
</array>
<key>textures</key>
<array>
<uuid>46697265-7374-6f72-6d00-000000000000</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>84711871-c585-4be0-8ec5-0d8998769be0</uuid>
<uuid>cbd23982-104f-4719-9366-feda92ce5d12</uuid>
<uuid>47ec3452-f2f5-4d25-9b00-5b9a3867c1ab</uuid>
<uuid>9de5ef41-40a3-4997-a006-153188aecca7</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>9dfd63c3-f823-49ef-90dd-313fbd040ab6</uuid>
</array>
<key>visualparams</key>
<binary encoding="base64">IT1VFzp/P1U/KgBVPyRVX5k/IgA/bViEP4hRVWeIfwDLAAB/AAAAAAB/AAD/f3J/Yz9/jH9/AAAAvwBoAAAAAAAAAAAAkdiFAH8Af6oAAH9/bVV/fz9VKmTY1szMzDMZWUzMAH8AAJBVf4R/VQB/f39/f387f1V/f2ovT39/zAKNQgAAf38AAAAAfwCfAACyfyRVg39/f5lfAIxKG39/ANbMxgAAPx5/pdHGf3+ZzDMz////zAD//////////////wD//////wB/f/8ZZP////9UAAAAM4T///8AAAAAAAAzABkXMwAAAAAZFzMAAAAAGRczABkXMwAZFzMAfw==</binary>
<key>attachments</key>
<array />
</map>
</llsd>

View File

@@ -0,0 +1,129 @@
// :SHOW:1
// :CATEGORY:NPC
// :NAME:Hypergrid Story One
// :AUTHOR:Ferd Frederix
// :KEYWORDS:Game, Collider
// :CREATED:2015-11-24 20:36:34
// :EDITED:2015-11-24 19:36:34
// :ID:1089
// :NUM:1854
// :REV:3.0
// :WORLD:Opensim
// :DESCRIPTION:
// Sample NPC Card
// :CODE:
<llsd>
<map>
<key>serial</key>
<integer>0</integer>
<key>height</key>
<real>1.7412686347961426</real>
<key>wearables</key>
<array>
<array>
<map>
<key>item</key>
<uuid>44fc1681-6782-4053-87d8-435ebf69aca9</uuid>
<key>asset</key>
<uuid>1e6cec92-51dd-f06e-a96e-6e54fe7e38f5</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>90a7592b-c5a4-4e85-9bd5-f1243d9b7fd2</uuid>
<key>asset</key>
<uuid>a87582b6-ad37-0a21-ac7b-2ffa5e75df77</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>726b9feb-15ea-4016-adf5-1de384c90529</uuid>
<key>asset</key>
<uuid>597937e4-c9a2-1cb6-a7aa-5875cc636ef9</uuid>
</map>
</array>
<array>
<map>
<key>item</key>
<uuid>f72f2605-631c-4fed-8bba-060690dac8ee</uuid>
<key>asset</key>
<uuid>c7f3d2f2-8c72-9491-b9a5-541fc40f537c</uuid>
</map>
</array>
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array />
<array>
<map>
<key>item</key>
<uuid>a46584db-c771-4753-9727-baa9106c6a38</uuid>
<key>asset</key>
<uuid>85d86e68-d863-2855-5a93-8159ea32f17a</uuid>
</map>
</array>
<array />
</array>
<key>textures</key>
<array>
<uuid>46697265-7374-6f72-6d00-000000000000</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
<uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
<uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
<uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
<uuid>3a367d1c-bef1-6d43-7595-e88c1e3aadb3</uuid>
</array>
<key>visualparams</key>
<binary encoding="base64">PzXWfzFEET1eRBG7cAAApXo6ZwAAfV6cP/8APYRWIwDL/wCRAAB/AAB/AAAAf3J/Yz9/jH9/AAAAvwAACgAAAAAAAAAAkdiFADoA2GgAAI5Rd1V/fwwZAGTY1szMzDMZWUzMAFQAAJ5OT9F/PQB/Qn9/f3A7LkJ/f2FRT14KWT8AAAAAf38AAAAAfwCfAACyfzNVg166SXp9AABMAIJmANbMxgAARCZo4v/G////////////zAD//////////////wD//////wB/Qv8ZZP////9UAAAAMwD///8AABkAGRczABkXMwAAGQAZFzMAABkAGRczABkXMwAZFzMAfw==</binary>
<key>attachments</key>
<array>
<map>
<key>point</key>
<integer>9</integer>
<key>item</key>
<uuid>7ff842f2-0ef7-4805-bb04-ec3a61152205</uuid>
<key>asset</key>
<uuid>3ef0463a-248c-43d8-bdc4-83bcf16e3edf</uuid>
</map>
<map>
<key>point</key>
<integer>9</integer>
<key>item</key>
<uuid>b497f9c0-b3ba-41a3-9c3c-f943bf6c5f08</uuid>
<key>asset</key>
<uuid>62c1f804-57e4-4af8-a43f-7b46bd442c75</uuid>
</map>
<map>
<key>point</key>
<integer>30</integer>
<key>item</key>
<uuid>4ebc9791-d7e4-4acf-8b1c-34ae471428a1</uuid>
<key>asset</key>
<uuid>8a6a4219-db7d-4171-a335-7c7bbd084af1</uuid>
</map>
</array>
</map>
</llsd>

View File

@@ -0,0 +1,395 @@
// :SHOW:1
// :CATEGORY:NPC
// :NAME:Hypergrid Story One
// :AUTHOR:Ferd Frederix
// :KEYWORDS:Game, Collider
// :CREATED:2015-11-24 20:36:34
// :EDITED:2015-11-24 19:36:34
// :ID:1089
// :NUM:1856
// :REV:3.0
// :WORLD:Opensim
// :DESCRIPTION:
// Sample sequencer script for NPC animator. It sequences multiple NPCs in order thru a scenarios
// each 'things' entry is the NPC number, a (float) time to take between sending commands ( 0 is not allowed, but a small number is()
///and a @command that is sent to the NPC.
// :CODE:
// Rev: 2 fixes the Linux bug for collisions.
//
// Rev: 3 Neo Cortex: modified to become a standalone sequencer for Scene one
//
// Rev: 4 Aine Caoimhe: added support for custom appearance change slave scripts for finale sequence with 2 new commands:
// @dumpkeys must be called when all NPCs have been rezzed (ie when npcList has been populated with their keys)
// this relays the key data to the slave scripts which are numbered from 01 to 12
// @slaveap=target|appearance_notecard_name where:
// target 1 = namaka (for final one)
// target 2 = mirror namakas (for final one)
// target 3 = all namaka (for all the other ones for her)
// target -1 = dylan (for the final one)
// target -2 = mirror dylans (for the final one)
// target -3 = all dylans (for all the ones for him)
// in both of the above commands you can use any non-zero npc number but it's ignored so I'd just use 1 each time
// it will respect a time delay value if you set one
// example:
// after all NPCs have been rezzed you need to call (but you only need to do it once):
// things += [1,0,"@dumpkeys"];
// then to have all of the dylans change to appearance notecard "dylan scene 2" with no delay after it you would do:
// things += [1,0,"@slaveap=-3|dylan scene 2"];
string myStoryNotecard = "!Story";
integer debug = FALSE;
integer LSLEditor = FALSE; // set to to TRUE to working in LSLEditor, FALSE for in-world.
integer iTitleText = TRUE; // set to TRUE to see debug info in text above the controller
integer SENSE = FALSE; // sensor for an avatar
float RATE = 5; // every 5 seconds
float RANGE = 2; // a very short range as this goes into a ring around the avatar
integer COLLIDE = TRUE; // if they collide, trigger the sequence
integer isRunning = FALSE; // used to stop collision from firing twice
list npcList = [ (key) "00000000-0000-0000-0000-000000000000", "empty npc0", // this one is ignored
(key) "00000000-0000-0000-0000-000000000000", "empty npc1",
(key) "00000000-0000-0000-0000-000000000000", "empty npc2",
(key) "00000000-0000-0000-0000-000000000000", "empty npc3",
(key) "00000000-0000-0000-0000-000000000000", "empty npc4",
(key) "00000000-0000-0000-0000-000000000000", "empty npc5",
(key) "00000000-0000-0000-0000-000000000000", "empty npc6",
(key) "00000000-0000-0000-0000-000000000000", "empty npc7",
(key) "00000000-0000-0000-0000-000000000000", "empty npc8",
(key) "00000000-0000-0000-0000-000000000000", "empty npc9",
(key) "00000000-0000-0000-0000-000000000000", "empty npc10",
(key) "00000000-0000-0000-0000-000000000000", "empty npc11",
(key) "00000000-0000-0000-0000-000000000000", "empty npc12"];
list myObjects = [];
list myObjectKeys = [];
integer myObjectsInitialized = FALSE;
string npcAction = "";
string npcParams = "";
key npcKey = "";
integer NPCOptions = OS_NPC_CREATOR_OWNED; // only the owner of this box can control this NPC.
key oldCollider; //remember who collided last
key newCollider;
// CODE follows
// For rezzing in
RezIn()
{
things = [1,5,"@stop"];
things += [2,5,"@stop"];
things += [3,10,"@stop"];
Speak();
}
DoIt()
{
things = myStory;
isRunning = TRUE;
llVolumeDetect(FALSE);
llSleep(0.1);
}
list things ;
list myStory;
// DEBUG(string) will chat a string or display it as hovertext if debug == TRUE
DEBUG(string str) {
if (debug && ! LSLEditor)
llOwnerSay( str); // Send the owner debug info
if (debug && LSLEditor)
llSay(0, str); // Send to the Console in LSLEDitor
if (iTitleText) {
llSetText(str,<1.0,1.0,1.0>,1.0); // show hovertext
}
}
list ListStridedUpdate(list dest, list src, integer start, integer end, integer stride) {
return llListReplaceList(dest, src, start * stride, ((end + 1) * stride) - 1 );
}
spawn(integer who,string msg) {
DEBUG("spawning " + msg);
list data = llParseString2List(msg, ["|"], []);
//DEBUG((string) data);
list npcName = llParseString2List(llList2String(data,0), [" "], []);
npcKey = osNpcCreate(llList2String(npcName, 0), llList2String(npcName, 1), llList2Vector(data,1), llList2String(data, 2), NPCOptions);
npcList=ListStridedUpdate(npcList,[npcKey,npcName],who,who,2);
//DEBUG("npcList " + (string) npcList);
}
delete(integer who) {
DEBUG(llList2String(npcList,who*2+1) + " is removed");
osNpcRemove (llList2Key(npcList,who*2));
npcList=ListStridedUpdate(npcList,[(key) "00000000-0000-0000-0000-000000000000","removed NPC"],who,who,2);
//llSay(0, "npcList " + (string) npcList);
}
say(integer who,string msg) {
DEBUG(llList2String(npcList,who*2+1) + " says " + msg);
osNpcSay(llList2Key(npcList,who*2),0, msg);
}
sit(integer who,string msg) {
DEBUG(llList2String(npcList,who*2+1) + " sits on " + (string) msg);
// look up object named "msg" in myObjects, get key from myObjectsKeys, make "who" NPC sit on it
osNpcSit(llList2Key(npcList,who*2), llList2Key(myObjectKeys,llListFindList(myObjects,[msg])), OS_NPC_SIT_NOW);
}
touchit(integer who,string msg) {
DEBUG(llList2String(npcList,who*2+1) + " touches " + (string) msg);
// look up object named "msg" in myObjects, get key from myObjectsKeys, make "who" NPC touch it
osNpcTouch(llList2Key(npcList,who*2),llList2Key(myObjectKeys,llListFindList(myObjects,[msg])), LINK_THIS);
}
stand(integer who) {
DEBUG(llList2String(npcList,who*2+1) + " stands");
osNpcStand(llList2Key(npcList,who*2));
list anToStop=llGetAnimationList(llList2Key(npcList,who*2));
integer stop=llGetListLength(anToStop);
while (--stop>-1) { osAvatarStopAnimation(llList2Key(npcList,who*2),llList2Key(anToStop,stop)); }
osNpcPlayAnimation(llList2Key(npcList,who*2),"Stand");
}
walk(integer who,vector pos) {
DEBUG(llList2String(npcList,who*2+1) + " walks to " + (string) pos);
osNpcMoveToTarget(llList2Key(npcList,who*2),pos,OS_NPC_NO_FLY);
osNpcPlayAnimation(llList2Key(npcList,who*2),"Walk");
}
animate(integer who, string ani) {
DEBUG(llList2String(npcList,who*2+1) + " plays " + (string) ani);
osNpcPlayAnimation(llList2Key(npcList,who*2),ani);
}
appearance(integer who, string app) {
DEBUG(llList2String(npcList,who*2+1) + " changes appearance to " + (string) app);
osNpcLoadAppearance(llList2Key(npcList,who*2),app);
}
rotate(integer who,float rot) {
DEBUG(llList2String(npcList,who*2+1) + " rotates " + (string) rot);
osNpcSetRot(llList2Key(npcList,who*2),llEuler2Rot(<0,0,rot> * DEG_TO_RAD));
}
// <<<< Added by Aine
dumpKeys() {
llMessageLinked(LINK_THIS,0,"NPC_UUID_LIST",llDumpList2String(llList2ListStrided(npcList,0,-1,2),"|"));
}
slaveap(string com) {
list parse=llParseString2List(com,["|"],[]);
llMessageLinked(LINK_THIS,llList2Integer(parse,0),"NPC_CHANGE_APPEARANCE",llList2String(parse,1));
}
// <<<< End added by Aine
Speak() {
integer npc = llList2Integer(things,0);
float time = llList2Float(things,1);
string msg = llList2String(things,2);
DEBUG("npc:" + (string) npc + " time:" + (string) time + " Msg:" + msg);
if (npc) {
things = llDeleteSubList(things,0,2);
// llMessageLinked(npc,0, msg,""); // <<<<< Aine: I don't see any need for having this here still since this script is handling it
list data = llParseString2List(msg, ["="], []);
npcAction = llToLower(llStringTrim(llList2String(data, 0), STRING_TRIM));
DEBUG("Action:" + npcAction);
npcParams = llStringTrim(llList2String(data, 1), STRING_TRIM);
DEBUG("Params:" + npcParams);
if (npcAction == "@say") {
say(npc,npcParams);
} else if (npcAction == "@spawn") {
spawn(npc,npcParams);
} else if (npcAction == "@delete") {
delete(npc);
} else if (npcAction == "@sit") {
sit(npc,npcParams);
} else if (npcAction == "@touch") {
touchit(npc,npcParams);
} else if (npcAction == "@stand") {
stand(npc);
} else if (npcAction == "@walk") {
walk(npc,npcParams);
} else if (npcAction == "@animate") {
animate(npc,npcParams);
} else if (npcAction == "@appearance") {
appearance(npc,npcParams);
} else if (npcAction == "@rotate") {
rotate(npc,npcParams);
// >>>> Added by Aine
} else if (npcAction == "@dumpkeys") {
dumpKeys();
} else if (npcAction == "@slaveap") {
slaveap(npcParams);
} // >>>> end of add by Aine
if (time > 0) {
llSetTimerEvent(time);
} else {
llOwnerSay("Whooops, time = 0!");
DEBUG("npc:" + (string) npc + " time:" + (string) time + " Msg:" + msg);
llSetTimerEvent(0);
}
} else {
DEBUG("Done");
isRunning = FALSE;
Reset();
llSetTimerEvent(0);
if (SENSE)
llSensorRepeat("","",AGENT,RANGE,PI,RATE);
}
}
Reset()
{
llSetStatus(STATUS_PHANTOM, FALSE); // Rev 2
llVolumeDetect(FALSE);
llSleep(0.1);
llVolumeDetect(TRUE);
}
default
{
state_entry()
{
DEBUG("entering state default");
if (! myObjectsInitialized){
state initial;
}
llSetText("",<1,1,1>,1.0);
Reset();
llSetTimerEvent(0);
if (SENSE)
llSensorRepeat("","",AGENT,RANGE,PI,RATE);
}
sensor(integer n) {
DEBUG("Bumped");
if (! osIsNpc(llDetectedKey(0))) {
DEBUG("Sensed avatar");
llSensorRemove();
RezIn();
}
}
timer()
{
Speak();
}
collision_start(integer n) {
newCollider = llKey2Name(llDetectedKey(0));
DEBUG("Collided with " + llKey2Name(llDetectedKey(0)));
if (! osIsNpc(llDetectedKey(0)))
{
if ( newCollider != oldCollider) {
DoIt();
oldCollider = llKey2Name(llDetectedKey(0));
Speak();
}
}
}
collision_end(integer num_detected) {
DEBUG(llDetectedName(0) + " has stopped colliding with me!");
if (! isRunning && (newCollider == oldCollider) ) {
oldCollider = NULL_KEY;
}
}
touch_start(integer n) {
DEBUG("Touched by " + llKey2Name(llDetectedKey(0)));
if (isRunning) {
//insert restart code here
}
if (! osIsNpc(llDetectedKey(0))) {
DoIt();
Speak();
}
}
on_rez(integer p)
{
llResetScript();
}
changed(integer what)
{
if (what & CHANGED_REGION_START|CHANGED_INVENTORY)
{
llResetScript();
}
}
}
state initial
{
state_entry()
{
DEBUG("entering state initial");
myStory = [];
list myStoryLines = llParseString2List(osGetNotecard(myStoryNotecard), ["\n"], []);
DEBUG("text = " + (string) myStoryLines);
DEBUG("lines = " + (string) llGetListLength(myStoryLines));
integer i;
for (i=0; i<llGetListLength(myStoryLines); i++) {
string myStoryLine = llList2String(myStoryLines,i);
integer npc = (integer) llGetSubString(myStoryLine,0,llSubStringIndex(myStoryLine,","));
string rest = llGetSubString(myStoryLine,llSubStringIndex(myStoryLine,",")+1,-1);
float time = llGetSubString(rest,0,llSubStringIndex(rest,","));
string msg = llGetSubString(rest,llSubStringIndex(rest,",")+2,-2);
//now parse for sit and touch events to find the names of the objects needed
list data = llParseString2List(msg, ["="], []);
npcAction = llToLower(llStringTrim(llList2String(data, 0), STRING_TRIM));
DEBUG("Action:" + npcAction);
npcParams = llStringTrim(llList2String(data, 1), STRING_TRIM);
DEBUG("Params:" + npcParams);
if (npcAction == "@sit") {
myObjects += npcParams;
} else if (npcAction == "@touch") {
myObjects += npcParams;
}
DEBUG("npc: " + (string) npc + " time: " + (string) time + " msg: " + msg);
myStory += [npc, time, msg];
}
DEBUG("Story read, initializing objects: " + llDumpList2String(myObjects," "));
if (llGetListLength(myObjects) == 0) {
DEBUG("myObjects is empty upon entering state initial");
myObjectsInitialized = TRUE;
state default;
}
llSensor(llList2String(myObjects,0),"",ACTIVE|PASSIVE,96,PI);
DEBUG("initially looking for: " + llList2String(myObjects,0));
}
//sensor is used to scan surrounding for named prims
sensor(integer num) {
myObjectKeys = myObjectKeys + llDetectedKey(0);
DEBUG("myObjectKeys: " + llDumpList2String(myObjectKeys," "));
myObjects = llDeleteSubList(myObjects,0,0);
if (llGetListLength(myObjects) == 0) {
myObjectsInitialized = TRUE;
state default;
} else {
llSensor(llList2String(myObjects,0),"",ACTIVE|PASSIVE,96,PI);
DEBUG("now looking for: " + llList2String(myObjects,0));
}
}
no_sensor(){
DEBUG ("no target prim located");
}
}