Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Camping, yet again

Haydan Benelli
Registered User
Join date: 10 Jul 2007
Posts: 2
05-29-2008 04:07
sorry to all those that have done this before, but i am not good at this scripting, i have searched through here and found a script that is what i am after, but it does not ask permision to take Lindens or pay, but hey, it does the fancy bit, i will post what i have so far and maybe someone can help, ty for your time

[PHP]

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

}

[/PHP]
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
05-29-2008 15:14
I'd suggest this wasn't the only script.

The payment is triggered in this script by the following code:

// give the avatar the amount of money he has earned.
llMessageLinked(LINK_THIS, campmoney,"PAY",receiver);

The llMessageLink is trying to communicate with a second script in the same prim (as implied by: LINK_THIS). I suspect that this second script has the actual payment mechanism and it will be asking for the Debit permissions.

Are you sure you got all the scripts?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-29-2008 15:22
ahh so nice to see some of my scripts reappear every so often.
If you look at the very original posting of this script you will see that it was a part of a pair of scripts. The money aspects where all controlled by the second script. This is because of the way permissions work.
(Hi Pale you beat me to it, so much like old times!)
_____________________
I'm back......
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-29-2008 15:33
That's an old script from the library here in the forum, i see that someone fixed the spelling of the "reciever" variable in your copy :p

See this thread for the original and later fixes.
/54/07/75897/1.html
_____________________
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
05-29-2008 15:41
From: Newgate Ludd
Hi Pale you beat me to it...
Well, it was getting late so I assumed you weren't going to show. :D

After I posted I also found this thread: but there appears to be several iterations of the script - too many for me to spend the time unravelling.
Haydan Benelli
Registered User
Join date: 10 Jul 2007
Posts: 2
05-29-2008 15:52
Hi Pale, ty for your time and responses, ty to all that did, i will look these up shortly and continue to follow up on this, i am not a scripter so i am not to sure, hopefully i will work it out with help from people like you, ty, i will let you know how i get on
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-30-2008 13:04
From: Pale Spectre
Well, it was getting late so I assumed you weren't going to show. :D

After I posted I also found this thread: but there appears to be several iterations of the script - too many for me to spend the time unravelling.



OMG, thats a walk down memory lane.
_____________________
I'm back......