Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
10-14-2004 16:08
hi all,
im working on a pose vendor like the ones that animates your avatar for you on a base object and you can cycle through the different poses... (writing one from scratch just for practice and getting used to everything as im fairly new to scripting in LSL)
my problem is that i want to be able to incorporate a multiple payee system that shares the money paid to some number of avatars specified by me (which requires the PERMISSION_DEBIT permission to be set during setup of the vendor).
also, you obviously need to do the PERMISSION_TRIGGER_ANIMATION when a customer sits on the object.
the problem is that the original permission for PERMISSION_DEBIT gets wiped clean when executing the second llRequestPermissions function.
does anyone know of a way around this? I cannot combine permissions because in one case they are owner permissions and the other case they are non-owner permissions.
the behavior is that once someone gets on the object thus wiping the PERMISSION_DEBIT permission clean and when they pay it throws the normal permissions error when trying to debit the payout to the list of payees.
hopefully i have explained my issue ok...
thanks for any help...
Tad Jensen
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
10-14-2004 17:28
If I understand you. You think isn't possible to have two different permission granted to a script, when one is to you and the other is to some one else at the same time? Or to have two people have the same permission at the same time.
I don't have allot of experience with multiple permissions. But if I had to guess, based on your experience. I would suggest breaking up the script. if it was two separate scripts, you could use link messages to sink the scripts together. One script for paying, and one for animating.
I have an sit animation script that rotates animations, it'll rotate based on any animations in innovatory. Forwards or back words. It'll even play a specific animation, or skip by increment. i.e. jump 5 ahead, jump ten ahead. Jump twenty back. My script uses very little memory, and is rather fast at rotating animations. It happens to send out a link message of the animation currently being played.
if you had a sell script that that would take that animation name, and use that to know what to sell and the price you would be done.
|
Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
10-14-2004 17:36
From: someone If I understand you. You think isn't possible to have two different permission granted to a script, when one is to you and the other is to some one else at the same time? that is the one... i hadn't thought of breaking it into separate scripts for some reason... let me try that because I think it will be fairly easy to break my animation stuff off into its own using the linkmessage stuff as you said... thanks for the help... Tad
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
10-14-2004 17:49
well it is the only way to get around the permissions limitation. Different scripts for different permissions 
|
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
|
10-14-2004 18:39
Hi Ted. try using 2 scripts like kurt suggested. I have a few script examples i could help you out with, using llMessageLinked() These 2 scripts work together in the same object communicating with eachother. It's a tad different then the example you're looking for.... this will animate the avart that clicks on it if they accept the permissions. It also splits up the amount of the purchase price automatically between 2 people. Script 1: //----Global Declarations-------------------------------- //Created by Water Rogers
integer gPrice = 150; //---->Change this to the price of the product integer gTimer = 20; //----> The timer in seconds the animation will play if gClickAnim is TRUE string gProducts; //---->don't worry about this
integer gClickAnim = TRUE; //---->turn this FALSE if you don't want clickAnim active integer email_chan = 123456;
key gWater = "an avatars key here"; key gGwin = "another avars key here"; string anim; key owner; key gProspect;
integer gTotal; integer gTotalProducts; integer gActive = FALSE;
//----Functions------------------------------------
init(){ owner = llGetOwner(); gProducts = llGetInventoryName(INVENTORY_ANIMATION, 0); llSetObjectName(gProducts + " ($" + (string)gPrice + ")"); llRequestPermissions(owner,PERMISSION_DEBIT); }
animate(){ list presort; anim = gProducts; presort += (string)gProspect; presort += anim; presort += (string)gTimer; llMessageLinked(llGetLinkNumber(),1,llList2CSV(presort),llGetKey()); }
split_cash(string customer){ integer cut = gPrice / 2; if(owner == gGwin){ llGiveMoney(gWater, cut); llInstantMessage(gWater, "Autopay $" + (string)cut + " [" + customer + "][" + llGetRegionName() + "]"); llInstantMessage(gGwin, "Autopayed Avatar's name $" + (string)cut); } else if(owner == gWater){ llGiveMoney(gGwin, cut); llInstantMessage(gGwin, "Autopay $" + (string)cut + " [" + customer + "][" + llGetRegionName() + "]"); llInstantMessage(gWater, "Autopayed Other Avar's Name $" + (string)cut); } }
//----Run Time------------------------------------
default { state_entry(){ init(); } on_rez(integer r){ init(); } run_time_permissions(integer p){ if(p == PERMISSION_DEBIT){ gActive = TRUE; llInstantMessage(owner, "Permissions TRUE; program running optimal."); } }
touch_start(integer total_number){ gProspect = llDetectedKey(0); if((gProspect == gGwin) || (gProspect == gWater)){ if(gClickAnim){ animate(); } }else{ //llSay(0, "Hi, " + llDetectedName(0) + "! Please pay this box $" + (string)gPrice + " to purchase " + llGetObjectName()); if(gClickAnim){ animate(); } } } money(key id,integer a){ if(a == gPrice){ if(gActive){ llInstantMessage(id,"Thank you for your purchase, " + llKey2Name(id) + "!"); llGiveInventory(id,gProducts); gTotal = gTotal + a; gTotalProducts++; llShout(email_chan, (string)a); split_cash(llKey2Name(id)); } }else{ llGiveMoney(id,a); llInstantMessage(id,"Sorry, " + llKey2Name(id) + ", the correct price for this product is " + (string)gPrice); } } }
Script 2: list properties; key avatar; string anim; integer time;
default { link_message(integer s, integer n, string str, key id){ if(n == 1){ properties = llCSV2List(str); avatar = llList2Key(properties, 0); anim = llList2String(properties, 1); time = llList2Integer(properties, 2); llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); } } run_time_permissions(integer p){ if(p){ llStartAnimation(anim); llInstantMessage(avatar, "Demo of " + llGetObjectName() + " will last " + (string)time + " seconds max."); llSetTimerEvent(time); } } timer(){ llStopAnimation(anim); llSetTimerEvent(0); } } Hope this helps you along the way  --Water
_____________________
From: Philip Linden For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
|
Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
10-14-2004 19:06
thanks guys, as soon as i went back and put it into 2 separate scripts it makes much more sense and it works, yay...
i figured the permissions were tied to a user more than it would have been to the script itself so i never thought of this...
thanks for both your replies...
|