Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: SN_AnimVendor

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-20-2006 06:41
Hello there,

This is just one prim simple neat animation vendor.

:::USAGE:::
Just put this script into a prim. It changes the shape to a pedestal automatically. If you don't like it, just comment out Transform(); line under the state_entry(). And put your animations into the pedestal.
You can put your animations up to 36. (You can modify this)

*How to change the default price
Change value on the following section on the script. It means L$10. The default price affects all animations unless you designate a special price on each animation.

//////////////// Set default price here /////////////////////
integer def_PRICE = 10;
//////////////////////////////////////////////////////////

* How to change each animation's price
Add "L$" and price value on your animation?s name. For example, "YourAnimNameL$100". You can sell it for L$100. I recommend you set modifiable to your selling animations so that buyers can change their names after buying.

CODE
// Simple neat anim vendor was made by Seagel Neville as public domain, May 2006.
// modified by Kru Flan.
// Recreated by Seagel Neville.(ver0.2)
// ver0.3 released May 20th 2006.

///////////////////////// Set default price here ////////////////////////////////

integer def_PRICE = 10;

/////////////////////////////////////////////////////////////////////////

integer PRICE;
integer CHANNEL;
integer ListenHandle;
list AnimList;
list AnimList1;
list AnimList2;
list AnimList3;
integer AllAnimNum;
string ANIMATION;
key AVKey;
integer AnimNum;
string AnimName;
integer OpenedDialog;

GenCHANNEL()
{
CHANNEL = -(integer)(llFrand(100000 - 10000) + 10000);
}

GenDIALOG(key id)
{
llListenControl(ListenHandle, TRUE);
if(OpenedDialog == FALSE)
{
OpenedDialog = TRUE;
if(AllAnimNum < 13)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList1, CHANNEL);
}
else if(AllAnimNum < 25)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList2, CHANNEL);
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList1, CHANNEL);
}
else if(AllAnimNum < 37)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList3, CHANNEL);
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList2, CHANNEL);
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList1, CHANNEL);
}
}
else
{
if(AnimNum < 12)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList1, CHANNEL);
}
else if(AnimNum >= 12 && AnimNum < 24)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList2, CHANNEL);
}
else if(AnimNum >= 24 && AnimNum < 36)
{
llDialog(id, "Right-click on the pedestal and \"Pay\" amount to purchase.", AnimList3, CHANNEL);
}
}
}

Init()
{
GenCHANNEL();
ListenHandle = llListen(CHANNEL, "", "", "");
llListenControl(ListenHandle, FALSE);
OpenedDialog = FALSE;
AnimList = [];
AnimList1 = [];
AnimList2 = [];
AnimList3 = [];
AllAnimNum = llGetInventoryNumber(INVENTORY_ANIMATION);
integer i;
for(i = 0; i < AllAnimNum; i++)
{
AnimList += llGetInventoryName(INVENTORY_ANIMATION, i);
}
if(AllAnimNum < 13)
{
for(i = 0; i < AllAnimNum; i++)
{
AnimList1 += "ANIM" + (string)(i + 1);
}
}
else if(AllAnimNum < 25)
{
for(i = 0; i < 12; i++)
{
AnimList1 += "ANIM" + (string)(i + 1);
}
for(i = 12; i < AllAnimNum; i++)
{
AnimList2 += "ANIM" + (string)(i + 1);
}
}
else if(AllAnimNum < 37)
{
for(i = 0; i < 12; i++)
{
AnimList1 += "ANIM" + (string)(i + 1);
}
for(i = 12; i < 24; i++)
{
AnimList2 += "ANIM" + (string)(i + 1);
}
for(i = 24; i < AllAnimNum; i++)
{
AnimList3 += "ANIM" + (string)(i + 1);
}
}
}

StartAnim(string ANIM)
{
llStopAnimation(ANIMATION);
ANIMATION = ANIM;
llStartAnimation(ANIMATION);
GenText();
llInstantMessage(AVKey, "Now showing \"" + AnimName + "\"");
}

GenText()
{
integer separator = llSubStringIndex(ANIMATION, "L$");
if(separator == -1)
{
AnimName = ANIMATION;
PRICE = def_PRICE;
}
else
{
AnimName = llGetSubString(ANIMATION, 0, separator - 1);
integer PriceValue = (integer)llGetSubString(ANIMATION, separator + 2, -1);
PRICE = PriceValue;
}
llSetText("item " +(string)(AnimNum+1)+" of "+(string)AllAnimNum+"\n"+ AnimName
+ "\nL$" + (string)PRICE, <0, 1, 0>, 1.0);
llSetPayPrice(PAY_HIDE, [PRICE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}

Transform()
{
llSetPrimitiveParams([
PRIM_TYPE, PRIM_TYPE_CYLINDER,
0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.8, 0.8, 0.0>, <0.0, 0.0, 0.0>,
PRIM_SIZE, <1, 1, 0.2>,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0,
PRIM_BUMP_SHINY, 0, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
PRIM_BUMP_SHINY, 1, PRIM_SHINY_LOW, PRIM_BUMP_BRICKS,
PRIM_MATERIAL, PRIM_MATERIAL_STONE
]);
llSetObjectName("SN_AnimVendor");
}


default
{
state_entry()
{
Transform();
llSetSitText("TRY ON");
llSitTarget(<0, 0, 1>, ZERO_ROTATION);
llSetCameraEyeOffset(<2.5, 0, 2>);
llSetCameraAtOffset(<0, 0, 1.5>);
Init();
ANIMATION = llList2String(AnimList, AnimNum);
GenText();
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
Init();
GenText();
ANIMATION = llList2String(AnimList, AnimNum);
}
if(change & CHANGED_LINK)
{
AVKey = llAvatarOnSitTarget();
if (AVKey != NULL_KEY)
{
ANIMATION = llList2String(AnimList, AnimNum);
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}
else
{
llStopAnimation(ANIMATION);
OpenedDialog = FALSE;
llListenControl(ListenHandle, FALSE);
}
}
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStopAnimation("sit_generic");
llStartAnimation("stand");
GenDIALOG(AVKey);
}
}
listen(integer channel, string name, key id, string message)
{
string FireAnim;
if(llListFindList(AnimList1, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList1, [message]));
}
else if(llListFindList(AnimList2, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList2, [message]) + 12);
}
else if(llListFindList(AnimList3, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList3, [message]) + 24);
}
AnimNum = llListFindList(AnimList, [FireAnim]);
StartAnim(FireAnim);
GenDIALOG(AVKey);
}
money(key giver, integer amount)
{
if(amount == PRICE)
{
llGiveInventory(giver, ANIMATION);
llWhisper(0, "Thank you for purchase, " + llKey2Name(giver));
}
else
{
llWhisper(0, "Sorry, something strangge happened. Plz contact the owner.");
}
}
}
_____________________
:) Seagel Neville :)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
05-20-2006 07:00
/15/e7/107868/1.html
_____________________
i've got nothing. ;)
Star Sleestak
Registered User
Join date: 3 Feb 2006
Posts: 228
05-21-2006 09:26
Thank you!

You're a prince/princess among people!
Shep Planer
Registered User
Join date: 9 Apr 2007
Posts: 153
07-01-2007 15:08
DO I need to enter my anims name in the script somewhere?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
07-07-2007 06:42
No. It uses each animation's name.
_____________________
:) Seagel Neville :)
Shep Planer
Registered User
Join date: 9 Apr 2007
Posts: 153
08-21-2007 14:34
From: Seagel Neville
No. It uses each animation's name.


Can I change the names on the HUD? I noticed it just says anim1 anim2 ect on the buttons. Id like it to say the names of the animations.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-21-2007 19:33
HUD? I guess you mean that it is the dialog box. I dared to change such names on it because there was the limit to show the number of letters on each button.
If you want to show your animation's name, change lines under Init() functions.

Change from all '"ANIM" + (string)(i + 1);' to 'llGetInventoryName(INVENTORY_ANIMATION, i);'

For example,
From: AnimList1 += "ANIM" + (string)(i + 1);
To: AnimList1 += llGetInventoryName(INVENTORY_ANIMATION, i);
You have to do the same thing on AnimList2 and 3, too.
_____________________
:) Seagel Neville :)
Shep Planer
Registered User
Join date: 9 Apr 2007
Posts: 153
08-21-2007 20:58
From: Seagel Neville
HUD? I guess you mean that it is the dialog box. I dared to change such names on it because there was the limit to show the number of letters on each button.
If you want to show your animation's name, change lines under Init() functions.

Change from all '"ANIM" + (string)(i + 1);' to 'llGetInventoryName(INVENTORY_ANIMATION, i);'

For example,
From: AnimList1 += "ANIM" + (string)(i + 1);
To: AnimList1 += llGetInventoryName(INVENTORY_ANIMATION, i);
You have to do the same thing on AnimList2 and 3, too.



Hi Seagel thanks for the reply. So how many letters does each button allow?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-21-2007 21:07
From: Shep Planer
Hi Seagel thanks for the reply. So how many letters does each button allow?
Sorry, I don't remember it precisely. It is just a problem of showing. Maybe it can show up to 7 or 8 letters. Please try and see it actually.

Oh, and according to this page, it seems allow to use atmost 24 letters. But you can't see the most part of letters on a button if it is a long word.
_____________________
:) Seagel Neville :)
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
08-21-2007 21:32
To clarify the answer a slight bit:

24 letters is the maximum allowed for a button

The average number of letters I personally see "show up" is about half that (10-12)
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-21-2007 21:34
From: Kenn Nilsson
To clarify the answer a slight bit:

24 letters is the maximum allowed for a button

The average number of letters I personally see "show up" is about half that (10-12)

Thanks.
_____________________
:) Seagel Neville :)
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-22-2007 00:01
The money event of this "vendor" needs a serious rework.

A Proper vendor doesn't panick if the payment doesn't match the price of the product but returns the money or gives change if overpaid.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-22-2007 00:33
From: Squirrel Wood
The money event of this "vendor" needs a serious rework.

A Proper vendor doesn't panick if the payment doesn't match the price of the product but returns the money or gives change if overpaid.

The price is fixed by llSetPayPrice. What kind of situation do you think that buyers overpay sellers in?
_____________________
:) Seagel Neville :)
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
08-22-2007 02:39
From: Seagel Neville
The price is fixed by llSetPayPrice. What kind of situation do you think that buyers overpay sellers in?


This happened to me yesterday. I was at the Puppeteer's Store. I bought one animation for L$120, I then tried to buy the next one priced at L$180 (but I did not manually change the price in the Pay dialog, as I thought the price would be set automatically. I got an error message saying that the item was 180 but I had only paid 120 (left over from the previous transaction), so I paid the extra 60 and got an error message saying that the item was 180 but I had only paid 60!! So I then paid 180, got the item, and the other 180 (120 + 60) was not returned to me.

THAT is how you can overpay.

Rock
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-22-2007 04:32
From: Rock Ryder
I then tried to buy the next one priced at L$180 (but I did not manually change the price in the Pay dialog, as I thought the price would be set automatically.
Some vender happens that. But the price should be set automatically on this vendor. And you can't pay manually, either. If something bad happens, such as having no item, it won't be able to help by that change system. It should be informed asap.
One thinkable thing is that a person selects the lowest priced animation and opens up the paying dialog box, then changes to the highest priced one and tries to buy with the old lowest paying dialog box. Don't you think that you want to talk with such a person? :D
If not, I recommend you sell all of animations at the same price on each vendor.
_____________________
:) Seagel Neville :)
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-22-2007 07:12
Just to make it clear:

Never ever, ever, ever, ever trust a payment to be correct. Always verify. Even if you use llSetPayPrice.

This dialog is NOT modal so someone could in theory exploit it.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
08-22-2007 17:57
From: Squirrel Wood
Just to make it clear:

Never ever, ever, ever, ever trust a payment to be correct. Always verify. Even if you use llSetPayPrice.

This dialog is NOT modal so someone could in theory exploit it.
I agree, you should test.. However, I disagree that handling should be included to handle an over/under payment (aside from a simple IM and instructions to contact the seller).

I also use the llSetPayPrice so it should be impossible for the wrong amount to be paid. This allows the vendor to not require debit permissions to be granted, which is a bonus in my opinion. If, for whatever reason, a customer manages to mis-pay, then a simple IM is sent with instruction to contact the seller.

note: I think the one way a person could pay the wrong amount would be to use a 3rd-party version of the SL client.... though I thought that was fixed a long time ago.
Shep Planer
Registered User
Join date: 9 Apr 2007
Posts: 153
08-24-2007 02:26
I have made three animations one each for Tall, short and average AV's. I did this because they are laying and kneeling anims. when trying the anims on the vendor it makeds no difference and the AVs are suspended above ground etc like I have not made them correctly. When I "play in world from" my INventory they are fine but not in the Vendor. D0 I need to make adjustments to the script?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-24-2007 06:50
From: Squirrel Wood
Just to make it clear:

Never ever, ever, ever, ever trust a payment to be correct. Always verify. Even if you use llSetPayPrice.

This dialog is NOT modal so someone could in theory exploit it.

Veryfing was done. What you are taling about is how to deal with it when the problem occurs, isn't it?
If the exploit were viewed with suspiton, you should never give customers change or refund easily. Because they can't input other amount of price manually ever again.

This might have to be replaced with else section under money event.

CODE
else
{
llWhisper(0, "Sorry, something strangge happened. This trouble is reported to the owner. " + llKey2Name(llGetOwner()) + " will contact you as soon as possible. And this vendor becomes deactivated untill the investigation is finished. Sorry for inconvenience and please be patient.");
llInstantMessage(llGetOwner(), "Warning: Trouble happened. " + llKey2Name(giver) + " paied L$" + (string)amount + " for " + ANIMATION + ". This vendor's location is " + llGetRegionName() + (string)llGetPos() + ".");
llSetText("Sorry, this is currently not available.", <1, 0, 0>, 1.0);
llSetScriptState(llGetInventoryName(INVENTORY_SCRIPT, 0), FALSE);
}


And add a line under state_entry event.

llSetText("", <1, 1, 1>, 0.0);

When you restart this vendor, you have to mark the running box of this script and reset it.

From: Shep Planer
I have made three animations one each for Tall, short and average AV's. I did this because they are laying and kneeling anims. when trying the anims on the vendor it makeds no difference and the AVs are suspended above ground etc like I have not made them correctly. When I "play in world from" my INventory they are fine but not in the Vendor. D0 I need to make adjustments to the script?

The height of animation comes from each avatar's height of hip, that is the length of its legs. You made three level's height laying animations. Those differences are the distance from the hip. You can never see it from the ground, but from the hip.
Put a standing animation in it and play it. The avatar's feet may be floating. And remember the positon of the feet in space. Then change to your laying animations. They may be floating but you have to compare them with the feet positon in your mind.
Anyway, it needs some knowledge of animations for customers. It may be difficult to sell such animtaions by this kind of vendor. Sorry for that.
_____________________
:) Seagel Neville :)
Shep Planer
Registered User
Join date: 9 Apr 2007
Posts: 153
08-24-2007 14:51
I noticed you have a number for the texture of thr prim. How do I change the texture? Where do I find this number ? I looked at some textures but they didnt have numbers like this. Thanks
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-26-2007 11:17
From: Shep Planer
I noticed you have a number for the texture of thr prim. How do I change the texture? Where do I find this number ? I looked at some textures but they didnt have numbers like this. Thanks


From: someone
:::USAGE:::
Just put this script into a prim. It changes the shape to a pedestal automatically. If you don't like it, just comment out Transform(); line under the state_entry().

Shape and texture are decided on "Transform" function.
So if you want to change the shape and texture, comment out the line like this..
CODE
default
{
state_entry()
{
//Transform();
llSetSitText("TRY ON");
llSitTarget(<0, 0, 1>, ZERO_ROTATION);

Or delete the line, "Transform();".
Then, you can put your own texture on it.

If you want to know about UUID of your own texture, right click it in your inventory and select "Copy Asset UUID". And paste it on your script.
_____________________
:) Seagel Neville :)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
SN_AnimVendor II
11-26-2007 03:54
I got several responses and I decided to improve this vendor again.

What changes?
1. The dialog box opens neatly much more.
2. You can put animations up to 63.
3. The names of buttons show their name.
4. You can give animations when you set price to L$0.

CODE
// Simple neat anim vendor was made by Seagel Neville as public domain, May 2006.
// modified by Kru Flan.
// Recreated by Seagel Neville.(ver0.2)
// ver0.3 released May 20th 2006.
// Showing the name of anims on button and opeining a compact dialog box on ver0.4, Nov 2007.

///////////////////////// Set default price here ////////////////////////////////

integer def_PRICE = 10;

/////////////////////////////////////////////////////////////////////////

integer PRICE;
integer CHANNEL;
integer ListenHandle;
list AnimList;
list AnimList01;
list AnimList02;
list AnimList03;
list AnimList04;
list AnimList05;
list AnimList06;
list AnimList07;
integer AllAnimNum;
string ANIMATION;
key AVKey;
integer AnimNum;
string AnimName;
integer gPage = 1;
integer maxPage;
string msg = "Right-click on the pedestal and \"Pay\" amount to purchase.";
integer freeFlag;


GenCHANNEL()
{
CHANNEL = -(integer)(llFrand(100000 - 10000) + 10000);
}

GenDIALOG(key id, integer page)
{
llListenControl(ListenHandle, TRUE);
if(page == 1)
{
llDialog(id, msg, AnimList01, CHANNEL);
}
else if(page == 2)
{
llDialog(id, msg, AnimList02, CHANNEL);
}
else if(page == 3)
{
llDialog(id, msg, AnimList03, CHANNEL);
}
else if(page == 4)
{
llDialog(id, msg, AnimList04, CHANNEL);
}
else if(page == 5)
{
llDialog(id, msg, AnimList05, CHANNEL);
}
else if(page == 6)
{
llDialog(id, msg, AnimList06, CHANNEL);
}
else if(page == 7)
{
llDialog(id, msg, AnimList07, CHANNEL);
}
}

Init()
{
GenCHANNEL();
ListenHandle = llListen(CHANNEL, "", "", "");
llListenControl(ListenHandle, FALSE);
AnimList01 = ["<<", "CANCEL", ">>"];
AnimList02 = ["<<", "CANCEL", ">>"];
AnimList03 = ["<<", "CANCEL", ">>"];
AnimList04 = ["<<", "CANCEL", ">>"];
AnimList05 = ["<<", "CANCEL", ">>"];
AnimList06 = ["<<", "CANCEL", ">>"];
AnimList07 = ["<<", "CANCEL", ">>"];
AllAnimNum = llGetInventoryNumber(INVENTORY_ANIMATION);
llOwnerSay("Found " + (string)AllAnimNum + " animations.");
integer i;
if(AllAnimNum > 63)
{
llWhisper(0, "Warning, you can put up to only " + (string)63 + " animations into this.");
AllAnimNum = 63;
}
if(AllAnimNum < 10)
{
maxPage = 1;
for(i = 0; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 19)
{
maxPage = 2;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 28)
{
maxPage = 3;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 37)
{
maxPage = 4;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < 27; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
for(i = 27; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList04 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 46)
{
maxPage = 5;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < 27; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
for(i = 27; i < 36; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList04 += llGetSubString(name, 0, 20);
}
for(i = 36; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList05 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 55)
{
maxPage = 6;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < 27; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
for(i = 27; i < 36; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList04 += llGetSubString(name, 0, 20);
}
for(i = 36; i < 45; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList05 += llGetSubString(name, 0, 20);
}
for(i = 45; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList06 += llGetSubString(name, 0, 20);
}
}
else if(AllAnimNum < 64)
{
maxPage = 7;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < 27; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
for(i = 27; i < 36; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList04 += llGetSubString(name, 0, 20);
}
for(i = 36; i < 45; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList05 += llGetSubString(name, 0, 20);
}
for(i = 45; i < 54; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList06 += llGetSubString(name, 0, 20);
}
for(i = 54; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList07 += llGetSubString(name, 0, 20);
}
}
}

StartAnim(string ANIM)
{
llStopAnimation(ANIMATION);
ANIMATION = ANIM;
llStartAnimation(ANIMATION);
GenText();
llInstantMessage(AVKey, "Now showing \"" + AnimName + "\"");
}

GenText()
{
integer separator = llSubStringIndex(ANIMATION, "L$");
if(separator == -1)
{
AnimName = ANIMATION;
PRICE = def_PRICE;
if(PRICE == 0)
{
freeFlag = TRUE;
llSetText("item " +(string)(AnimNum+1)+" of "+(string)AllAnimNum+"\n"+ AnimName
+ "\nTouch To Take", <0, 1, 0>, 1.0);
return;
}
else
{
freeFlag = FALSE;
}
}
else
{
AnimName = llGetSubString(ANIMATION, 0, separator - 1);
integer PriceValue = (integer)llGetSubString(ANIMATION, separator + 2, -1);
PRICE = PriceValue;
if(PRICE == 0)
{
freeFlag = TRUE;
llSetText("item " +(string)(AnimNum+1)+" of "+(string)AllAnimNum+"\n"+ AnimName
+ "\nTouch To Take", <0, 1, 0>, 1.0);
return;
}
else
{
freeFlag = FALSE;
}
}
llSetText("item " +(string)(AnimNum+1)+" of "+(string)AllAnimNum+"\n"+ AnimName
+ "\nL$" + (string)PRICE, <0, 1, 0>, 1.0);
llSetPayPrice(PAY_HIDE, [PRICE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}

Transform()
{
llSetPrimitiveParams([
PRIM_TYPE, PRIM_TYPE_CYLINDER,
0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.8, 0.8, 0.0>, <0.0, 0.0, 0.0>,
PRIM_SIZE, <1, 1, 0.2>,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <0,0,0>, 0,
PRIM_BUMP_SHINY, 0, PRIM_SHINY_LOW, PRIM_BUMP_NONE,
PRIM_BUMP_SHINY, 1, PRIM_SHINY_LOW, PRIM_BUMP_BRICKS,
PRIM_MATERIAL, PRIM_MATERIAL_STONE
]);
llSetObjectName("SN_AnimVendor II");
}


default
{
state_entry()
{
Transform();
llSetSitText("TRY ON");
llSitTarget(<0, 0, 1.2>, ZERO_ROTATION);
llSetCameraEyeOffset(<2.5, 0, 2>);
llSetCameraAtOffset(<0, 0, 1.5>);
Init();
ANIMATION = llList2String(AnimList, AnimNum);
GenText();
llOwnerSay("The rest memory is " + (string)llGetFreeMemory() + "kb.");
}
on_rez(integer reset)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
if(change & CHANGED_LINK)
{
AVKey = llAvatarOnSitTarget();
if (AVKey != NULL_KEY)
{
ANIMATION = llList2String(AnimList, AnimNum);
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}
else
{
llStopAnimation(ANIMATION);
llListenControl(ListenHandle, FALSE);
}
}
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStopAnimation("sit_generic");
llStartAnimation("stand");
GenDIALOG(AVKey, gPage);
}
}
touch_start(integer num_detected)
{
if(freeFlag)
{
llGiveInventory(llDetectedKey(0), ANIMATION);
}
}
listen(integer channel, string name, key id, string message)
{
if(message == "CANCEL")
{
llUnSit(AVKey);
}
else if(message == "<<")
{
gPage--;
if(gPage < 1)
{
gPage = maxPage;
}
GenDIALOG(AVKey, gPage);
}
else if(message == ">>")
{
gPage++;
if(gPage > maxPage)
{
gPage = 1;
}
GenDIALOG(AVKey, gPage);
}
else
{
string FireAnim;
if(llListFindList(AnimList01, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList01, [message]) - 3);
}
else if(llListFindList(AnimList02, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList02, [message]) + 6);
}
else if(llListFindList(AnimList03, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList03, [message]) + 15);
}
else if(llListFindList(AnimList04, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList04, [message]) + 24);
}
else if(llListFindList(AnimList05, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList05, [message]) + 33);
}
else if(llListFindList(AnimList06, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList06, [message]) + 42);
}
else if(llListFindList(AnimList07, [message]) != -1)
{
FireAnim = llList2String(AnimList, llListFindList(AnimList07, [message]) + 51);
}
AnimNum = llListFindList(AnimList, [FireAnim]);
StartAnim(FireAnim);
GenDIALOG(AVKey, gPage);
}
}
money(key giver, integer amount)
{
if(amount == PRICE)
{
llGiveInventory(giver, ANIMATION);
llWhisper(0, "Thank you for purchase, " + llKey2Name(giver));
}
else
{
llWhisper(0, "Sorry, something strangge happened. Plz contact the owner.");
}
}
}
_____________________
:) Seagel Neville :)
Espresso Saarinen
old geek
Join date: 22 Jan 2006
Posts: 93
11-26-2007 19:36
i get
SN_AnimVendor II: llDialog: all buttons must have label strings
after clicking >> three times with 33 or 34 anims in the prim.

i also get
SN_AnimVendor II: Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set

i think i see it. for ALL anim counts < 63, e.g. for 33 etc.
CODE

if(AllAnimNum < 64)
{
maxPage = 7;
for(i = 0; i < 9; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList01 += llGetSubString(name, 0, 20);
}
for(i = 9; i < 18; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList02 += llGetSubString(name, 0, 20);
}
for(i = 18; i < 27; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList03 += llGetSubString(name, 0, 20);
}
for(i = 27; i < 36; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList04 += llGetSubString(name, 0, 20);
}
for(i = 36; i < 45; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList05 += llGetSubString(name, 0, 20);
}
for(i = 45; i < 54; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList06 += llGetSubString(name, 0, 20);
}
for(i = 54; i < AllAnimNum; i++)
{
string name = llGetInventoryName(INVENTORY_ANIMATION, i);
AnimList += name;
AnimList07 += llGetSubString(name, 0, 20);
}
}

is always gonna be executed, and therefore the appropriate else clauses will not be used.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
I seem to figure out
11-26-2007 20:34
Thank you, Espresso. It was totally my mistake. Anyway, I fixed it. I didn't get "permission not set problem". I need to look through it much more.

---Several minutes later---
I fiugre out.
When you press the CANCEL button, avatar stands up and is about to stop animation. But when the avatar stands up, changed event fires and stops animation. So it stops double. I fixed it and hope it works well.
_____________________
:) Seagel Neville :)
Espresso Saarinen
old geek
Join date: 22 Jan 2006
Posts: 93
11-26-2007 21:01
how about something like (excuse pseudocode, i hate lsl, though i code it)
CODE

list foo (integer start, integer end) {
integer i = start;
list lst = [];
while (i <= end) lst += llGet(ANIM,i++);
return lst;
}

if i > 8 {
n = max (i, 7);
AnimList0 = foo ( 0, n );
}
if i > 16 {
n = max (i, 15);
AnimList1 = foo ( 8, n );
}

or something like that
1 2