Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help on a camping script

Corbin May
Heart's Desire Owner
Join date: 25 Oct 2006
Posts: 20
04-09-2007 10:15
I have a camping script I'm trying to rewrite. It calls for the "camper" to be in the same group as the chair. I cant figure out what all needs to be removed in order for the "Camper" not to be in that group. The script is below:

CODE
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
string _Animation;

list MenuChoices = ["On","Off","Payout","Bonus","Time"];
list AmountChoices = ["1$","2$","3$","4$","5$","10$"];
list BonusChoices = ["1$ Bonus","2$ Bonus","3$ Bonus","4$ Bonus","5$ Bonus","10$ Bonus"];
list TimerChoices = ["1 minute","2 minutes","3 minutes","4 minutes","5 minutes","10 minutes","15 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("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()
{
if(llGetInventoryNumber(INVENTORY_ANIMATION) >0)
{
_Animation = llGetInventoryName(INVENTORY_ANIMATION,0);
}
else
{
_Animation = "sit";
}
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); //Ask my owner for permission to give money and assume it suceeds

}


on_rez(integer num)
{
llResetScript();
}

touch_start(integer t)
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_DEBIT)
{
state Running;
}
else
{
llOwnerSay("You need to give premisions to debit to cud use this chair");
}
}
}

state Running
{
state_entry()
{
llSetText("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.6>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
}
on_rez(integer t)
{
llResetScript();
}
changed(integer change)
{
// something changed
if (change & CHANGED_LINK)
{
// and it was a link change
if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); // we start animation!
// 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("Money: L$"+(string)campmoney,<0,1,0>,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
if(campmoney > 0)
{
llGiveMoney(reciever,campmoney); // give the avatar the amount of money he has earned.
}
llStopAnimation(_Animation);
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();
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(_Animation);
}
}
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;
}
on_rez(integer t)
{
llResetScript();
}
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("",<0,1,0>,1); // Set the hovertext to attract mode
}
on_rez(integer t)
{
llResetScript();
}
touch_start(integer total_number)
{
// Owner or owner Group control
key id = llDetectedKey(0);
if( (id == llGetOwner()))
{
state Menu;
}
}
}


Any help is greatly appreciated.


Always,
Corbin
_____________________
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
04-09-2007 10:18
Here's the relevant line:

CODE

if ( llSameGroup(llAvatarOnSitTarget()) ) // Check that the sitter is of the same group as the prim
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
04-09-2007 10:21
Replace :

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// 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("Money: L$"+(string)campmoney,<0,1,0>,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
}
}


With:

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// if Avatar key isn't empty, somebody is sitting on me
// if so, allow them to sit and start the payments
reciever = llAvatarOnSitTarget(); // store sitting avatar's key
llSetText("Money: L$"+(string)campmoney,<0,1,0>,1); // Setting hovertext to current amount earned
llSetTimerEvent(camptime); // amount of time between payments in seconds
}


Note that : PERMISSION_TRIGG ER_ANIMATION will make the script unable to compile, it needs to be PERMISSION_TRIGGER_ANIMATION, be careful if there are any other spaces insertion like this in your script.
Corbin May
Heart's Desire Owner
Join date: 25 Oct 2006
Posts: 20
04-09-2007 10:22
I thought that too but when I comment that line out it gives me a syntax error at 141, 16



Always,
Corbin
_____________________
Corbin May
Heart's Desire Owner
Join date: 25 Oct 2006
Posts: 20
04-09-2007 10:42
From: Twisted Pharaoh
Replace :

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// 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("Money: L$"+(string)campmoney,<0,1,0>,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
}
}


With:

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// if Avatar key isn't empty, somebody is sitting on me
// if so, allow them to sit and start the payments
reciever = llAvatarOnSitTarget(); // store sitting avatar's key
llSetText("Money: L$"+(string)campmoney,<0,1,0>,1); // Setting hovertext to current amount earned
llSetTimerEvent(camptime); // amount of time between payments in seconds
}


Note that : PERMISSION_TRIGG ER_ANIMATION will make the script unable to compile, it needs to be PERMISSION_TRIGGER_ANIMATION, be careful if there are any other spaces insertion like this in your script.


That worked great now I have one more question:
what would I put in the script that the prim the user sits on goes invisable? The texture UUID I want it to change to is: f54a0c32-3cd1-d49a-5b4f-7b792bebc204
then when not in use it changes back to blank. Any help on this is greatly appreciated.



Always,
Corbin
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-09-2007 14:08
hmmm, looks like the camping script we did a few months back has been reserrected again.

Making the prim invisible would just be a case of setting or resetting the alpha, standard show hide type functionality.
Suzi Wildcat
Registered User
Join date: 15 Nov 2006
Posts: 19
Different camping question
04-09-2007 23:03
I decided to make my own dance pads but I wanted them to be my group only, multiple choice dances, a limit per session and I wanted it to ask a question every 20 minutes. I thought I had it set but now instead they just turn off after 10 mintues.

Does anyone have a clue what I am missing here?

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)
integer payoutLimit = 100; // Payout Limit before chair auto shutsdown
integer totalPayout;

list MenuChoices = ["On","Off","Payout","Bonus","Time","Payout Limit"];
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"];
list LimitChoices = ["100 L$ Limit","200$ Limit","300$ Limit","400$ Limit","500$ Limit","1000$ Limit", "RESET"];
integer Listening = 0;
integer listenchannel = 0;


SaveParameters()
{
llSetObjectDesc((string)campmoney + "/" + (string)camptime + "/" + (string)campadd + "/" + (string)payoutLimit+ "/" + (string)totalPayout);
llMessageLinked(LINK_THIS,0,"RESET",NULL_KEY);
}

GetParameters()
{
string str = llGetObjectDesc();
list ldata = llParseString2List(str, ["/"], [""]);
if(llGetListLength(ldata) == 5)
{
campmoney = llList2Integer(ldata,0);
camptime = llList2Integer(ldata,1);
campadd = llList2Integer(ldata,2);
payoutLimit = llList2Integer(ldata,3);
totalPayout = llList2Integer(ldata,4);
}
}

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

ShowLimitMenu(key id)
{

string text = "Payout Limit Menu\nPlease Select the maximum payout before the chair auto shuts down\nCurrent limit is L$" + (string)payoutLimit + "\nCurrent payout total is L$" + (string)totalPayout;
// finally show the dialog
llDialog(id,text,LimitChoices,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);
totalPayout += num;
if(totalPayout >= payoutLimit) state Disabled;
}
}
}
}


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 if("Payout Limit" == message)
ShowLimitMenu(id);
else if("RESET" == message)
{
totalPayout = 0;
SaveParameters();
state Running;
}
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;
}
else
{
index = llListFindList(LimitChoices, [ message ]);
if(index >= 0)
{
payoutLimit = (integer)message; // Shut down limit
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;
}
}
}



---------------------------------------------------------------------------------------

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)
integer payoutLimit = 100; // Payout Limit before chair auto shutsdown
integer totalPayout;

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) == 5)
{
campmoney = llList2Integer(ldata,0);
camptime = llList2Integer(ldata,1);
campadd = llList2Integer(ldata,2);
payoutLimit = llList2Integer(ldata,3);
totalPayout = llList2Integer(ldata,4);
}
}

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

integer temp = totalPayout + campmoney;
if(temp >= payoutLimit)
{
llSay(0, "I'm sorry but you have reached the payout limit";);
llUnSit(llAvatarOnSitTarget()); // unsit him or her
}
}

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

}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-10-2007 00:54
Your posted code doesnt appear to ahev any handlers for the selection of animations etc, but to answer your actual question, you still have the default camptime limit set to 600 seconds.

CODE
integer camptime = 600; // Payout time in seconds (Script USES this) 
Suzi Wildcat
Registered User
Join date: 15 Nov 2006
Posts: 19
04-10-2007 05:27
From: Newgate Ludd
Your posted code doesnt appear to ahev any handlers for the selection of animations etc, but to answer your actual question, you still have the default camptime limit set to 600 seconds.

CODE
integer camptime = 600; // Payout time in seconds (Script USES this) 


I thought this integer was for the payout time intervals

I have a copiable menu from a dance pole that I was using but it isn't modifiable so I couldn't post it but iff someone knows a better one, I'd prefer to list the dance names as an option rather than numbers
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-10-2007 05:36
From: Suzi Wildcat
I thought this integer was for the payout time intervals

I have a copiable menu from a dance pole that I was using but it isn't modifiable so I couldn't post it but iff someone knows a better one, I'd prefer to list the dance names as an option rather than numbers


Its the length of time allowed to camp.

As for animation menu systems take a look at this thread
Suzi Wildcat
Registered User
Join date: 15 Nov 2006
Posts: 19
04-10-2007 06:22
From: Newgate Ludd
Its the length of time allowed to camp.

As for animation menu systems take a look at this thread



Wonderful, this has been so helpful. So now my only problem is getting the darn thing to continue. I want it to work for 20 mins then ask them if they want to continue. So far it hasn't gotten there, when I was trying it out it would stop at $100.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-10-2007 06:26
From: Suzi Wildcat
Wonderful, this has been so helpful. So now my only problem is getting the darn thing to continue. I want it to work for 20 mins then ask them if they want to continue. So far it hasn't gotten there, when I was trying it out it would stop at $100.


The 100$ pay out limit is the default max.

CODE
integer payoutLimit = 100; // Payout Limit before chair auto shutsdown 


I think may be you need to revisit the defaults and decide if/what you need them to be.
Corbin May
Heart's Desire Owner
Join date: 25 Oct 2006
Posts: 20
04-10-2007 08:59
Is there a camping script out there that I can throw in to an existing poseball, and not have it mess up the animation position. The one I posted above makes the user hover above the poseball. I used the primsitter tool and re adjusted it, it worked fine till I shut it down then when I turned it back on it messed the animation position up again.
I just need a script that I can throw into an existing poseball that doesnt mess with the poseball scripts and keeps the position the same. Also, could you put under options e able to select even incraments for payout time, example: 2min, 4min, 6min... up to 14 min? If possible i would like this with full rights since I am still learning scripting and every script helps me learn that much more.


Always,
Corbin
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-10-2007 09:19
From: Corbin May
Is there a camping script out there that I can throw in to an existing poseball, and not have it mess up the animation position. The one I posted above makes the user hover above the poseball. I used the primsitter tool and re adjusted it, it worked fine till I shut it down then when I turned it back on it messed the animation position up again.
I just need a script that I can throw into an existing poseball that doesnt mess with the poseball scripts and keeps the position the same. Also, could you put under options e able to select even incraments for payout time, example: 2min, 4min, 6min... up to 14 min? If possible i would like this with full rights since I am still learning scripting and every script helps me learn that much more.


Always,
Corbin


The sit position offset will be set by adjusting the sit target, in this case 0.4 m x and 0.6m z
CODE
          llSitTarget(<0.4, 0, 0.6>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work 


The script posted here is open source you can rewrite it however you like.
The relevant section is quite easily identifiable, just edit

CODE
  list TimerChoices = ["1 minute","2 minutes","3 minutes","4 minutes","5 minutes","10 minutes","15 minutes"]; 

The actual decoding of the time values is automatic.
CODE

index = llListFindList(TimerChoices, [ message ]);
if(index >= 0)
{
camptimeM = message;
camptime = 60 * (integer)message; // Payout time in seconds (Script USES this)
state Running;
}

It relies on the fact that casting a string to an integer will abort at the first non numeric character, i.e. "15 minutes" cast to an integer is 15.
Obviously if you put an hr in there it will cause a bit of a problem!!!
Suzi Wildcat
Registered User
Join date: 15 Nov 2006
Posts: 19
04-10-2007 09:54
do I need to add another line to the original camping script to make it ask a continuation question or is that a completely different script?
I have a continuation script but since it is nonmodifiable I am not sure how it works or what triggers it.
Corbin May
Heart's Desire Owner
Join date: 25 Oct 2006
Posts: 20
04-10-2007 10:26
I have a few more questions:
  1. This wasn't truely explained how would i have the prims texture change to: f54a0c32-3cd1-d49a-5b4f-7b792bebc204 when a user sits on it, then back to blank when not in use? I need the actual code for this, and where to put it.
  2. Would changing:
    CODE
      UpdateListen(key id) 

    {

    CancelListen();

    Listening = llListen(listenchannel,"",id,"");

    llSetTimerEvent(30);

    }
    to
    CODE
      UpdateListen(key id) 

    {

    CancelListen();

    Listening = llListen(listenchannel,"1",id,"");

    llSetTimerEvent(30);

    }
    put all the text the owner says on that channel? And would it still work? If not what would I need to change?
Thanks again for all your help.


Always,
Corbin
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-10-2007 13:46
You would need to handle a changed event and then check for a changed link order/status.
Then you would check for an avatar being present in the link order,
Then if it all fits you could use llSetTexture

CODE

string deftexture;
string invistexture = "f54a0c32-3cd1-d49a-5b4f-7b792bebc204";

default
{
state_entry()
{
deftexture = llGetTexture(1);
}

changed(integer change)
{

// 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?
{
llSetTexture(invistexture ,ALL_SIDES);
}
else
{
llSetTexture(deftexture,ALL_SIDES);
}
}
}
}


However as I said previously, rather than changing texture you could just set the Alpha.

Going back to your sample code, no it wont work
listenchannel is the channel number being listened on, what you have done is set it to only listen for chat from an object called "1"
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 04:31
From: Suzi Wildcat
do I need to add another line to the original camping script to make it ask a continuation question or is that a completely different script?
I have a continuation script but since it is nonmodifiable I am not sure how it works or what triggers it.


Sorry Suzi missed you post earlier or I would have replied sooner.
To make it ask for a continue automatically should just be a change to the timer event. Instead of automatically kicking the user off when the time limit/money limit is hit add a dialog display asking for confirmation. If they dont respond in 20-30 seconds kick them off anyway.
I'd handle it as a seperate state although that may require additional changes to the script to ensure you dont accidentally reset some of the parameters.

Are you using the current functionality as it stands or have you stripped it down to what you really need?
Suzi Wildcat
Registered User
Join date: 15 Nov 2006
Posts: 19
04-11-2007 10:58
From: Newgate Ludd
Sorry Suzi missed you post earlier or I would have replied sooner.
To make it ask for a continue automatically should just be a change to the timer event. Instead of automatically kicking the user off when the time limit/money limit is hit add a dialog display asking for confirmation. If they dont respond in 20-30 seconds kick them off anyway.
I'd handle it as a seperate state although that may require additional changes to the script to ensure you dont accidentally reset some of the parameters.

Are you using the current functionality as it stands or have you stripped it down to what you really need?



I am a newbie to scripting so I have been doing it all trial and error fiddling with open source scripts. So, do you mean I should have the continuation part be a seperate script or just a seperate section of the script?
I was using the script as it was but I am sure some could be pared dow, just didn't knwo what I could lose without messing it up. Currently they are functioning but they shut down and when don't reset until I turn them back on. Still I'd rather have it do that then pay out money endlessly.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 12:59
From: Suzi Wildcat
I am a newbie to scripting so I have been doing it all trial and error fiddling with open source scripts. So, do you mean I should have the continuation part be a seperate script or just a seperate section of the script?
I was using the script as it was but I am sure some could be pared dow, just didn't knwo what I could lose without messing it up. Currently they are functioning but they shut down and when don't reset until I turn them back on. Still I'd rather have it do that then pay out money endlessly.


The script is designed to be reasonably modular, i.e. easy to split apart and easy to extend. Taking out a menu you dont want or need is just a case of deleting it from the main menu, MenuChoices. You can leave the rest in place until you're sure you dont need it.
Then to clean it out delete the Choices menu and the Show Menu function that goes with it. You will also need to delete the references to it in the listen event handler.

Adding a continue question could be added either a seperate script or as an extension to the existing one, its mainly a matter of style. I'd add it as an extension since the actual script is still reasonably compact and the functionality is related to the existing system.

The system is currently set up to limit based on money, you could use this as your trigger or change the system so its just a single shot timer. The first approach means less rework of the script but that doesnt mean its the best approach.
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
Just a thought
06-01-2007 15:17
I been working on the original script posted here. I believe it started way back it Oct or Nov of 06. Just recently revived .

To read that post was funny because he wanted to make it a group camp.

Would it of made sense if it could be used to called up either group or individual camping.

Maybe Newgate has the answer.
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
Question on permisions
06-02-2007 07:48
From: Twisted Pharaoh
Replace :

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// 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("Money: L$"+(string)campmoney,<0,1,0>,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
}
}


With:

CODE

if (llAvatarOnSitTarget() != NULL_KEY && reciever == NULL_KEY)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION); // we start animation!
// if Avatar key isn't empty, somebody is sitting on me
// if so, allow them to sit and start the payments
reciever = llAvatarOnSitTarget(); // store sitting avatar's key
llSetText("Money: L$"+(string)campmoney,<0,1,0>,1); // Setting hovertext to current amount earned
llSetTimerEvent(camptime); // amount of time between payments in seconds
}


Note that : PERMISSION_TRIGG ER_ANIMATION will make the script unable to compile, it needs to be PERMISSION_TRIGGER_ANIMATION, be careful if there are any other spaces insertion like this in your script.


------------------------------------------------------------------------------------------------------
I replaced this script and now have problems with the animation part. When someone sits in my chair, there's a pop up that asked for animation. When clicked yes, it animates me. (kinda funny) but if I say no, it kicks them off the chair. I tried myself to correct this, but I'm having problems. Any help, thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
06-03-2007 01:42
From: Justin Slade
I been working on the original script posted here. I believe it started way back it Oct or Nov of 06. Just recently revived .

To read that post was funny because he wanted to make it a group camp.

Would it of made sense if it could be used to called up either group or individual camping.

Maybe Newgate has the answer.


Making group or individual should be simple enough. I'd add a group/single mode flag to the object and a menu option to toggle modes. Then in the changed event handler in teh link section perform the single mode or group mode checks as appropriate.

In answer to your second question concerning permissions. The reason is you are still using llGetOwner() in the permissions request, not the key of the sitting avatar.
_____________________
I'm back......
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
Button
06-03-2007 09:47
I'm working on that now. I know one could be the main and have a button to switch to the other. Maybe like rez it for no group and pop the menu up to switch to group.

Thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
06-03-2007 12:09
From: Justin Slade
I'm working on that now. I know one could be the main and have a button to switch to the other. Maybe like rez it for no group and pop the menu up to switch to group.

Thanks


Just add it to the owner menu.
_____________________
I'm back......
1 2