Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Multiple Animation Script Required

Artemis Winthorpe
Registered User
Join date: 20 Apr 2006
Posts: 8
09-10-2006 07:56
Please help. I've made a heap of animations that i want to put in a prim. I want to be able to stand on the prim and using a drop down menu to change the animations without using balls. I have seen a few around but am not getting any answers. Where can i find a super easy script for this purpose? Any assistance is greatly appreciated. Thanks.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-10-2006 09:13
From: Artemis Winthorpe
Please help. I've made a heap of animations that i want to put in a prim. I want to be able to stand on the prim and using a drop down menu to change the animations without using balls. I have seen a few around but am not getting any answers. Where can i find a super easy script for this purpose? Any assistance is greatly appreciated. Thanks.



Miffy Fluffy does a poseball one. check her profile for the latest version.
I think it would be adapatable?
Artemis Winthorpe
Registered User
Join date: 20 Apr 2006
Posts: 8
09-10-2006 15:27
Yes, i know she does one, but it seems overly complicated for the task at hand. I want one similiar to those 'dance balls' that activate your avi.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-11-2006 03:01
From: Artemis Winthorpe
Yes, i know she does one, but it seems overly complicated for the task at hand. I want one similiar to those 'dance balls' that activate your avi.



Ah sorry misread what you actually wanted.

Sounds like you want a menu driven version of the Animation player script by Teddy Wishbringer?

How many Anim's are we talking about?

If the animation names are meaning full, and not to long, you could just read them directly
from the inventory and use them to populate the menu. The LLDialog limits the displayed menu text to around 12 characters per button. So if you have 'hundreds' of anims a hierarchal menu system would be useful. This would have (?) to be note card driven.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
Try This
09-11-2006 06:19
Dont have SL access so doing this dry.
Its a cobbled together version of my 'standard' menu system with a little bit
of animation code lifted from Teddy Wishbringer's public Animation Player script.
Let me know if it works!

CODE

// Animation Player v1.0 - Newgate Ludd
// ------------------------------------
// Written in responce to a posting on the Forums by Artemis Winthorpe
//
string notecardName = "Contents List"; // Notecard containing list of animations
integer lineCounter; // Line number within the notecard
key dataRequestID; // Data request ID
integer CHANNEL = 42; // Channel on which Dialog listens
list MENU; // Menu text for each Anim
list ANIMS; // Actual Animation name
integer maxAnims; // Number of Animations laoded
integer first; // First entry to be displayed on Dialog
integer pagesize = 8; // Number of Items per Dialog
list choices; // Current Dialog Choices
integer Listening = 0; // Listen handle
string animation_name; // Name of current animation
string new_animation_name; // Name of next animation.
key avatar; // Key of the avatar who's sitting on me

integer i; // General Purpose

// --------------------------
UpdateListen(key id)
{
CancelListen();
Listening = llListen(CHANNEL,"",id,"");
llSetTimerEvent(20);
}
// --------------------------
CancelListen()
{
if(Listening > 0) llListenRemove(Listening);
Listening = 0;
llSetTimerEvent(0);
}
// --------------------------
ShowMenu()
{
choices = [];
if(avatar == llGetOwner())
choices += ["*RELOAD*"];

// Now add the items
//len = llGetListLength( MENU );
if(first > 0)
choices += "Prev";
if(maxAnims > (first + pagesize))
{
choices += "Next";
}

for(i = 0;i < pagesize;i++)
{
string strname = llList2String(MENU,(i+first));
if( llStringLength(strname) > 0)
{
choices += strname;
}
}
// finally show the dialog
llDialog(avatar, "Which anim would you like to play?", choices, CHANNEL);
UpdateListen(avatar);
}
// --------------------------
// Set the next animation available as the active one
PlayAnimation(integer number)
{
// Get the name of the animation
new_animation_name = llList2String(ANIMS,number);

// Get the key of the avatar on the stand (or if none is present)
avatar = llAvatarOnSitTarget();

if (avatar != NULL_KEY) // Is avatar is still posing, if so then..
{
llStopAnimation(animation_name); // Stop current animation
llStartAnimation(new_animation_name); // Start next animation
}
// Set the new animation name as the current
animation_name = new_animation_name;
}
// --------------------------

default
{
state_entry() { state ReadNoteCard; }
on_rez(integer num) { llResetScript(); }
}
// --------------------------
state Running
{
state_entry()
{
animation_name = "sit";
maxAnims = llGetListLength(MENU);
llSay(0,llGetScriptName() + " Loaded - " + (string)maxAnims + " Avaliable.");
}

on_rez(integer num) { llResetScript(); }

listen(integer channel, string name, key id, string message)
{
CancelListen();
// verify dialog choice
// present main menu on request to go back

if("*RELOAD*" == message)
{
llResetScript();
}
else if("Prev" == message)
{
first -= pagesize;
ShowMenu(id);
}
else if("Next" == message)
{
first += pagesize;
ShowMenu(id);
}
else
{
integer index = llListFindList(MENU, [message]);
if(index != -1)
{
PlayAnimation(index);
}
}
}

timer()
{
CancelListen();
}

changed(integer change)
{
// Test for a changed inventory
if (change & CHANGED_INVENTORY)
{
llResetScript();
}

// The object's sit target has been triggered
if (change & CHANGED_LINK) // Test for a changed link
{
avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY) // Is that changed link an avatar?
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
}
else
{
if (llGetPermissionsKey() != NULL_KEY)
{
llStopAnimation(animation_name);
}
}
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation(animation_name);
first = 0;
ShowMenu();
}
}

}
// --------------------------
state ReadNoteCard
{
on_rez(integer num) { llResetScript(); }

state_entry()
{
MENU = [];
ANIMS = [];
lineCounter = 0;

integer itemtype = llGetInventoryType(notecardName);
if(INVENTORY_NOTECARD == itemtype)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);
}
else
{
llOwnerSay("Error - Contents list notecard missing!");
state Running;
}

}
dataserver(key queryid, string data)
{
//Check to make sure this is the request we are making.
//Remember that when data comes back from the dataserver,
//it goes to *all* scripts in your prim.
//So you have to make sure this is the data you want, and
//not data coming from some other script.
if (dataRequestID)
{
llSetTimerEvent(0);
//If we haven't reached the end of the file
if (data != EOF)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);

lineCounter += 1;
// Each line is of the form
// Name,Animation
if(llGetSubString(data, 0,0) != ";")
{
list ldata = llParseString2List(data, [","], [""]);
string name = llList2String(ldata, 0);
string anim = llList2String(ldata, 1);
integer itemtype = llGetInventoryType(anim);
if(INVENTORY_ANIMATION == itemtype)
{
MENU = (MENU = []) + MENU + name;
ANIMS = (ANIMS = []) + ANIMS + anim;
}
else
{
llOwnerSay("Error - " + name + " (" + anim + ") Not an Animation.");
}
}
}
else
{
llSetTimerEvent(0);
state Running;
}
}
}

timer()
{
// The notecard read failed so abort
llSetTimerEvent(0);
llOwnerSay("Error reading Data.Aborting.");
state Running;
}
}


requires a notecard called "Contents List" with the following format

CODE

; Name,anim
POSE,pose_me
SIT 1,sit_ground_one


There is an inbuild Dialog menu button limit of about 12 characters per string
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
09-11-2006 09:53
From: Newgate Ludd

There is an inbuild Dialog menu button limit of about 12 characters per string



Just to add to that thought - one approach is to have the descriptions in a scrolled area at the top of the dialog (build up the "message" parameter), and then number the buttons. See "Bucky's Radio" as an example, or Pyske's security orb. The buttons start looking pretty busy/cramped if you try jam them full of descriptions.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-11-2006 10:01
From: bucky Barkley
Just to add to that thought - one approach is to have the descriptions in a scrolled area at the top of the dialog (build up the "message" parameter), and then number the buttons. See "Bucky's Radio" as an example, or Pyske's security orb. The buttons start looking pretty busy/cramped if you try jam them full of descriptions.



Yes, what ever you do its a compromise.
The scrolled area is I think 4 or 5 lines? enough for a little bit of text but as you say still cramped.

May be we should ask for a 'proper' resource editor???
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
09-11-2006 10:19
From: Newgate Ludd
Yes, what ever you do its a compromise.
The scrolled area is I think 4 or 5 lines? enough for a little bit of text but as you say still cramped.

May be we should ask for a 'proper' resource editor???


That would be grand :-)

I get 6 lines before it scrolls, and use up to ~35 chars per line. This gives me much more space to get descriptive (names of internet radio streams). Of course, this means maintaining a mapping between descriptions and numbered button inputs ...
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-11-2006 16:24
From: bucky Barkley
That would be grand :-)

I get 6 lines before it scrolls, and use up to ~35 chars per line. This gives me much more space to get descriptive (names of internet radio streams). Of course, this means maintaining a mapping between descriptions and numbered button inputs ...


6 lines isnt bad, I thought it was less.
I have a radio changer too, but just cram it all on the buttons.
time for a rewrite!!!
Artemis Winthorpe
Registered User
Join date: 20 Apr 2006
Posts: 8
09-13-2006 04:22
Hey Guys, ty for trying to help me. I copied and pasted the script you gave, but it is coming up with errors and unfortunately i am script illiterate and none of my friends with an inkling of script know-how are on atm.

At the moment it is saying:

Error: Function call mismatches type or number of arguments in ---> (id)

as below:
{
first -= pagesize;
ShowMenu(id);
}
else if("Next" == message)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
Sorry!!!
09-13-2006 04:50
From: Artemis Winthorpe
Hey Guys, ty for trying to help me. I copied and pasted the script you gave, but it is coming up with errors and unfortunately i am script illiterate and none of my friends with an inkling of script know-how are on atm.

At the moment it is saying:

Error: Function call mismatches type or number of arguments in ---> (id)

as below:
{
first -= pagesize;
ShowMenu(id);
}
else if("Next" == message)



Sorry, my fault entirely. When I merged the animation code in to the menu system I should have changed all the calls to ShowMenu(id) to just ShowMenu().

Thats what happens when you try to rush!

CODE
// Animation Player v1.0 - Newgate Ludd 
// ------------------------------------
// Written in responce to a posting on the Forums by Artemis Winthorpe
//
string notecardName = "Contents List"; // Notecard containing list of animations
integer lineCounter; // Line number within the notecard
key dataRequestID; // Data request ID
integer CHANNEL = 42; // Channel on which Dialog listens
list MENU; // Menu text for each Anim
list ANIMS; // Actual Animation name
integer maxAnims; // Number of Animations laoded
integer first; // First entry to be displayed on Dialog
integer pagesize = 8; // Number of Items per Dialog
list choices; // Current Dialog Choices
integer Listening = 0; // Listen handle
string animation_name; // Name of current animation
string new_animation_name; // Name of next animation.
key avatar; // Key of the avatar who's sitting on me

integer i; // General Purpose

// --------------------------
UpdateListen(key id)
{
CancelListen();
Listening = llListen(CHANNEL,"",id,"");
llSetTimerEvent(20);
}
// --------------------------
CancelListen()
{
if(Listening > 0) llListenRemove(Listening);
Listening = 0;
llSetTimerEvent(0);
}
// --------------------------
ShowMenu()
{
choices = [];
if(avatar == llGetOwner())
choices += ["*RELOAD*"];

// Now add the items
//len = llGetListLength( MENU );
if(first > 0)
choices += "Prev";
if(maxAnims > (first + pagesize))
{
choices += "Next";
}

for(i = 0;i < pagesize;i++)
{
string strname = llList2String(MENU,(i+first));
if( llStringLength(strname) > 0)
{
choices += strname;
}
}
// finally show the dialog
llDialog(avatar, "Which anim would you like to play?", choices, CHANNEL);
UpdateListen(avatar);
}
// --------------------------
// Set the next animation available as the active one
PlayAnimation(integer number)
{
// Get the name of the animation
new_animation_name = llList2String(ANIMS,number);

// Get the key of the avatar on the stand (or if none is present)
avatar = llAvatarOnSitTarget();

if (avatar != NULL_KEY) // Is avatar is still posing, if so then..
{
llStopAnimation(animation_name); // Stop current animation
llStartAnimation(new_animation_name); // Start next animation
}
// Set the new animation name as the current
animation_name = new_animation_name;
}
// --------------------------

default
{
state_entry() { state ReadNoteCard; }
on_rez(integer num) { llResetScript(); }
}
// --------------------------
state Running
{
state_entry()
{
animation_name = "sit";
maxAnims = llGetListLength(MENU);
llSay(0,llGetScriptName() + " Loaded - " + (string)maxAnims + " Avaliable.");
}

on_rez(integer num) { llResetScript(); }

listen(integer channel, string name, key id, string message)
{
CancelListen();
// verify dialog choice
// present main menu on request to go back

if("*RELOAD*" == message)
{
llResetScript();
}
else if("Prev" == message)
{
first -= pagesize;
ShowMenu();
}
else if("Next" == message)
{
first += pagesize;
ShowMenu();
}
else
{
integer index = llListFindList(MENU, [message]);
if(index != -1)
{
PlayAnimation(index);
}
}
}

timer()
{
CancelListen();
}

changed(integer change)
{
// Test for a changed inventory
if (change & CHANGED_INVENTORY)
{
llResetScript();
}

// The object's sit target has been triggered
if (change & CHANGED_LINK) // Test for a changed link
{
avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY) // Is that changed link an avatar?
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
}
else
{
if (llGetPermissionsKey() != NULL_KEY)
{
llStopAnimation(animation_name);
}
}
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation(animation_name);
first = 0;
ShowMenu();
}
}

}
// --------------------------
state ReadNoteCard
{
on_rez(integer num) { llResetScript(); }

state_entry()
{
MENU = [];
ANIMS = [];
lineCounter = 0;

integer itemtype = llGetInventoryType(notecardName);
if(INVENTORY_NOTECARD == itemtype)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);
}
else
{
llOwnerSay("Error - Contents list notecard missing!");
state Running;
}

}
dataserver(key queryid, string data)
{
//Check to make sure this is the request we are making.
//Remember that when data comes back from the dataserver,
//it goes to *all* scripts in your prim.
//So you have to make sure this is the data you want, and
//not data coming from some other script.
if (dataRequestID)
{
llSetTimerEvent(0);
//If we haven't reached the end of the file
if (data != EOF)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);

lineCounter += 1;
// Each line is of the form
// Name,Animation
if(llGetSubString(data, 0,0) != ";")
{
list ldata = llParseString2List(data, [","], [""]);
string name = llList2String(ldata, 0);
string anim = llList2String(ldata, 1);
integer itemtype = llGetInventoryType(anim);
if(INVENTORY_ANIMATION == itemtype)
{
MENU = (MENU = []) + MENU + name;
ANIMS = (ANIMS = []) + ANIMS + anim;
}
else
{
llOwnerSay("Error - " + name + " (" + anim + ") Not an Animation.");
}
}
}
else
{
llSetTimerEvent(0);
state Running;
}
}
}

timer()
{
// The notecard read failed so abort
llSetTimerEvent(0);
llOwnerSay("Error reading Data.Aborting.");
state Running;
}
}


Should we ok now, but I still haven't tried it in SL, been side tracked by a crematorium....
Artemis Winthorpe
Registered User
Join date: 20 Apr 2006
Posts: 8
09-13-2006 05:04
Oh no, I'm sorry to hear that. I got a friend to look at it, she took out the ID in (id). I added a contents list, but am stuck again as to what i should be putting in the script. I have it in an objet, with a couple animations and the contents list, but it doesn't do anything aside from say the animations are loaded... Perhaps when you do get a chance to come in game you would like to look at it for me? (o;

Thanks again for your help, i appreciate it a lot.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-13-2006 05:34
From: Artemis Winthorpe
Oh no, I'm sorry to hear that. I got a friend to look at it, she took out the ID in (id). I added a contents list, but am stuck again as to what i should be putting in the script. I have it in an objet, with a couple animations and the contents list, but it doesn't do anything aside from say the animations are loaded... Perhaps when you do get a chance to come in game you would like to look at it for me? (o;

Thanks again for your help, i appreciate it a lot.



Well it SHOULD be triggered when you sit on it, if not then I've messed up the changed logic.

I'm normally on somewhere between 20:00 - 00:00 GMT, midday - 4pm SLT (I think), so feel free to IM me.

And its ok, its an in world crematorium for a horror / halloween area
Artemis Winthorpe
Registered User
Join date: 20 Apr 2006
Posts: 8
09-13-2006 06:08
Thanks, i'll send you an IM in the morning if you are still on.. (o;
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-14-2006 05:29
From: Artemis Winthorpe
Oh no, I'm sorry to hear that. I got a friend to look at it, she took out the ID in (id). I added a contents list, but am stuck again as to what i should be putting in the script. I have it in an objet, with a couple animations and the contents list, but it doesn't do anything aside from say the animations are loaded... Perhaps when you do get a chance to come in game you would like to look at it for me? (o;

Thanks again for your help, i appreciate it a lot.


I realise exactly what I've done, another case of not testing properly!

The current code was adapted from a touch to a sit. It needs both to allow the user to select a different anim.

Add the following code to the Running state

CODE

touch_start(integer total_number)
{
key id = llDetectedKey(0);
// We only want the Avatar currently sat to be able to change pose
if(avatar == id) ShowMenu();
}


This will redisplay the selection menu each time the prim is touched.
Dante Breck
Spellchek Roxs
Join date: 29 Oct 2006
Posts: 113
01-15-2007 10:31
Just reading through this, does this start playing a default (or last played) animation or does it pop-up a menu upon sit to select which one to begin playing? Hmm and now just had an idea of playing a random animation upon sit ... hmmm.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-15-2007 10:54
From: Dante Breck
Just reading through this, does this start playing a default (or last played) animation or does it pop-up a menu upon sit to select which one to begin playing? Hmm and now just had an idea of playing a random animation upon sit ... hmmm.



I think it was written to start a default animation when sat upon.
Kathmandu Gilman
Fearful Symmetry Baby!
Join date: 21 May 2004
Posts: 1,418
03-17-2007 08:53
Hi there, I am having problems here. I am trying to get this to work but I am having no luck. I'm not real sporty with scripts which explains a lot :P Could you post a version of the script with the addition placed? I tried inserting it into the running state but my av just sits. Also I get no menu option. Can you explain the content notecard a bit better? I need an example because what you have makes no sense to me.

Is the actual name of the animation "sit 1" or "sit_on_ground"? Say for instance I want my first dance animation on my menu to be "Dance 1" and it is named in my inventory "slow dance 2" what should the notecard look like?

Thanks a bunch
_____________________
It may be true that the squeaky wheel gets the grease but it is also true that the squeaky wheel gets replaced at the first critical maintenance opportunity.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-17-2007 14:18
From: Kathmandu Gilman
Hi there, I am having problems here. I am trying to get this to work but I am having no luck. I'm not real sporty with scripts which explains a lot :P Could you post a version of the script with the addition placed? I tried inserting it into the running state but my av just sits. Also I get no menu option. Can you explain the content notecard a bit better? I need an example because what you have makes no sense to me.

Is the actual name of the animation "sit 1" or "sit_on_ground"? Say for instance I want my first dance animation on my menu to be "Dance 1" and it is named in my inventory "slow dance 2" what should the notecard look like?

Thanks a bunch


As posted previously, the notecard format is as follows

CODE

; Name,anim
POSE,pose_me
SIT 1,sit_ground_one


i.e. "SIT 1" will be displayed on the dialog button and play animation "sit_ground_one" when selected. i.e. for your example

CODE

Dance 1,slow dance 2


NOTE: the animation must be in the objects inventory not yours.

Orginal Code updated:
Also bug fixed.
Unless a sit target has be added to the object, llAvatarOnSitTarget will return NULL_KEY regardless.
CODE

// Animation Player v1.0 - Newgate Ludd
// ------------------------------------
// Written in responce to a posting on the Forums by Artemis Winthorpe
//
string notecardName = "Contents List"; // Notecard containing list of animations
integer lineCounter; // Line number within the notecard
key dataRequestID; // Data request ID
integer CHANNEL = 42; // Channel on which Dialog listens
list MENU; // Menu text for each Anim
list ANIMS; // Actual Animation name
integer maxAnims; // Number of Animations laoded
integer first; // First entry to be displayed on Dialog
integer pagesize = 8; // Number of Items per Dialog
list choices; // Current Dialog Choices
integer Listening = 0; // Listen handle
string animation_name; // Name of current animation
string new_animation_name; // Name of next animation.
key avatar; // Key of the avatar who's sitting on me

integer i; // General Purpose

// --------------------------
UpdateListen(key id)
{
CancelListen();
Listening = llListen(CHANNEL,"",id,"");
llSetTimerEvent(20);
}
// --------------------------
CancelListen()
{
if(Listening > 0) llListenRemove(Listening);
Listening = 0;
llSetTimerEvent(0);
}
// --------------------------
ShowMenu()
{
choices = [];
if(avatar == llGetOwner())
choices += ["*RELOAD*"];

// Now add the items
//len = llGetListLength( MENU );
if(first > 0)
choices += "Prev";
if(maxAnims > (first + pagesize))
{
choices += "Next";
}

for(i = 0;i < pagesize;i++)
{
string strname = llList2String(MENU,(i+first));
if( llStringLength(strname) > 0)
{
choices += strname;
}
}
// finally show the dialog
llDialog(avatar, "Which anim would you like to play?", choices, CHANNEL);
UpdateListen(avatar);
}
// --------------------------
// Set the next animation available as the active one
PlayAnimation(integer number)
{
// Get the name of the animation
new_animation_name = llList2String(ANIMS,number);

// Get the key of the avatar on the stand (or if none is present)
avatar = llAvatarOnSitTarget();

if (avatar != NULL_KEY) // Is avatar is still posing, if so then..
{
llStopAnimation(animation_name); // Stop current animation
llStartAnimation(new_animation_name); // Start next animation
}
// Set the new animation name as the current
animation_name = new_animation_name;
}
// --------------------------

default
{
state_entry() { state ReadNoteCard; }
on_rez(integer num) { llResetScript(); }
}
// --------------------------
state Running
{
state_entry()
{
llSitTarget(<0.,0.,0.1>,<0,0,0,90>);
animation_name = "sit";
maxAnims = llGetListLength(MENU);
llSay(0,llGetScriptName() + " Loaded - " + (string)maxAnims + " Avaliable.");
}

on_rez(integer num) { llResetScript(); }

touch_start(integer total_number)
{
key id = llDetectedKey(0);
// We only want the Avatar currently sat to be able to change pose
if(avatar == id) ShowMenu();
}

listen(integer channel, string name, key id, string message)
{
CancelListen();
// verify dialog choice
// present main menu on request to go back

if("*RELOAD*" == message)
{
llResetScript();
}
else if("Prev" == message)
{
first -= pagesize;
ShowMenu();
}
else if("Next" == message)
{
first += pagesize;
ShowMenu();
}
else
{
integer index = llListFindList(MENU, [message]);
if(index != -1)
{
PlayAnimation(index);
}
}
}

timer()
{
CancelListen();
}

changed(integer change)
{
// Test for a changed inventory
if (change & CHANGED_INVENTORY)
{
llResetScript();
}

// The object's sit target has been triggered
if (change & CHANGED_LINK) // Test for a changed link
{
avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY) // Is that changed link an avatar?
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
}
else
{
if (llGetPermissionsKey() != NULL_KEY)
{
llStopAnimation(animation_name);
}
}
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation(animation_name);
first = 0;
ShowMenu();
}
}

}
// --------------------------
state ReadNoteCard
{
on_rez(integer num) { llResetScript(); }

state_entry()
{
MENU = [];
ANIMS = [];
lineCounter = 0;

integer itemtype = llGetInventoryType(notecardName);
if(INVENTORY_NOTECARD == itemtype)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);
}
else
{
llOwnerSay("Error - Contents list notecard missing!");
state Running;
}

}
dataserver(key queryid, string data)
{
//Check to make sure this is the request we are making.
//Remember that when data comes back from the dataserver,
//it goes to *all* scripts in your prim.
//So you have to make sure this is the data you want, and
//not data coming from some other script.
if (dataRequestID)
{
llSetTimerEvent(0);
//If we haven't reached the end of the file
if (data != EOF)
{
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);

lineCounter += 1;
// Each line is of the form
// Name,Animation
if(llGetSubString(data, 0,0) != ";")
{
list ldata = llParseString2List(data, [","], [""]);
string name = llList2String(ldata, 0);
string anim = llList2String(ldata, 1);
integer itemtype = llGetInventoryType(anim);
if(INVENTORY_ANIMATION == itemtype)
{
MENU = (MENU = []) + MENU + name;
ANIMS = (ANIMS = []) + ANIMS + anim;
}
else
{
llOwnerSay("Error - " + name + " (" + anim + ") Not an Animation.");
}
}
}
else
{
llSetTimerEvent(0);
state Running;
}
}
}

timer()
{
// The notecard read failed so abort
llSetTimerEvent(0);
llOwnerSay("Error reading Data.Aborting.");
state Running;
}
}
JR Laszlo
Registered User
Join date: 29 Dec 2006
Posts: 8
Works Great Except for !!!!
03-19-2007 16:24
Im using this in a dance table and it all works great except for when dancers choose sit from the pie menu to get on the table and then choose and animation from the menu they start dancing on the floor and the table top is around their waist. How do I get the avies to dance on the table?
Kathmandu Gilman
Fearful Symmetry Baby!
Join date: 21 May 2004
Posts: 1,418
03-19-2007 17:22
Need to put the script into a separate poseball and use it to position the dancer.
_____________________
It may be true that the squeaky wheel gets the grease but it is also true that the squeaky wheel gets replaced at the first critical maintenance opportunity.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-20-2007 00:46
From: Kathmandu Gilman
Need to put the script into a separate poseball and use it to position the dancer.



Nope :) just adjust the sit target vector

Instead of
CODE
llSitTarget(<0.,0.,0.1>,<0,0,0,90>);

Try
CODE
llSitTarget(<0.,0.,1.0>,<0,0,0,90>);
JR Laszlo
Registered User
Join date: 29 Dec 2006
Posts: 8
Got em on top!!!
03-20-2007 16:45
Yep, that did her. Kinda stumbled across that oone when comparing two scripts. Im also looking to make it group use only. I have figured out its an Integer group use line and is set to true or false from an old script but there has to be some action to boot people that arent group members in the script itself. So I'm hopin for some help again. I got the new integer line to compile and save but it didnt do anything to help of course since there is no script action to accomplish what its asking for now. These will be paid tables with a camping script to pay by time and a tip script as well so they have to be for group use only or I'll go broke. The last statement was from experience btw. :)
JR Laszlo
Registered User
Join date: 29 Dec 2006
Posts: 8
Object Error ??
03-20-2007 17:13
getting an object error when a dancer sits on the table as follows:
Object: Couldn't find animation
The menu works and they can choose a dance and start dancing but the script error remains. Is this the way I have the notecard set up. I removed everything except the top line
; Name,anim
and then added the button names I wanted and the dance after the comma with no space like this:
Button,myanimname

etc listing 5 custom dances to choose from. It all works just gives this error when resetting the script
[16:59] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Dance Table Loaded - 5 Available.

and the above mentioned error when sittin on the object.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-22-2007 08:44
From: JR Laszlo
getting an object error when a dancer sits on the table as follows:
Object: Couldn't find animation
The menu works and they can choose a dance and start dancing but the script error remains. Is this the way I have the notecard set up. I removed everything except the top line
; Name,anim
and then added the button names I wanted and the dance after the comma with no space like this:
Button,myanimname

etc listing 5 custom dances to choose from. It all works just gives this error when resetting the script
[16:59] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Error - () Not an Animation.
[17:10] Object: Dance Table Loaded - 5 Available.

and the above mentioned error when sittin on the object.


drop a copy of your notecard on me in world, full mod please and I'll check it out for you
1 2