HELP,,,, camping pad script
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
11-12-2006 13:44
ok the only problem with the camp script is Error when people stand up befor they earn any money caue you cant pay 0L$ to people, and also i need a LLgetanimation script intagraded into this camp script so here is the camper integer campmoney = 0; // Initial amount to grant someone upon the VERY first sit after first rez. (Think, Special bonus) integer campadd = 1; // Payout amount integer camptime = 600; // Payout time in seconds (Script USES this) string camptimeM = "10 minutes"; // Payout time in minutes (Attract SAYS this) string reciever = NULL_KEY; // key of Sitter
list MenuChoices = ["On","Off","Payout","Bonus","Time"]; list AmountChoices = ["1$","2$","3$","4$","5$","10$", "20"]; list BonusChoices = ["1$ Bonus","2$ Bonus","3$ Bonus","4$ Bonus","5$ Bonus","10$ Bonus"]; list TimerChoices = ["1 minute","5 minutes","10 minutes","15 minutes","20 minutes","30 minutes","60 minutes"]; integer Listening = 0; integer listenchannel = 0;
UpdateListen(key id) { CancelListen(); Listening = llListen(listenchannel,"",id,""); llSetTimerEvent(30); }
CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
// Owner Conversation Dialog ShowMainMenu(key id) { string text = "Main Menu\nPlease Select an Option"; // finally show the dialog llDialog(id,text,MenuChoices,listenchannel); UpdateListen(id); }
ShowPayoutMenu(key id) { string text = "Payout Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,AmountChoices,listenchannel); UpdateListen(id); }
ShowBonusMenu(key id) { string text = "Bonus Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,BonusChoices,listenchannel); UpdateListen(id); }
ShowTimerMenu(key id) { string text = "Timer Menu\nPlease Select a time period"; // finally show the dialog llDialog(id,text,TimerChoices,listenchannel); UpdateListen(id); }
SetInactive() { reciever = NULL_KEY; // forget who the receiver was campmoney = 0; // reset earning count to 0 llSetText("Group Members sit here for free money,\nL$" + (string)campadd + " every "+camptimeM,<0,1,0>,1); // change hovertext back to attract mode llSetTimerEvent(0); // Nobody is sitting on me, so no need to call myself anymore. Disable timer. } // States default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT ); //Ask my owner for permission to give money and assume it suceeds state Running; } on_rez(integer num) { llResetScript(); } }
state Running { state_entry() { llSetText("Group Members sit here for free money,\nL$"+(string)campadd+" every "+camptimeM,<0,1,0>,1); // Set the hovertext to attract mode llSitTarget(<0.4, 0.0, 0.4>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work }
changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY) { // if Avatar key isn't empty, somebody is sitting on me if ( llSameGroup(llAvatarOnSitTarget()) ) // Check that the sitter is of the same group as the prim { // if so, allow them to sit and start the payments reciever = llAvatarOnSitTarget(); // store sitting avatar's key llSetText("You have earned: L$"+(string)campmoney,<1,1,1>,1); // Setting hovertext to current amount earned llSetTimerEvent(camptime); // amount of time between payments in seconds } else { // if not, boot them off with an explanation. llSay(0, "Group members only, sorry."); llSay(0, "If you are a group member, please \"wear your tags\" by making the group active.."); llUnSit(llAvatarOnSitTarget()); // unsit him or her } } else if( reciever != NULL_KEY ) { // if the avatar has gotten up llGiveMoney(reciever,campmoney); // give the avatar the amount of money he has earned. SetInactive(); } } } timer() { campmoney = campmoney+campadd; // current amount + xL$ per camptime llSetText("Money: L$"+(string)campmoney,<0,1,0>,1); // update hovertext with currently earned amount if (llAvatarOnSitTarget() == NULL_KEY) { // Noone's sitting on me, reset the vars SetInactive(); } } touch_start(integer total_number) { // Owner key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } }
state Menu { state_entry() { ShowMainMenu(llGetOwner()); } on_rez(integer num) { state default; }
timer() { CancelListen(); state Running; }
listen( integer channel, string name, key id, string message ) { CancelListen(); if("On" == message) state Running; else if("Off" == message) state Disabled; else if("Payout" == message) ShowPayoutMenu(id); else if("Bonus" == message) ShowBonusMenu(id); else if("Time" == message) ShowTimerMenu(id); else { integer index = llListFindList(AmountChoices, [ message ]); if(index >= 0) { campadd = (integer)message; state Running; } else { index = llListFindList(BonusChoices , [ message ]); if(index >= 0) { campmoney = (integer)message; state Running; } else { index = llListFindList(TimerChoices, [ message ]); if(index >= 0) { camptimeM = message; camptime = 60 * (integer)message; // Payout time in seconds (Script USES this) state Running; } } } } } }
state Disabled { state_entry() { llSetText("OFF",<1,0,0>,1); // Set the hovertext to attract mode } touch_start(integer total_number) { // Owner or owner Group control key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } }
and here is the sit scirpt i want to intergrade key avatar = NULL_KEY; vector pos = <0,0,-0.5>; //adjust the (x,y,z) position to fit object
string sittext = ""; // Adjust this to your needs but keep it short!
string animation; // The first animation in object will be used
default { state_entry() { animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSitTarget(pos, ZERO_ROTATION); llSetSitText(sittext); } changed(integer change) { avatar = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if(avatar == NULL_KEY) { // // Avatar has stood up // llStopAnimation(animation); llSetAlpha(1.0,ALL_SIDES); } else if(avatar == llAvatarOnSitTarget()) { // // Avatar just sat // llSetAlpha(0.0,ALL_SIDES); llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION ); } } if (change & CHANGED_INVENTORY) { // // reset scrit if inventory changes // llResetScript(); } } on_rez(integer num){ llResetScript(); } run_time_permissions(integer perms) { if(perms) { llStopAnimation("sit"); llStartAnimation(animation); } else { llUnSit(avatar); llResetScript(); } } }
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-12-2006 14:52
Allatu, To stop the zero payout error change the money event as shown below else if( reciever != NULL_KEY ) { // if the avatar has gotten up // If they have earnt any money if(campmoney > 0) llGiveMoney(reciever,campmoney); // give the avatar the amount of money he has earned. SetInactive(); }
As for integerating the second script, have you tried just having both running at the same time? I dont think they will interfere with each other. here is a quick attempt at integrating it, UNTESTED I'm afraid integer campmoney = 0; // Initial amount to grant someone upon the VERY first sit after first rez. (Think, Special bonus) integer campadd = 1; // Payout amount integer camptime = 600; // Payout time in seconds (Script USES this) string camptimeM = "10 minutes"; // Payout time in minutes (Attract SAYS this) string reciever = NULL_KEY; // key of Sitter
list MenuChoices = ["On","Off","Payout","Bonus","Time"]; list AmountChoices = ["1$","2$","3$","4$","5$","10$", "20"]; list BonusChoices = ["1$ Bonus","2$ Bonus","3$ Bonus","4$ Bonus","5$ Bonus","10$ Bonus"]; list TimerChoices = ["1 minute","5 minutes","10 minutes","15 minutes","20 minutes","30 minutes","60 minutes"]; integer Listening = 0; integer listenchannel = 0;
// Modificatiosn for Amination vector pos = <0,0,-0.5>; //adjust the (x,y,z) position to fit object string sittext = ""; // Adjust this to your needs but keep it short! string animation; // The first animation in object will be used
UpdateListen(key id) { CancelListen(); Listening = llListen(listenchannel,"",id,""); llSetTimerEvent(30); }
CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
// Owner Conversation Dialog ShowMainMenu(key id) { string text = "Main Menu\nPlease Select an Option"; // finally show the dialog llDialog(id,text,MenuChoices,listenchannel); UpdateListen(id); }
ShowPayoutMenu(key id) { string text = "Payout Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,AmountChoices,listenchannel); UpdateListen(id); }
ShowBonusMenu(key id) { string text = "Bonus Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,BonusChoices,listenchannel); UpdateListen(id); }
ShowTimerMenu(key id) { string text = "Timer Menu\nPlease Select a time period"; // finally show the dialog llDialog(id,text,TimerChoices,listenchannel); UpdateListen(id); }
SetInactive() { reciever = NULL_KEY; // forget who the receiver was campmoney = 0; // reset earning count to 0 llSetText("Group Members sit here for free money,\nL$" + (string)campadd + " every "+camptimeM,<0,1,0>,1); // change hovertext back to attract mode llSetTimerEvent(0); // Nobody is sitting on me, so no need to call myself anymore. Disable timer. } // States default { state_entry() { animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSitTarget(pos, ZERO_ROTATION); llSetSitText(sittext); llRequestPermissions(llGetOwner(),PERMISSION_DEBIT ); //Ask my owner for permission to give money and assume it suceeds state Running; } on_rez(integer num) { llResetScript(); } }
state Running { state_entry() { llSetText("Group Members sit here for free money,\nL$"+(string)campadd+" every "+camptimeM,<0,1,0>,1); // Set the hovertext to attract mode llSitTarget(<0.4, 0.0, 0.4>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work }
changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY) { // if Avatar key isn't empty, somebody is sitting on me if ( llSameGroup(llAvatarOnSitTarget()) ) // Check that the sitter is of the same group as the prim { // if so, allow them to sit and start the payments reciever = llAvatarOnSitTarget(); // store sitting avatar's key llSetText("You have earned: L$"+(string)campmoney,<1,1,1>,1); // Setting hovertext to current amount earned llSetTimerEvent(camptime); // amount of time between payments in seconds llRequestPermissions(reciever,PERMISSION_TRIGGER_ANIMATION ); } else { // if not, boot them off with an explanation. llSay(0, "Group members only, sorry."); llSay(0, "If you are a group member, please \"wear your tags\" by making the group active.."); llUnSit(llAvatarOnSitTarget()); // unsit him or her } } else if( reciever != NULL_KEY ) { // if the avatar has gotten up llStopAnimation(animation); if(campmoney > 0) llGiveMoney(reciever,campmoney); // give the avatar the amount of money he has earned. SetInactive(); } } else if (change & CHANGED_INVENTORY) { // // reset script if inventory changes // llResetScript(); } } timer() { campmoney = campmoney+campadd; // current amount + xL$ per camptime llSetText("Money: L$"+(string)campmoney,<0,1,0>,1); // update hovertext with currently earned amount if (llAvatarOnSitTarget() == NULL_KEY) { // Noone's sitting on me, reset the vars SetInactive(); } } touch_start(integer total_number) { // Owner key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } run_time_permissions(integer perms) { if(perms) { llStopAnimation("sit"); llStartAnimation(animation); } else { llUnSit(reciever); llResetScript(); } } }
state Menu { state_entry() { ShowMainMenu(llGetOwner()); } on_rez(integer num) { state default; }
timer() { CancelListen(); state Running; }
listen( integer channel, string name, key id, string message ) { CancelListen(); if("On" == message) state Running; else if("Off" == message) state Disabled; else if("Payout" == message) ShowPayoutMenu(id); else if("Bonus" == message) ShowBonusMenu(id); else if("Time" == message) ShowTimerMenu(id); else { integer index = llListFindList(AmountChoices, [ message ]); if(index >= 0) { campadd = (integer)message; state Running; } else { index = llListFindList(BonusChoices , [ message ]); if(index >= 0) { campmoney = (integer)message; state Running; } else { index = llListFindList(TimerChoices, [ message ]); if(index >= 0) { camptimeM = message; camptime = 60 * (integer)message; // Payout time in seconds (Script USES this) state Running; } } } } } }
state Disabled { state_entry() { llSetText("OFF",<1,0,0>,1); // Set the hovertext to attract mode } touch_start(integer total_number) { // Owner or owner Group control key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } }
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
11-12-2006 15:01
From: Newgate Ludd As for integerating the second script, have you tried just having both running at the same time? I dont think they will interfere with each other.
ya i tried but when you would chage a setting on the campscript it would mess with the sittarget in the sit script and the X, Y, and Z vectores would reset to 0 and again ty for all your help i have sent you 400L$ ingame for your time 
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-12-2006 15:22
From: Allatu Augustus ya i tried but when you would chage a setting on the campscript it would mess with the sittarget in the sit script and the X, Y, and Z vectores would reset to 0 and again ty for all your help i have sent you 400L$ ingame for your time  TY but you really didnt need to. But it is appreciated.
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
ok its kinda working but then its not
11-12-2006 20:12
here is what i get when i sit and stand up after setting the time to 1min
camppadformen: Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set camppadformen: Script trying to trigger animations but PERMISSION_TRIGGER_ANIMATION permission not set camppadformen: Script trying to debit L$ from owner but PERMISSION_DEBIT permission not set!
prolly needs to be debugged, so the animation is working but its not paying out money
|
Kator Bergson
I'm freakin out man!
Join date: 24 Nov 2005
Posts: 125
|
Randomness? o.O
11-13-2006 00:27
Currently I'm too tired to write anything up, but why hasn't anybody thought of a random channel? You click the Camping thing-a-majig it picks out a random channel and works on that untill a "done" button is pressed? That way you could have like a thousand chairs out if you wanted o.O and NEVER have to worry about the chance that any of the chairs will pick up on the one your configuring. Have all the chairs sit idle at channel 0, when clicked they pick a random channel, when "done" is pressed, settings saved and chair reverts back to 0 or some negative channel to prevent accidental Owner chat from accessing somethin wierd. Yes, No, Go screw yourself Kator?
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
11-13-2006 13:08
From: Kator Bergson Currently I'm too tired to write anything up, but why hasn't anybody thought of a random channel? You click the Camping thing-a-majig it picks out a random channel and works on that untill a "done" button is pressed? That way you could have like a thousand chairs out if you wanted o.O and NEVER have to worry about the chance that any of the chairs will pick up on the one your configuring. Have all the chairs sit idle at channel 0, when clicked they pick a random channel, when "done" is pressed, settings saved and chair reverts back to 0 or some negative channel to prevent accidental Owner chat from accessing somethin wierd. Yes, No, Go screw yourself Kator? Not needed at all, if you do things right and know what your doing you have no need for a system like that, this script will work on only THE chair your working on unless you have two of them basicly touching eachother so just put them 5 or 6 Meeters away from eachother and they dont inter fear with eachother.
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
11-13-2006 14:45
Allatu..do a search on camping chairs in world. You'll find that MOST camping chairs are in fact clustered less than 1m apart... ususally in groups of 6-20
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-13-2006 16:08
From: Kator Bergson Currently I'm too tired to write anything up, but why hasn't anybody thought of a random channel? Its used quite often. In fact I use it all the time in 'real scripts'. Didnt here as it was just a quickie. Change the state menu state_Entry as follows:- state Menu { state_entry() { listenchannel = (integer)llFrand(1000)+1000; ShowMainMenu(llGetOwner()); }
...
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
11-13-2006 16:28
From: Winter Ventura Allatu..do a search on camping chairs in world. You'll find that MOST camping chairs are in fact clustered less than 1m apart... ususally in groups of 6-20 went ingame and made a prim between my two camp chairs tested the change diolog to check if it would make them both work and it didnt and if you build a prim of this size 0.237 and put your chairs one on each side they still work fine and dandy, so when i typed 5 or 6 meeters it was just a exprestion
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
still wont payout
11-13-2006 16:35
it still wont payout but not getten the error any more,,,,, LMAO and when i click it, the chair moves a tad, whats with that?
i take that back i did get a error PERMISSION_TRIGGER_ANIMATION permission not set camppadformen: Script trying to debit L$ from owner but PERMISSION_DEBIT permission not set!
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-15-2006 13:26
From: Allatu Augustus it still wont payout but not getten the error any more,,,,, LMAO and when i click it, the chair moves a tad, whats with that?
i take that back i did get a error PERMISSION_TRIGGER_ANIMATION permission not set camppadformen: Script trying to debit L$ from owner but PERMISSION_DEBIT permission not set! My apologies Allatu, Not sure what is going haywire but sounds like the permissions are failing. Is it asking for them in the first place? (it should be...) If I can get in game later I will try to sort this out.
|
Allatu Augustus
Allatu Agustus
Join date: 19 Nov 2005
Posts: 32
|
11-15-2006 14:38
From: Newgate Ludd My apologies Allatu, Not sure what is going haywire but sounds like the permissions are failing. Is it asking for them in the first place? (it should be...)
If I can get in game later I will try to sort this out. ya hun its asking when i reset the script but just isnt working.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
D'oh!
11-15-2006 16:01
Well it was setting the permissions that was screwing up. Its bloody obvious when I think about it setting permissions is an over write, so when you as teh owner sat on it it deleted the owner debit permissions when it asked for the animation permissions I have noticed a bug though. It uses resetscript which will delete any alterations made to price and time etc. need to save this data between resets (done) integer campmoney = 0; // Initial amount to grant someone upon the VERY first sit after first rez. (Think, Special bonus) integer campadd = 1; // Payout amount integer camptime = 600; // Payout time in seconds (Script USES this) string camptimeM = "10 minutes"; // Payout time in minutes (Attract SAYS this) string reciever = NULL_KEY; // key of Sitter
list MenuChoices = ["On","Off","Payout","Bonus","Time"]; list AmountChoices = ["1$","2$","3$","4$","5$","10$", "20"]; list BonusChoices = ["1$ Bonus","2$ Bonus","3$ Bonus","4$ Bonus","5$ Bonus","10$ Bonus"]; list TimerChoices = ["1 minute","5 minutes","10 minutes","15 minutes","20 minutes","30 minutes","60 minutes"]; integer Listening = 0; integer listenchannel = 0;
// Modificatiosn for Amination vector pos = <0,0,-0.5>; //adjust the (x,y,z) position to fit object string sittext = ""; // Adjust this to your needs but keep it short! string animation; // The first animation in object will be used
SaveParameters() { llSetObjectDesc((string)campmoney + "/" + (string)camptime + "/" + (string)campadd); }
GetParameters() { string str = llGetObjectDesc(); list ldata = llParseString2List(str, ["/"], [""]); if(llGetListLength(ldata) == 3) { campmoney = llList2Integer(ldata,0); camptime = llList2Integer(ldata,1); campadd = llList2Integer(ldata,2); } }
UpdateListen(key id) { CancelListen(); Listening = llListen(listenchannel,"",id,""); llSetTimerEvent(30); }
CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
// Owner Conversation Dialog ShowMainMenu(key id) { string text = "Main Menu\nPlease Select an Option"; // finally show the dialog llDialog(id,text,MenuChoices,listenchannel); UpdateListen(id); }
ShowPayoutMenu(key id) { string text = "Payout Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,AmountChoices,listenchannel); UpdateListen(id); }
ShowBonusMenu(key id) { string text = "Bonus Menu\nPlease Select an amount"; // finally show the dialog llDialog(id,text,BonusChoices,listenchannel); UpdateListen(id); }
ShowTimerMenu(key id) { string text = "Timer Menu\nPlease Select a time period"; // finally show the dialog llDialog(id,text,TimerChoices,listenchannel); UpdateListen(id); }
SetInactiveText() { llSetText("Group Members sit here for free money,\nL$"+(string)campadd+" every "+camptimeM,<0,1,0>,1); // Set the hovertext to attract mode }
SetActiveText() { llSetText("You have earned: L$"+(string)campmoney,<1,1,1>,1); // Setting hovertext to current amount earned }
SetInactive() { reciever = NULL_KEY; // forget who the receiver was campmoney = 0; // reset earning count to 0 SetInactiveText(); llSetTimerEvent(0); // Nobody is sitting on me, so no need to call myself anymore. Disable timer. } // States default { state_entry() { GetParameters(); llSetTimerEvent(0); animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSitTarget(pos, ZERO_ROTATION); llSetSitText(sittext); integer perms = llGetPermissions(); if((perms & PERMISSION_DEBIT) != PERMISSION_DEBIT)llRequestPermissions(llGetOwner(), PERMISSION_DEBIT ); //Ask my owner for permission to give money and assume it suceeds state Running; } on_rez(integer num) { llResetScript(); } }
state Running { state_entry() { llSetTimerEvent(0); llSitTarget(<0.4, 0.0, 0.4>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work SetInactiveText(); }
changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY) { // if Avatar key isn't empty, somebody is sitting on me if ( llSameGroup(llAvatarOnSitTarget()) ) // Check that the sitter is of the same group as the prim { // if so, allow them to sit and start the payments reciever = llAvatarOnSitTarget(); // store sitting avatar's key SetActiveText(); llSetTimerEvent(camptime); // amount of time between payments in seconds if(reciever == llGetOwner()) llRequestPermissions(reciever, PERMISSION_DEBIT | PERMISSION_TRIGGER_ANIMATION ); else llRequestPermissions(reciever, PERMISSION_TRIGGER_ANIMATION ); } else { // if not, boot them off with an explanation. llSay(0, "Group members only, sorry."); llSay(0, "If you are a group member, please \"wear your tags\" by making the group active.."); llUnSit(llAvatarOnSitTarget()); // unsit him or her } } else if( reciever != NULL_KEY ) { // if the avatar has gotten up llStopAnimation(animation); if(campmoney > 0) llGiveMoney(reciever,campmoney); // give the avatar the amount of money he has earned. SetInactive(); } } else if (change & CHANGED_INVENTORY) { // // reset script if inventory changes // llResetScript(); } } timer() { campmoney = campmoney+campadd; // current amount + xL$ per camptime SetActiveText(); if (llAvatarOnSitTarget() == NULL_KEY) { // Noone's sitting on me, reset the vars SetInactive(); } } touch_start(integer total_number) { // Owner key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } run_time_permissions(integer perms) { if( (perms & PERMISSION_TRIGGER_ANIMATION) == PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit"); llStartAnimation(animation); } else if( (perms & PERMISSION_DEBIT) != PERMISSION_DEBIT) { llUnSit(reciever); llResetScript(); } } }
state Menu { state_entry() { listenchannel = (integer)llFrand(1000) + 10; ShowMainMenu(llGetOwner()); } on_rez(integer num) { state default; }
timer() { CancelListen(); state Running; }
listen( integer channel, string name, key id, string message ) { CancelListen(); if("On" == message) state Running; else if("Off" == message) state Disabled; else if("Payout" == message) ShowPayoutMenu(id); else if("Bonus" == message) ShowBonusMenu(id); else if("Time" == message) ShowTimerMenu(id); else { integer index = llListFindList(AmountChoices, [ message ]); if(index >= 0) { campadd = (integer)message; SaveParameters(); state Running; } else { index = llListFindList(BonusChoices , [ message ]); if(index >= 0) { campmoney = (integer)message; SaveParameters(); state Running; } else { index = llListFindList(TimerChoices, [ message ]); if(index >= 0) { camptimeM = message; camptime = 60 * (integer)message; // Payout time in seconds (Script USES this) SaveParameters(); state Running; } } } } } }
state Disabled { state_entry() { llSetText("OFF",<1,0,0>,1); // Set the hovertext to attract mode } touch_start(integer total_number) { // Owner or owner Group control key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } }
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
11-24-2006 07:08
OKay..
make prim, make new script. Edit new script. Paste this code into script. click save. Script asks for debit permissions. click yes. Friend in same group sits on box. acrues a balance, stands..
no debit no payout
[6:55] You: Object: Script trying to debit L$ from owner but PERMISSION_DEBIT permission not set!
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-24-2006 09:38
weird,tried it previously, on my own admittedly, and it all worked ok. Will need to rethink.
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-24-2006 12:23
I just got it working in world by commenting out all of the llGetPermissions except for in the default state entry.
"Be aware that the effects of this call are not additive. This means that all desired permissions must be requested for any call because the new permissions (or lack thereof) will completely replace the old permissions. Requesting permission FALSE (or 0) will result in all permissions being released.
Further, multiple agents may not grant permissions to the same script at the same time. For an object to have permissions for multiple agents simultaneously, one script is needed for each agent. They may still be within the same prim, however."
So evidently when you get permission to trigger animation from the sitter, you are replacing the debit permission from the owner?????
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
11-24-2006 12:35
How about a separate script that just handles the sit target and animation?
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-24-2006 12:38
From: Winter Ventura How about a separate script that just handles the sit target and animation? Yep that was what I was thinking. Kind of leery of working with it thou. Haven't had enough expirience working with money events and wouldn't want someone to go broke because of my mistake while dividing the scripts up.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-24-2006 12:44
From: Jesse Barnett I just got it working in world by commenting out all of the llGetPermissions except for in the default state entry.
"Be aware that the effects of this call are not additive. This means that all desired permissions must be requested for any call because the new permissions (or lack thereof) will completely replace the old permissions. Requesting permission FALSE (or 0) will result in all permissions being released.
Further, multiple agents may not grant permissions to the same script at the same time. For an object to have permissions for multiple agents simultaneously, one script is needed for each agent. They may still be within the same prim, however."
So evidently when you get permission to trigger animation from the sitter, you are replacing the debit permission from the owner????? That was what I thought I'd recoded when I made it 'work' for me. I didnt read the bit about multiple agents however!!!! The way around it is indeed to have two scripts, one that handles the money, and one to process the animations. Communicating via linked messages.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-25-2006 04:37
An Atttempt to split the original 2 merged scripts back into 2.... Owner / Menu Script Responsible only for setting parameter and making the final payout integer campmoney = 0; // Initial amount to grant someone upon the VERY first sit after first rez. (Think, Special bonus) integer campadd = 1; // Payout amount integer camptime = 600; // Payout time in seconds (Script USES this) string camptimeM = "10 minutes"; // Payout time in minutes (Attract SAYS this)
list MenuChoices = ["On","Off","Payout","Bonus","Time"]; list AmountChoices = ["1$","2$","3$","4$","5$","10$", "20"]; list BonusChoices = ["1$ Bonus","2$ Bonus","3$ Bonus","4$ Bonus","5$ Bonus","10$ Bonus"]; list TimerChoices = ["1 minute","5 minutes","10 minutes","15 minutes","20 minutes","30 minutes","60 minutes"]; integer Listening = 0; integer listenchannel = 0;
SaveParameters() { llSetObjectDesc((string)campmoney + "/" + (string)camptime + "/" + (string)campadd); llMessageLinked(LINK_THIS,0,"RESET",NULL_KEY); }
GetParameters() { string str = llGetObjectDesc(); list ldata = llParseString2List(str, ["/"], [""]); if(llGetListLength(ldata) == 3) { campmoney = llList2Integer(ldata,0); camptime = llList2Integer(ldata,1); campadd = llList2Integer(ldata,2); } }
UpdateListen(key id) { CancelListen(); Listening = llListen(listenchannel,"",id,""); llSetTimerEvent(30); }
CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
// Owner Conversation Dialog ShowMainMenu(key id) { string text = "Main Menu\nPlease Select an Option"; // finally show the dialog llDialog(id,text,MenuChoices,listenchannel); UpdateListen(id); }
ShowPayoutMenu(key id) { string text = "Payout Menu\nPlease Select an amount\nCurrent Amount is L$" + (string)campadd + " / " + camptimeM; // finally show the dialog llDialog(id,text,AmountChoices,listenchannel); UpdateListen(id); }
ShowBonusMenu(key id) { string text = "Bonus Menu\nPlease Select an amount\nCurrent Amount is L$" + (string)campmoney; // finally show the dialog llDialog(id,text,BonusChoices,listenchannel); UpdateListen(id); }
ShowTimerMenu(key id) { string text = "Timer Menu\nPlease Select a time period\nCurrent period is " + camptimeM; // finally show the dialog llDialog(id,text,TimerChoices,listenchannel); UpdateListen(id); }
// States default { state_entry() { GetParameters(); llSetTimerEvent(0); integer perms = llGetPermissions(); if((perms & PERMISSION_DEBIT) != PERMISSION_DEBIT)llRequestPermissions(llGetOwner() , PERMISSION_DEBIT ); //Ask my owner for permission to give money and assume it suceeds state Running; } on_rez(integer num) { llResetScript(); } }
state Running { state_entry() { llSetTimerEvent(0); }
changed(integer change) { // something changed if (change & CHANGED_INVENTORY) { // // reset script if inventory changes // llResetScript(); } } touch_start(integer total_number) { // Owner key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } }
link_message(integer sender_num, integer num, string str, key id) { if("PAY" == str) { if(num > 0) llGiveMoney(id,num); } } }
state Menu { state_entry() { listenchannel = (integer)llFrand(1000) + 10; ShowMainMenu(llGetOwner()); } on_rez(integer num) { state default; }
timer() { CancelListen(); state Running; }
listen( integer channel, string name, key id, string message ) { CancelListen(); if("On" == message) { // Force the anuimation script to reset SaveParameters(); state Running; } else if("Off" == message) state Disabled; else if("Payout" == message) ShowPayoutMenu(id); else if("Bonus" == message) ShowBonusMenu(id); else if("Time" == message) ShowTimerMenu(id); else { integer index = llListFindList(AmountChoices, [ message ]); if(index >= 0) { campadd = (integer)message; SaveParameters(); state Running; } else { index = llListFindList(BonusChoices , [ message ]); if(index >= 0) { campmoney = (integer)message; SaveParameters(); state Running; } else { index = llListFindList(TimerChoices, [ message ]); if(index >= 0) { camptimeM = message; camptime = 60 * (integer)message; // Payout time in seconds (Script USES this) SaveParameters(); state Running; } } } } } }
state Disabled { state_entry() { llSetText("OFF",<1,0,0>,1); // Set the hovertext to attract mode llMessageLinked(LINK_THIS,0,"DISABLED",NULL_KEY); } touch_start(integer total_number) { // Owner or owner Group control key id = llDetectedKey(0); if( (id == llGetOwner())) { state Menu; } } }
Slave / Animator Script Responsible for starting / stopping animations and calcualting the amount to be paid. integer campmoney = 0; // Initial amount to grant someone upon the VERY first sit after first rez. (Think, Special bonus) integer campadd = 1; // Payout amount integer camptime = 600; // Payout time in seconds (Script USES this) string camptimeM = "10 minutes"; // Payout time in minutes (Attract SAYS this) string receiver = NULL_KEY; // key of Sitter
// Modifications for Animation vector pos = <0,0,-0.5>; //adjust the (x,y,z) position to fit object string sittext = ""; // Adjust this to your needs but keep it short! string animation; // The first animation in object will be used
GetParameters() { string str = llGetObjectDesc(); list ldata = llParseString2List(str, ["/"], [""]); if(llGetListLength(ldata) == 3) { campmoney = llList2Integer(ldata,0); camptime = llList2Integer(ldata,1); campadd = llList2Integer(ldata,2); } }
SetInactiveText() { llSetText("Group Members sit here for free money,\nL$"+(string)campadd+" every "+camptimeM,<0,1,0>,1); // Set the hovertext to attract mode }
SetActiveText() { llSetText("You have earned: L$"+(string)campmoney,<1,1,1>,1); // Setting hovertext to current amount earned }
SetInactive() { receiver = NULL_KEY; // forget who the receiver was campmoney = 0; // reset earning count to 0 SetInactiveText(); llSetTimerEvent(0); // Nobody is sitting on me, so no need to call myself anymore. Disable timer. } // States default { state_entry() { GetParameters(); llSetTimerEvent(0); animation = llGetInventoryName(INVENTORY_ANIMATION,0); llSitTarget(pos, ZERO_ROTATION); SetInactiveText(); llSetSitText(sittext); } on_rez(integer num) { llResetScript(); } changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY && receiver == NULL_KEY) { // if Avatar key isn't empty, somebody is sitting on me if ( llSameGroup(llAvatarOnSitTarget()) ) // Check that the sitter is of the same group as the prim { // if so, allow them to sit and start the payments receiver = llAvatarOnSitTarget(); // store sitting avatar's key SetActiveText(); llSetTimerEvent(camptime); // amount of time between payments in seconds llRequestPermissions(receiver, PERMISSION_TRIGGER_ANIMATION ); } else { // if not, boot them off with an explanation. llSay(0, "Group members only, sorry."); llSay(0, "If you are a group member, please \"wear your tags\" by making the group active.."); llUnSit(llAvatarOnSitTarget()); // unsit him or her } } else if( receiver != NULL_KEY ) { // if the avatar has gotten up llStopAnimation(animation); if(campmoney > 0) { // give the avatar the amount of money he has earned. llMessageLinked(LINK_THIS, campmoney,"PAY",receiver); } SetInactive(); } } else if (change & CHANGED_INVENTORY) { // // reset script if inventory changes // llResetScript(); } } timer() { campmoney = campmoney+campadd; // current amount + xL$ per camptime SetActiveText(); if (llAvatarOnSitTarget() == NULL_KEY) { // Noone's sitting on me, reset the vars SetInactive(); } } run_time_permissions(integer perms) { if( (perms & PERMISSION_TRIGGER_ANIMATION) == PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit"); llStartAnimation(animation); } }
link_message(integer sender_num, integer num, string str, key id) { if("DISABLED" == str) { state Disabled; } else if("RESET" == str) { llResetScript(); } } }
state Disabled { state_entry() { llSetText("Sorry not in Use",<1,0,0>,1); // Set the hovertext to off } link_message(integer sender_num, integer num, string str, key id) { if("RESET" == str) llResetScript(); } }
Again Its untested, I'm not inworld and unlikely to be for quite a while. Enjoy.
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-25-2006 07:20
It works fine for me. Couldn't find any problems.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-25-2006 07:26
The only thing I would consider adding would be an auto unsit in the disabled state?
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
11-26-2006 23:32
Something's a little weird.
I set the time to 1m.. and the chair still SAYS 10 minutes over it.
Actually increments correctly, just not displaying it correctly.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-27-2006 00:54
From: Winter Ventura Something's a little weird.
I set the time to 1m.. and the chair still SAYS 10 minutes over it.
Actually increments correctly, just not displaying it correctly. Yep, a bug. camptimeM wasnt getting updated correctly in the animator script. It used to be taken care of by the fact that it was all in one script. my apologies for the oversight. GetParameters() { string str = llGetObjectDesc(); list ldata = llParseString2List(str, ["/"], [""]); if(llGetListLength(ldata) == 3) { campmoney = llList2Integer(ldata,0); camptime = llList2Integer(ldata,1); campadd = llList2Integer(ldata,2);
camptimeM = (string)(camptime/60) + " Minute"; if(camptime > 60)camptimeM += "s"; } }
|