Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Single Prim dance machine. All the others copied a different idea. Read/source

Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
11-04-2004 20:38
Well, a while back, about a 2 weeks or so before the single prim dance machines were released, I developed my own dance scripts which allowed all the animations to be kept in ONE PRIM. Of course, it had a slight design flaw, in that it still had a ball for every person.

Now i'm NOT SAYING that I was the first to create this. I am well aware that anyone else could have been developing this/had one in world before/at the same time as me.

But now that I see this new, single prim, dance machine released, and all of the arguments and competition brought with it, I have no choice but to release my script for FREE to everyone.

If i tried to sell this, people would get mad because I'm ruining their business. If I set it for free,(nomod) nobody would use it because it doesnt have enough 'features. This particular single prim dance machine may not be advanced as the others, but since you have full rights to modify and copy this script (Reselling the original or a modified version is NOT ALLOWED!*), you can advance it as much as you want, and post updated code here.

* If you do modify it, you may only give it away for free with FULL permissions, and may NOT remove my name from it, the footers, or claim any credit to something you did NOT do.

Now that my little blob is over, here's the good stuff :D (yeah, there's a lack of comments, but it shouldnt be too hard to figure alot of this stuff out. No support provided other than what I post at the bottom)

Main animation script. Name: "mainanim #"
Where # is a number from 1 to whatever. Refer to bottom for setup help.
CODE
key prekey;
key DancerKey = NULL_KEY;
string Dance = "jump";
integer scriptnum;

reset()
{
llMessageLinked(0, 0, "cancel", prekey);
prekey = NULL_KEY;
DancerKey = NULL_KEY;
llSensorRemove();
llSetTimerEvent(0);
}

default
{
state_entry()
{
scriptnum = llList2Integer(llParseString2List(llGetScriptName(),["mainanim "],[]),0);
}

on_rez(integer start_param)
{
llResetScript();
}

link_message(integer sender_num, integer num, string msg, key id)
{
if (num != 256)
{
if (msg == "start" && num == scriptnum)
{
if (DancerKey == NULL_KEY && prekey != id)
{
prekey = id;
llRequestPermissions(prekey, PERMISSION_TRIGGER_ANIMATION);
llSetTimerEvent(10);
}else{
llMessageLinked(0, num + 1, msg, id);
}
}
else if (prekey == id && msg == "stop")
{
if (DancerKey == id) llStopAnimation(Dance);
reset();
}
}else{
if (DancerKey != NULL_KEY)
{
llStopAnimation(Dance);
Dance = msg;
llStartAnimation(Dance);
}else if (DancerKey == NULL_KEY)
{
Dance = msg;
}
}
}

no_sensor()
{
llStopAnimation(Dance);
reset();
}

run_time_permissions(integer perms)
{
llSetTimerEvent(0);
if (perms & PERMISSION_TRIGGER_ANIMATION)
{
DancerKey = prekey;
llSensorRepeat("", DancerKey, AGENT, 96.0, TWO_PI, 30.0);
llStartAnimation(Dance);
}else{
reset();
}
}
timer()
{
reset();
}
}

////////////////////////////////////////////////////////////////////////
//
// Solop(rim) Dance version 1.1 MAINANIM
// by Evil Fool
// Copyright (c) 2004 by Michael Goetz
// All Rights Reserved
//
// Permission to Use and Redistribute
//
// Permission to use and redistribute the Solop Dance code, with or
// without modifications, is granted under the following conditions:
//
// + All redistributions must include this copyright notice and license.
// + All redistributions must allow the next user to view, modify, and
// redistribute this code, containing this copyright notice and license.
// + All redistributions must give credit to the author, by real name
// (Michael Goetz) and by SL name (Evil Fool). If distributed in a
// modified form, credit must still be given to Evil Fool (Michael
// Goetz) as the original author.
// + All redistributions *should* include a notecard or documentation
// containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////


Script Name: "Solop Server"
Basically synchronizes the scripts and keeps track of who is doing what.
Can be de-synchronized with a bit of modification.

CODE
integer length = 10; // change for # of seconds to play each anim

integer danceslots = 10; // how many "mainscripts" you have in the object.

integer numdances;
integer curranim;
list dances;
list dancers;

updatetext()
{
llSetText("Solop Dance 1.1 by Evil Fool.\nCurrently Dancing: " + (string)llGetListLength(dancers) + " of " + (string)danceslots + " possible.\n" + (string)llGetListLength(dances) + " dances loaded!", <1,0,0>, 1);
}
default
{
touch_start(integer num_detected)
{
integer i;
for (i = 0; i < num_detected; i++)
{
key currkey = llDetectedKey(i);
integer d = llListFindList(dancers, [currkey]);
if ( (d == -1) && (llGetListLength(dancers) < danceslots) )
{
dancers = dancers + [currkey];
llMessageLinked(0,1,"start",currkey);
}else if (d != -1){
dancers = llDeleteSubList(dancers, d, d);
llMessageLinked(0,0,"stop",currkey);
}else{
llInstantMessage(currkey, "Sorry, but all the available dance slots are used. Please check back soon!");
}
updatetext();
}
}

link_message(integer sender_num, integer num, string msg, key id)
{
if (msg == "cancel")
{
integer fk = llListFindList(dancers, [id]);
if (fk != -1)
dancers = llDeleteSubList(dancers, fk, fk);
updatetext();
}
}

state_entry()
{
// danceslots = llGetInventoryNumber(INVENTORY_SCRIPT) - 1; // slightly more dynamic, but removed for the forum-released version.
numdances = llGetInventoryNumber(INVENTORY_ANIMATION);
integer i;
for (i = 0; i < numdances; i++)
dances = dances + [llGetInventoryName(INVENTORY_ANIMATION, i)];
llSetTimerEvent(length);
updatetext();
}

timer()
{
if (curranim >= numdances)
{
curranim = 0;
}
llMessageLinked(0, 256, llList2String(dances,curranim), NULL_KEY);
curranim++;
}

on_rez(integer sparam){llResetScript();}
}

////////////////////////////////////////////////////////////////////////
//
// Solop(rim) Dance version 1.1 SOLOPSERVER
// by Evil Fool
// Copyright (c) 2004 by Michael Goetz
// All Rights Reserved
//
// Permission to Use and Redistribute
//
// Permission to use and redistribute the Solop Dance code, with or
// without modifications, is granted under the following conditions:
//
// + All redistributions must include this copyright notice and license.
// + All redistributions must allow the next user to view, modify, and
// redistribute this code, containing this copyright notice and license.
// + All redistributions must give credit to the author, by real name
// (Michael Goetz) and by SL name (Evil Fool). If distributed in a
// modified form, credit must still be given to Evil Fool (Michael
// Goetz) as the original author.
// + All redistributions *should* include a notecard or documentation
// containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////


Now for the instructions (good luck)

In your inventory, create a folder named SolopDance
create 2 scripts in there. "Solop Server" and "mainanim"
paste the Solop Server code into the Solop Server script, and the mainanim # code into the mainanim script.
Drag both scripts onto the prim.
Keep dragging copies of mainanim onto the prim, until you have the number of supported dancers you want. There is a limit of about 115 dancers OR animations (total must be less than 115. I might update this to remove the dances as a factor in the future. Think about linkmsging just a number for each animation, then using llGetInventoryName)
Once you do this, delete the original mainanim script, **then go into each of the others, and type a single letter into the script, and then press backspace, to put it back how it was before. Then, save it and check the running box.
Finish this for all your scripts, then use Tools: recompile scripts in selection. For any script missing from that list, go back into the prim, and repeat the above process (the **'d one), until all the scripts appear in that list
next, open up the Solop Dance script, the one inside the object, and close the edit box, keeping the script open. Drag all the dances you want into the prim, then wait a second, and click Reset on the server script dialog.

That should pretty much work. i have only tested this with one person so far(myself), but using a few different modifications to emulate multiple users. Give this a try, post feedback, modifications, whatever. Just keep in mind the rules above and in the header.
Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
11-18-2004 18:15
updated/fixed alot of stuff since that.... (havent tested this new ver, but should work

still is synchronized... now should be alot easier to adapt for de-sync

mainanim script

CODE
key prekey;
key DancerKey = NULL_KEY;
string Dance = "jump";
integer scriptnum;

reset()
{
llMessageLinked(0, 0, "cancel", prekey);
prekey = NULL_KEY;
DancerKey = NULL_KEY;
llSensorRemove();
llSetTimerEvent(0);
}

default
{
state_entry()
{
scriptnum = llList2Integer(llParseString2List(llGetScriptName(),["mainanim "],[]),0);
}

on_rez(integer start_param)
{
llResetScript();
}

link_message(integer sender_num, integer num, string msg, key id)
{
if (num != 256)
{
if (msg == "start" && num == scriptnum)
{
if (DancerKey == NULL_KEY && prekey != id)
{
prekey = id;
llRequestPermissions(prekey, PERMISSION_TRIGGER_ANIMATION);
llSetTimerEvent(10);
}else{
llMessageLinked(0, num + 1, msg, id);
}
}
else if (prekey == id && msg == "stop")
{
if (DancerKey == id) llStopAnimation(Dance);
reset();
}
}else{
if (DancerKey != NULL_KEY)
{
llStopAnimation(Dance);
Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg);
llStartAnimation(Dance);
}else if (DancerKey == NULL_KEY)
{
Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg);
}
}
}

no_sensor()
{
llStopAnimation(Dance);
reset();
}

run_time_permissions(integer perms)
{
llSetTimerEvent(0);
if (perms & PERMISSION_TRIGGER_ANIMATION)
{
DancerKey = prekey;
llSensorRepeat("", DancerKey, AGENT, 96.0, TWO_PI, 30.0);
llStartAnimation(Dance);
}else{
reset();
}
}
timer()
{
reset();
}
}

////////////////////////////////////////////////////////////////////////
//
// Solop(rim) Dance version 1.1a MAINANIM
// by Evil Fool
// Copyright (c) 2004 by Michael Goetz
// All Rights Reserved
//
// Permission to Use and Redistribute
//
// Permission to use and redistribute the Solop Dance code, with or
// without modifications, is granted under the following conditions:
//
// + All redistributions must include this copyright notice and license.
// + All redistributions must allow the next user to view, modify, and
// redistribute this code, containing this copyright notice and license.
// + All redistributions must give credit to the author, by real name
// (Michael Goetz) and by SL name (Evil Fool). If distributed in a
// modified form, credit must still be given to Evil Fool (Michael
// Goetz) as the original author.
// + All redistributions *should* include a notecard or documentation
// containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////



server script

CODE
//11/11 fixed for numanims, allows nearly UNLIMITED animations!

integer length = 10; // change for # of seconds to play each anim

integer danceslots = 10; // how many "mainscripts" you have in the object.

integer numdances;
integer curranim;
//list dances;
list dancers;

updatetext()
{
llSetText("Solop Dance 1.1a by Evil Fool.\nCurrently Dancing: " + (string)llGetListLength(dancers) + " of " + (string)danceslots + " possible.\n" + (string)numdances + " dances loaded!", <1,0,0>, 1);
}
default
{
touch_start(integer num_detected)
{
integer i;
for (i = 0; i < num_detected; i++)
{
key currkey = llDetectedKey(i);
integer d = llListFindList(dancers, [currkey]);
if ( (d == -1) && (llGetListLength(dancers) < danceslots) )
{
dancers = dancers + [currkey];
llMessageLinked(0,1,"start",currkey);
}else if (d != -1){
dancers = llDeleteSubList(dancers, d, d);
llMessageLinked(0,0,"stop",currkey);
}else{
llInstantMessage(currkey, "Sorry, but all the available dance slots are used. Please check back soon!");
}
updatetext();
}
}

link_message(integer sender_num, integer num, string msg, key id)
{
if (msg == "cancel")
{
integer fk = llListFindList(dancers, [id]);
if (fk != -1)
dancers = llDeleteSubList(dancers, fk, fk);
updatetext();
}
}

state_entry()
{
//danceslots = llGetInventoryNumber(INVENTORY_SCRIPT) - 1; // slightly more dynamic, but commented for forum-version, check the top of script to change this...
numdances = llGetInventoryNumber(INVENTORY_ANIMATION);
integer i;
//for (i = 0; i < numdances; i++) // no longer needed , uses numbers now :D
//dances = dances + [llGetInventoryName(INVENTORY_ANIMATION, i)];
llSetTimerEvent(length);
updatetext();
}

timer()
{
if (curranim >= numdances)
{
curranim = 0;
}
llMessageLinked(0, 256, (string)curranim, NULL_KEY);
curranim++;
}

on_rez(integer sparam){llResetScript();}
}

////////////////////////////////////////////////////////////////////////
//
// Solop(rim) Dance version 1.1a SOLOPSERVER
// by Evil Fool
// Copyright (c) 2004 by Michael Goetz
// All Rights Reserved
//
// Permission to Use and Redistribute
//
// Permission to use and redistribute the Solop Dance code, with or
// without modifications, is granted under the following conditions:
//
// + All redistributions must include this copyright notice and license.
// + All redistributions must allow the next user to view, modify, and
// redistribute this code, containing this copyright notice and license.
// + All redistributions must give credit to the author, by real name
// (Michael Goetz) and by SL name (Evil Fool). If distributed in a
// modified form, credit must still be given to Evil Fool (Michael
// Goetz) as the original author.
// + All redistributions *should* include a notecard or documentation
// containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////


If you would like a pre-made dance machine using these scripts, (no animations though), just ask
Vicero Lambert
Burning Life Coder
Join date: 24 Aug 2004
Posts: 100
12-06-2004 07:24
Make a single prim dance ball using this script but I couldent get more then one persion on it and I kept geting a permission error. Possable you can fix script one more time?
_____________________
- Vicero Lambert
Ishra Psaltery
Registered User
Join date: 24 Jun 2004
Posts: 19
12-07-2004 05:06
Don't know what you did different Vicero, but I used this script to make a nice one-prim dance machine that can handle at least 25 people (is set for more, but we only had about 25 at my last event that were using it).

I did get a error on it after some lag and had to relog, like it didn't accept my stop before I relogged. But picking up the machine then putting it down and resetting it fixed that.

THank you Evil for posting this for all to enjoy. I so enjoy being able to choose my own dances for the machine and setting it up to handle as many as I'd like on it.
Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
12-08-2004 17:52
Hey, thanks for your feedback/support!

I know that occasionally it will spit out an error (if someone leaves the sim or relogs, and a sensor sweep hasnt removed them)... but other than that, it should be ok...

you can increase the sensor speed... or maybe if somoene has another method... they could post
Ishra Psaltery
Registered User
Join date: 24 Jun 2004
Posts: 19
12-12-2004 11:33
how would we reset that to not try to sensor or quicker or so it doesn't need the permissions.. If someone logs/or gets bumped off server it WILL ALWAYS spam me for it. This is annoying when running an event.
Dax Mars
Registered User
Join date: 8 Feb 2004
Posts: 34
01-18-2005 12:37
I think I missed something here.. It work's, but only runs the first animation listed.. I put four in, but only the 1st runs. If i click a second time it stops the animation..
Dax Mars
Registered User
Join date: 8 Feb 2004
Posts: 34
01-19-2005 00:46
I posted to this before, but I did save I guess...

How do you change between dance animations?

I looked at the script, but I'm really the Visual Basic type:)
help ?
Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
01-27-2005 19:15
fixed up my script

UPDATED MAINANIM: FIXES THE DAMN PERMISSIONS BUG :D
CODE
key prekey;
key DancerKey = NULL_KEY;
string Dance = "jump";
string OldDance = Dance;
integer scriptnum;

reset()
{
llMessageLinked(0, 0, "cancel", prekey);
prekey = NULL_KEY;
DancerKey = NULL_KEY;
//llSensorRemove();
llSetTimerEvent(0);
}

default
{
state_entry()
{
scriptnum = llList2Integer(llParseString2List(llGetScriptName(),["mainanim "],[]),0);
}

on_rez(integer start_param)
{
llResetScript();
}

link_message(integer sender_num, integer num, string msg, key id)
{
if (num != 256)
{
if (msg == "start" && num == scriptnum)
{
if (DancerKey == NULL_KEY && prekey != id)
{
prekey = id;
llRequestPermissions(prekey, PERMISSION_TRIGGER_ANIMATION);
llSetTimerEvent(10);
}else{
llMessageLinked(0, num + 1, msg, id);
}
}
else if (prekey == id && msg == "stop")
{
if (DancerKey == id) llStopAnimation(Dance);
reset();
}
}else{
if (DancerKey != NULL_KEY)
{
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
{
OldDance = Dance;
Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg);
llSensor("", DancerKey, AGENT, 96.0, TWO_PI);
}else{
//llStopAnimation(Dance);
reset();
}

}else if (DancerKey == NULL_KEY)
{
OldDance = Dance;
Dance = llGetInventoryName(INVENTORY_ANIMATION, (integer)msg);
}
}
}

no_sensor()
{
//if (DancerKey != llGetOwner())
//{
//llStopAnimation(Dance);
reset();
//}
}

sensor(integer n)
{
llStopAnimation(OldDance);
llStartAnimation(Dance);
}

run_time_permissions(integer perms)
{
llSetTimerEvent(0);
if (perms & PERMISSION_TRIGGER_ANIMATION)
{
DancerKey = prekey;
//llSensorRepeat("", DancerKey, AGENT, 96.0, TWO_PI, 30.0);
llStartAnimation(Dance);
}else{
reset();
}
}
timer()
{
reset();
}
}

////////////////////////////////////////////////////////////////////////
//
// Solop(rim) Dance version 1.1c MAINANIM
// by Evil Fool
// Copyright (c) 2004 by Michael Goetz
// All Rights Reserved
//
// Permission to Use and Redistribute
//
// Permission to use and redistribute the Solop Dance code, with or
// without modifications, is granted under the following conditions:
//
// + All redistributions must include this copyright notice and license.
// + All redistributions must allow the next user to view, modify, and
// redistribute this code, containing this copyright notice and license.
// + All redistributions must give credit to the author, by real name
// (Michael Goetz) and by SL name (Evil Fool). If distributed in a
// modified form, credit must still be given to Evil Fool (Michael
// Goetz) as the original author.
// + All redistributions *should* include a notecard or documentation
// containing instructions for proper use and setup.
//
////////////////////////////////////////////////////////////////////////


as for only one anim playing, reset the server after adding animations
Weedy Herbst
Too many parameters
Join date: 5 Aug 2004
Posts: 2,255
02-03-2005 20:27
Thanks Evil,

That fix worked good.
_____________________
Weedy Herbst
Too many parameters
Join date: 5 Aug 2004
Posts: 2,255
02-03-2005 20:30
Thanks Evil, that patch worked well.
_____________________
Gaultier Grumby
Registered User
Join date: 3 Dec 2004
Posts: 6
07-02-2005 16:53
I made a Little Critter Dance Machine with this script giving you full credit Evil. Unfortunately, I handed out a bunch before I realized the scripts were set to no mod. The notecard gives credit to the author and references this thread. If you did get a copy of the no mod version and would like a replacement IM me. Thanks
Andre Richelieu
Second Life Resident
Join date: 13 Nov 2004
Posts: 16
How to use the other dances?
07-04-2005 09:02
Hi all!

I added 5 dances to the ball Gaultier sent me for my little critters. (Thanks Gaultier! Very nice of you!)

I did reset the script.
It says 5 dances are available.

But everytime I click on it, I only get dance #1. I tried different ways to make it switch to the other available ones, but nothing will do.

Help!

Andre
Andre Richelieu
Second Life Resident
Join date: 13 Nov 2004
Posts: 16
Same problem!
07-04-2005 09:37
From: Dax Mars
I think I missed something here.. It work's, but only runs the first animation listed.. I put four in, but only the 1st runs. If i click a second time it stops the animation..


Gaultier kindly sent me a modified version for small critters.
But I can only get the 1st dance to work.
Yes, I did reset the script. ;-)

Help! How do we switch to the other dances?

Thanks,

Andre
Sandling Honey
Registered User
Join date: 25 Jun 2005
Posts: 49
07-09-2005 16:39
Hello there!

It seems to be working fine for one person, but when a second person wants to dance along, it didn't get the 'animate me' message. So for me at least only one person can dance at a time.
ThereSummer Fredericks
Registered User
Join date: 21 Apr 2004
Posts: 13
12-27-2005 11:53
Thanks for releaseing this script...I made a one-prim circle and followed all the instructions...but when I click the ball to dance it is doing some weird animation that isn't even in the ball...If anyone could help me please message me in world and I will show you what it is doing...
hurricane Tuppakaka
Registered User
Join date: 20 Oct 2005
Posts: 9
i had tried it out , and it works quite well
01-09-2006 05:39
acturally , follow all the steps ,ok?

then , after you add animitions in to the ball, then reset the solo sever script,

then , haha , ok, it's over , and you can dance lol, i made one dance ball with 69 dances

and thank you very much for this script evil.
Dennis Bertone
Whitewater Nutcase
Join date: 20 Oct 2005
Posts: 164
01-10-2006 11:09
This works great! Thank you.
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
01-15-2006 10:05
Testing 123 123
Does this message get posted?
There is no real content in this message, it's just a test.
Hexabus Speculaas
Registered User
Join date: 12 Oct 2005
Posts: 7
Great scripting
01-24-2006 09:24
Hey Evil can you drop me one in world @ Hexabus Speculaas, I don't fully understand the setting up of the scripts but would love to have a 60 dancers ball with it. Thanks
Redd Shutt
Registered User
Join date: 5 Jul 2006
Posts: 8
Issues: either Mine or This Dance Machine
07-26-2006 17:20
Hey everyone. I'm kiiiinda having trouble with this. It says 0 dances loaded when i already have 10, and i followed all of the steps, I promise. What's going on!? I would hate to mooch, so of course If someone knows what I'm doing wrong i would love the answer, but if you're running low on time or just think theres no hope for me ever and feel sorry for me, then i would gratfully welcome a working dance machine.
Cramen Cranes
Registered User
Join date: 22 Jan 2006
Posts: 22
08-03-2006 15:51
yeah i did this works great except i have a problem with a bunch of animation request popping up, can you tell me what i did wrong for it to give me all those animation requests..
Cramen Cranes
Registered User
Join date: 22 Jan 2006
Posts: 22
08-03-2006 15:52
i have a problem with the animation requests, for some reason it asks me if i want to animate every single animation inside of the prim.. cant be having that so could you please tell me what i did wrong.
Stymie Frobozz
Registered User
Join date: 6 Mar 2006
Posts: 1
08-16-2006 19:19
From: Hexabus Speculaas
Hey Evil can you drop me one in world @ Hexabus Speculaas, I don't fully understand the setting up of the scripts but would love to have a 60 dancers ball with it. Thanks


Could you toss me one of the same? I tried for over an hour and I can't seem to get it right.
Stymie Frobozz
Registered User
Join date: 6 Mar 2006
Posts: 1
08-16-2006 19:32
From: Hexabus Speculaas
Hey Evil can you drop me one in world @ Hexabus Speculaas, I don't fully understand the setting up of the scripts but would love to have a 60 dancers ball with it. Thanks



Hey could I bother you for one of the same? I tried everything for over an hour and never could get it to work.
1 2