Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pay to Sit (Opposite of Camping)

Smith Peel
Smif v2.0
Join date: 10 Jan 2005
Posts: 1,597
11-24-2006 12:10
Hello friends, I have a camping script-- does an opposite script exist? One where you would pay a certain amount of L$ per minute to sit?
_____________________
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-24-2006 12:22
could easily be made.

I'd prefer it though if you had a system where you "paid" and then the script went into a sittable MODE that would expire... Example.. the vehicle won't turn on unless it's been paid AND THEN the user sits down.

actually inverting the camping chair code isgrossly irrespoinsible socially.. since "Joe's Chair wants permission to take money from you".. is a little odd of phrasing.. and doesn't really constitute a "contract" the way the "pay" button does. You could sit on that chair thinking it was going to take $1L from you, and an unethical script could take every cent the person has in a matter of seconds.

So... I'd really like to see development on this idea go more like the first one. The second has too great a potential for misuse and trouble. No one should EVER be asked for permission to take money from them.. from an object they don't own. Because you're handing the script a blank check at that point. Don't get the noobs used to clicking "okay" to that question. (even if your purpose is an honest one).. because it makes it too easy to dupe them down the road.

Noobs should react to that question with "What the heck? no, you may NOT have permission to take money from me! do you think I'm stupid?"
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
daniel Goldenberg
Registered User
Join date: 5 Jun 2006
Posts: 2
opposite camping script
11-24-2006 12:23
since you cant make sit an AV with a script i think you should make a script that force to pay before the "player" sit and remember who pays and start a timer, so if you didnt pay the chair will unsit the AV.

then, you pay, sit and the chair will unsit you when the time is up and letting you to pay to extend the time ( if is your idea).

sorry that i could not post a sample script.

IM if you need help or ideas.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-24-2006 12:28
It wouldn't work anyway:

"integer PERMISSION_DEBIT

This permission is used with the llRequestPermissions function and can only be requested of the object 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:30
Okay so then, with that settled.. let's look at what he wants.

On money.. if money < target amount, give it back. if money > target amount, give change and switch to the "active" state. if money = target amount, switch to the "active" state. Active state contains a timer that starts on sit. Timer runs out, it unsits the user, and then changes back to the default state.

(sound right?)
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
daniel Goldenberg
Registered User
Join date: 5 Jun 2006
Posts: 2
11-24-2006 12:36
sounds right to me Winter, but it depends on the use of this script. i think that giving the chance to extend the time could be a good idea. ex. if you are using a "pay per use" car or plane, you may want to pay to stay on it before the timer expires.
Smith Peel
Smif v2.0
Join date: 10 Jan 2005
Posts: 1,597
11-24-2006 12:40
Winter, that sounds close to what I'm thinking. Since the debit won't work, how about a way to make it possible to pay for a certain amount of minutes (user choice) at so many L$ per minute?
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-24-2006 12:53
You will need to only start the time once the person who has paid has actually sat down...

Also what would happen if they get up part way through their time? do we :
A) refund?
B) say thanks for the tip? or
C) mark ourself as inactive until they return and use the rest of their time?

personally I'm in favour of B but A is still relatively straight forward. C is possible but is open to abuse, a bit like putting your towel on the deckchairs the night before

Set the timer to work in either seconds, or minutes, and increment, or decrement, a counter on each timer event until the users allocation has been reached. That way top ups can be added with out interfereing with the current process.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-24-2006 12:53
That could be done.. You could actually set it up so it was a $1L/minute thing, and easily transfer the amount paid, into a number that was used to determine time. obviously any number of multiples could be layered on that, so it could be 10L/minute, or 1L/10minutes.. whatever you like.
_____________________

● 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 13:09
The money event would work out how much has been paid for and set the counters accordingly. If the user over pays then refunds could be given.


iCostPerMinute is a global that would be set up elsewhere, possibly configurable via a notecard or dialog/menu interface.

CODE

// Customer has paid us
money(key id, integer amt)
{
integer iPaidFor = amt / iCostPerMinute;
integer iTotal = iPaidFor * iCostPerMinute;

if(user == NULL_KEY)
{
if(iPaidFor > 0) Start(id,iPaidFor);
if (amt >= iTotal)
{
amt -= iTotal;
}
}
else if(user == id)
{
if(iPaidFor > 0) AddCredits(iPaidFor);
if (amt >= iTotal)
{
amt -= iTotal;
}
}
else
{
llSay(0,"Sorry But I am currently in use!");
}

// give back change
if (amt > 0)
{
llGiveMoney(id, amt);
}
}
Smith Peel
Smif v2.0
Join date: 10 Jan 2005
Posts: 1,597
11-24-2006 13:18
Thanks! I will try to test this out in world next week after I get my new graphics card. I am not very skilled w/scripting though, so I'll probably be looking for advice on configuring it to work with a notecard.
_____________________
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-24-2006 13:22
yeah, the above isn't a script, it's a code snippet. But it's an example of how this element of the script might be made. There's still a great deal of scripting to be done, wrapped around newgate's snippet.. but you only gave us a snippet of the idea you want to implement, so you only got a snippet back.

I gotta say it again.. I love this forum. I wish more people used it.

ON a side note... regarding your sig:

The Ati Radeon 9600 SE Dual Head will run SL reasonably well. The 9800 Pro has some issues with it, and several 9800 users have reported that something about SL tends to cause overheating/burning of the cards. I use the 9600 SE now (since my 9800 fried itself)... and I have no serious issues running the game. ANy problems I DO have more-likely stem from my 2mhz P4, or the 512 megs of ram / small HD's I have. I heartily reccommend a nVidia card.. they handle 3d MUCH smoother. I have an older 64m nVidia card that actually can do a serviceable job of running the game with lowered quality settings.. on a 1ghz P3!!! I'd try newegg, tiger direct, or good old ebay to see if you can't come up with an affordable card that can still "get the job done" for the timebeing.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Smith Peel
Smif v2.0
Join date: 10 Jan 2005
Posts: 1,597
11-24-2006 13:29
Well what I really want is the exact opposite of a camping script (you pay x$L to sit for y amount of time, instead of getting paid x$L to sit for y amount of time), but since the debit won't work in this situation, then the solution of charging per minute at a specified rate in advance will work fine.

I agree, the forums are great :D
_____________________
Raeyan Aldrich
Registered User
Join date: 14 Oct 2006
Posts: 44
11-24-2006 17:35
From: Winter Ventura
The Ati Radeon 9600 SE Dual Head will run SL reasonably well. The 9800 Pro has some issues with it, and several 9800 users have reported that something about SL tends to cause overheating/burning of the cards. I use the 9600 SE now (since my 9800 fried itself)... and I have no serious issues running the game. ANy problems I DO have more-likely stem from my 2mhz P4, or the 512 megs of ram / small HD's I have. I heartily reccommend a nVidia card.. they handle 3d MUCH smoother. I have an older 64m nVidia card that actually can do a serviceable job of running the game with lowered quality settings.. on a 1ghz P3!!! I'd try newegg, tiger direct, or good old ebay to see if you can't come up with an affordable card that can still "get the job done" for the timebeing.



lol amen to that. my 9800 pro is buggier than an ant colony. ive had numerous experiences with myself seeing prims and textures in places that no one else could see them... the card renders things oddly sometimes and yes it heats up really bad while SL is running... i'm half tempted to drop my nvidia back in to see if it runs smoother... :P
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-25-2006 03:27
From: Winter Ventura
yeah, the above isn't a script, it's a code snippet. But it's an example of how this element of the script might be made. There's still a great deal of scripting to be done, wrapped around newgate's snippet.. but you only gave us a snippet of the idea you want to implement, so you only got a snippet back.


Indeed it was, but only because that was the bit we where discussing.

Adding an owner menu is straight forward and has been discussed several times in alternate threads, try this one

I'd also suggest looking at this thread as a camping script albeit currently non working!!!
(I will get back to it Winter......)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
Try This
11-25-2006 15:20
This a first attempt at the desired code.
Its two scripts, a Menu Handler, and a sit / animator.
You will probably recognise it as the same basic ideas behind the camping chair script.

Menu Script
Use to set the options by the owner.

CODE

integer iCostPerMinute = 1; // iCostPerMinute to sit
integer iTimePerPay = 10; // Minutes bought per iCostPerMinute

list MenuChoices = ["On","Off","Cost","Time"];
list AmountChoices = ["1$","2$","3$","4$","5$","10$", "20$"];
list TimerChoices = ["1 minute","2 minutes","3 minutes","4 minutes","5 minutes","10 minutes","15 minutes","20 minutes","25 minutes","30 minutes","60 minutes"];
integer Listening = 0;
integer listenchannel = 0;


SaveParameters()
{
llSetObjectDesc((string)iTimePerPay + "/" + (string)iCostPerMinute);
llMessageLinked(LINK_THIS,0,"RESET",NULL_KEY);
}

GetParameters()
{
string str = llGetObjectDesc();
list ldata = llParseString2List(str, ["/"], [""]);
if(llGetListLength(ldata) == 2)
{
iTimePerPay = llList2Integer(ldata,0);
iCostPerMinute = llList2Integer(ldata,1);
}
}

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

ShowCostMenu(key id)
{

string text = "Cost Menu\nPlease Select an amount\nCurrent Amount is L$" + (string)iCostPerMinute + " / " + (string)iTimePerPay + " minute";
if(iTimePerPay > 1)text += "s";

// finally show the dialog
llDialog(id,text,AmountChoices,listenchannel);
UpdateListen(id);
}

ShowTimerMenu(key id)
{

string text = "Timer Menu\nPlease Select a time period\nCurrent period is " + (string)iTimePerPay + " minute";
if(iTimePerPay > 1)text += "s";

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


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("Cost" == message)
ShowCostMenu(id);
else if("Time" == message)
ShowTimerMenu(id);
else
{
integer index = llListFindList(AmountChoices, [ message ]);
if(index >= 0)
{
iCostPerMinute = (integer)message; // Cost to sit
SaveParameters();
state Running;
}
else
{
index = llListFindList(TimerChoices, [ message ]);
if(index >= 0)
{
iTimePerPay = (integer)message; // Sit Time in Minutes (Animator 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;
}
}
}



The Sit Script

CODE

integer iCostPerMinute = 1; // Cost to sit
integer iTimePerPay = 10; // Minutes bought
integer TimeInterval = 60; // 1 minute
integer TimeRemaining = 0;
string User = 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) == 2)
{
iTimePerPay = llList2Integer(ldata,0);
iCostPerMinute = llList2Integer(ldata,1);
}
}

SetInactiveText()
{
string text = "Pay to Site here, L$" + (string)iCostPerMinute + " / " + (string)iTimePerPay + " minute";
if(iTimePerPay > 1)text += "s";
llSetText(text,<0,1,0>,1); // Set the hovertext to attract mode
}

SetActiveText()
{
if(TimeRemaining > 1) llSetText("You have "+(string)TimeRemaining + "Minutes Left",<1,1,1>,1);
else if(TimeRemaining == 1) llSetText("You have 1 Minute Left. Right click and pay for more time!",<1,1,1>,1);
}


SetInactive()
{
User = NULL_KEY; // forget who the User was
TimeRemaining = 0; // reset to 0
SetInactiveText();
llSetTimerEvent(0); // Nobody is sitting on me, so no need to call myself anymore. Disable timer.
}

Start(key id, integer units)
{
TimeRemaining = (units * iTimePerPay);
User = id;
llSetTimerEvent(60); // Start Timer
}

AddCredits(integer units)
{
TimeRemaining += (units * iTimePerPay);
}

TimeUp()
{
llUnSit(User); // unsit him or her
llStopAnimation(animation);
SetInactive();
}

// States
default
{
state_entry()
{
GetParameters();
llSetTimerEvent(0);
animation = llGetInventoryName(INVENTORY_ANIMATION,0);
llSitTarget(pos, ZERO_ROTATION);
SetInactiveText();
llSetSitText(sittext);
}

on_rez(integer num) { llResetScript(); }

// Customer has paid us
money(key id, integer amt)
{
integer iPaidFor = amt / iCostPerMinute;
integer iTotal = iPaidFor * iCostPerMinute;

if(User == NULL_KEY)
{
if(iPaidFor > 0) Start(id,iPaidFor);
if (amt >= iTotal)
{
amt -= iTotal;
}
}
else if(User == id)
{
if(iPaidFor > 0) AddCredits(iPaidFor);
if (amt >= iTotal)
{
amt -= iTotal;
}
}
else
{
llSay(0,"Sorry But I am currently in use!");
}

// give back change
if (amt > 0)
{
llGiveMoney(id, amt);
}
}

changed(integer change)
{
// something changed
if (change & CHANGED_LINK)
{
key id = llAvatarOnSitTarget(); // store sitting avatar's key
// and it was a link change
if (id != NULL_KEY)
{
// if Avatar key isn't empty, somebody is sitting on me
if ( User == id ) // Check that the sitter is of the same group as the prim
{
// if so, allow them to sit and start the clock
SetActiveText();
llSetTimerEvent(TimeInterval);
llRequestPermissions(User, PERMISSION_TRIGGER_ANIMATION );
}
else
{
// if not, boot them off with an explanation.
llSay(0, "Sorry you havent paid to sit here!");
llUnSit(llAvatarOnSitTarget()); // unsit him or her
}
}
else if( User != NULL_KEY )
{
// if the avatar has gotten up
llStopAnimation(animation);
SetInactive();
}
}
else if (change & CHANGED_INVENTORY)
{
//
// reset script if inventory changes
//
llResetScript();
}
}

timer()
{
--TimeRemaining;
if(TimeRemaining < 0)
{
TimeUp();
}
else
{
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();
}

}



Its not yet perfect.
The timer will start as soon as you pay so they lose a few seconds between paying and sitting.
If they dont sit within 1 muinute then they will lose their credit.

The usual Caveat, I've not tested this in anyway shape or form.

Enjoy.