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
OpenSim NPC Dance_all_NPC  

Dance_all_NPC

//From http://opensimulator.org/wiki/User:Fritigern/Scripts#NPC_stuff
License: http://creativecommons.org/licenses/by-sa/2.5/
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
to make commercial use of the work

Get your NPCs (and whoever else may be in the region) to dance.
To make this work, create a prim, fill it with (dance) animations, put this script in it, click the prim, and PAR-TAY!.

Category: OpenSim NPC
By : Fritigern
Created: 2013-07-30 Edited: 2013-07-30
Worlds: OpenSim

the Zip file

Download all files for Dance_all_NPC
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Dance_all_NPC_1.lsl
1 list avies;
2 list thedance;
3 list olddance;
4 list dancers;
5 integer duration = 10;
6
7 EverybodyDanceNow()
8 {
9 llSetText("Dancing",<1,1,1>,1);
10 avies = osGetAvatarList();
11 integer n;
12
13 if(llGetListLength(thedance) != 0)
14 {
15 for(n=0;n<llGetListLength(thedance);++n)
16 {
17 olddance = olddance + llList2String(thedance,n);
18 }
19 }
20
21
22 for(n=0;n<llGetListLength(avies);n=n+3)
23 {
26 key avieID = llList2Key(avies,n);
27 dancers = dancers + [avieID];
28 thedance = thedance + [animation];
29 }
30
31 for(n=0;n<llGetListLength(dancers);++n)
32 {
33 key avie = llList2Key(dancers,n);
34 string dance = llList2String(thedance,n);
35 osAvatarPlayAnimation(avie, dance);
36
37 }
38 }
39
40 Stop_HammerTime()
41 {
42 llSetText("Stopped Dancing",<1,1,1>,1);
43 integer n;
44 for(n=0;n<llGetListLength(dancers);++n)
45 {
46 key avie = llList2Key(dancers,n);
47 string dance = llList2String(thedance,n);
48 osAvatarStopAnimation(avie, dance);
49 }
50 dancers = [];
51 thedance = [];
52 avies = [];
53 }
54
55 default
56 {
57 touch_start(integer numdet)
58 {
59 state on;
60 }
61 }
62
63 state on
64 {
66 {
67 EverybodyDanceNow();
68 llSetTimerEvent(duration);
69 }
70
71 touch_start(integer numdet)
72 {
73 state off;
74 }
75
76 timer()
77 {
78 EverybodyDanceNow();
79 }
80 }
81
82
83 state off
84 {
86 {
87 Stop_HammerTime();
88 }
89
90 touch_start(integer numdet)
91 {
92 state on;
93 }
94 }

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