Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

cash as random prize

Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
02-03-2008 20:46
I'm working on a script that gives random prizes. One of which will be cash. I know it's late here, but for the life of me I can't figure how to put cash in a notecard which is called by inventory in the script. sorry if it sounds dumb
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
02-03-2008 21:02
Not sure I understand the question, but you'd use llGiveMoney to make it pay out (not llGiveInventory), and the owner of the object would have to give it debit permissions, so the L$s would go from his balance to the lucky^H skillful winner.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-03-2008 21:09
You can't actually store L$ anywhere but in a resident's account. You can't put it in a chest, or a notecard, or a wall safe. The best you can do is play accounting tricks and keep track of who ows who and where different amounts of money come from (like how much money has been paid to you or from you through an object/script).
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
02-04-2008 04:04
Thanks, I should of remembered that you can't store money in an object or there wouldn't be any need to trust someone else with your money: like banks. But how, say for instance these prize chairs give out prizes and randomly give out money. It must be like a Voucher and the owner has to keep track of who won. That would get complicated..
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-04-2008 10:26
They keep track of who has won what, and pay out the money (from the owner's account) as soon as is feasible. Unfortunately there's no way to set aside money for that kind of thing, and no way for a script to know if the owner has the funds to back a particular payment (if not, the script will think the money has been payed when it hasn't). That's the risk you take setting up such systems, unfortunately.

The best you can do is create an alt account and limit transactions with that alt such that the balance can be tracked automatically, but so far as I know few people go that far or are rigorous enough to maintain it well.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
02-04-2008 10:48
From: Justin Slade
But how, say for instance these prize chairs give out prizes and randomly give out money. It must be like a Voucher and the owner has to keep track of who won. That would get complicated..

Yes, it can be sort of an internal token or voucher but doesn't need to be that complicated.

In one of the popular prize chairs out there, the owner puts an object in the chair's inventory named "money" - it doesn't have to be any particular object, it's just a placeholder so it can be in the pool of random stuff. Multiple objects named "money", or a larger selection of other prizes, can be used to tweak the odds. There can also be another setting stored somewhere with minimum and maximum amounts that can be chosen randomly for the payout.

So, the logic ends up being pretty simple for the existing chairs. If the randomly chosen object in the chair's inventory happens to be named "money", pick a random amount from the allowed range and pay that to the winner instead of giving inventory.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
02-04-2008 11:00
in the notecard list of prizes, just enter $40 (for example) as a single line.. like this

Fireplace
Flowers
Single Red Rose
$40

During your "select a line from the notecard" routine, have it check the string for the token "$" like so:

CODE
if (llGetSubString(prize, 0, 0) == "$") 
{
amount = (integer)(llGetSubString(prize1, llStringLength(prize) - 1));

if (bank - amount != 0)
{
llGiveMoney(id, amount);
bank -= amount;
}
else choosePrize(); // there's not enough left in the bank.. go pick another prize

}
else llGiveInventory(id, prize);


Hope this gets the juices flowing.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-04-2008 11:16
Ahh. I see. The question was about the conditional logic, not the actual money giving. Sorry if I caused any confusion.
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
02-04-2008 13:35
Thanks Winter and Viktoria.

That's what I was trying to accomplish. It's some what like the old money orbs, where it paid out a set amount of money every 10, 12, 14 th place. But with this it gives prizes out in between. I hope to have a working script to show you or at least one going in the right direction..

One other question would arise. Would this be considered Gambling, because your taking a chance of winning something or should the term be instead of winning, it's your getting something wheter it be prize or cash?

Thanks again
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
02-04-2008 13:39
From: Justin Slade
One other question would arise. Would this be considered Gambling, because your taking a chance of winning something or should the term be instead of winning, it's your getting something wheter it be prize or cash?

It it is _not_ pay to play, then you shouldn't get into trouble with the gambling rule. Occasionally there are misunderstandings and things like this get reported, but what you are talking about seems to be pretty much the same as the ubiquitous lucky chairs and random prize orbs.