Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Slot Machine Commision Script

Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
12-20-2006 15:41
Hi All,

I've put together a simple slot machine and looking to add a commision script to it... I have searched the forum but unable to find any info...

This is what I want to do

1. Give my slot away for free for people to use in their casino's
2. Every certain amount people spend on the machine will give me a set percentage of the profit.

Any idea's you fantasic people...

Thanks
Iain
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-21-2006 00:22
The giving of commision has been covered several times.
Basically your script will need to contain your hard coded key and then after a preset amount of commission has been built up pay you.

There is an obvious drawback to this approach though, you could be defrauded by simply switching owners before the payout limit is reached.

Also how you calculate what constitutes profit would need to be worked out seperately.

Here is a simple script based on direct payment rather than profit

CODE

key MyKey = "xcxcxcxcx-xcxcxcx-xcxcxc-xcxcxcxcx";
integer currentCommision = 0;
integer PayOutLimit =10;
float Percentage = 10.0;

default
{
state_entry()
{
llRequestPermissions(llGetOwner() , PERMISSION_DEBIT );
}

money(key id, integer amt)
{
integer iPaid = (integer)((amt * Percentage) / 100.0);
currentCommision += iPaid;
if (currentCommision > PayOutLimit)
{
llGiveMoney(MyKey, currentCommision);
currentCommision = 0;
}
}

changed(integer change)
{
// something changed
if (change & CHANGED_OWNER)
{
llResetScript();
}
}
}
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
12-21-2006 00:24
Thanks for all your help... it is appreciated
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
Another question sorry!
12-24-2006 02:50
Just another question, sorry... new to all of this... but getting there. How do I get/create a hard coded key?

Regards
LS
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-24-2006 04:17
Everything in SL has a Key, textures, prims, sounds etc. They all have keys. So do Avatars and Groups. Keys are assigned by SL. More specifically obejct keys are assigned when objects are rezzed.

Your Key was assigned when your Avatar was created, To obtain it put the following script in to a prim.

CODE

default
{
state_entry()
{
key id = llGetOwner();
string name = llKey2Name(id);
llOwnerSay("Hi " + name + ". Your key is " + (string)id);
}
}


Object keys change each time they are rezzed, unless they are no copy.
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
12-24-2006 05:50
Great thanks for your help