Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

dance script

Marylou Lane
Registered User
Join date: 3 Mar 2007
Posts: 60
03-14-2007 04:36
I'm french, so excuse me for my english.... but I would try to explain me the best I can...

I would like to create a dance floor wich would contain many dances. I've found a script in this forum and I've also seen that the same script has been used in some dance balls or dance floors. So I know that this script is usable.
this script contains to scripts : mainanim and solopserver....
the creator from this script has explain how to use it but I can't fill it correctly, he says that you should just add a simple letter in the mainanim script, but I don't understand where exactly....
if someone could help me, it would be nice, or if noone knows this script I'm talking about, give please a simple script and simple notice.... if you can... or contact me in SL...
thanks a lot...
Marylou Lane
Registered User
Join date: 3 Mar 2007
Posts: 60
no one can help me????
03-14-2007 10:39
or is there someone who can explain me how to modify a simple script...
thanks for your help....
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
03-14-2007 10:48
point us to the scripts and maybe we can.
Marylou Lane
Registered User
Join date: 3 Mar 2007
Posts: 60
here are the scripts ....
03-15-2007 04:36
so... here are the scripts and the explanations given from the creator...

mainanim script:

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();
}
}



and solopserver script :

//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();}
}



and the explanations....

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.


I have understood how to put the scripts in the object, but he says : "then go into each of the others, and type a single letter into the script"
i don't understand this....
and also when i try to recompile the scripts, I mean its not working....

can someone explain me how it works, please???
thanks a lot
Marylou
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
03-15-2007 05:42
Hi Marylou, sorry to bug you again, but always put code between PHP tags, like this:

[ php ]
... code here ...
[ /php ]

only leave out the spaces in inside the brackets. Then we can read the code. :)

Cheers
Jeff
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-15-2007 06:20
Easiest way would be to pick up a copy of the free Solop dance ball in world (try YadNi's or teh shelter?) and then stretch it flat to make a dance floor, at least thats what I did for a friend's birthday party.
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
03-15-2007 06:55
aha

Add a blank space ANYWHERE, then delete it, to cause the system to think the script changed, so you can then save it. My guess is that there are or were bugs in SL that this is a workaround for.

Sorry I didn't pick that up earlier. All the scripts will be the same, they all just need to get recompiled and reset. In the object's inventory, each one but the first will have a number appended to the name.
Marylou Lane
Registered User
Join date: 3 Mar 2007
Posts: 60
thanks
03-15-2007 11:14
ok, it works, thank you for giving me the dance floor ;)
you can visit our club if you want : The DISCOPOLIS where you can enjoy yourselves and have a good time !!!

see you ;)

Marylou Lane