Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: payroll.ll

Rathe Underthorn
Registered User
Join date: 14 May 2003
Posts: 383
08-07-2003 00:05
Here's a handy little script I wrote up to exchange money with people who are either far away or offline. Since the only other way to pay someone is in person by the pie chart, this can come in very handy. Especially for payroll of employees, hence the name.

The only catch is you need the persons key but this can be acquired several different ways; make them touch a scripted object and log it, use a sensor on them, use a sensor on their in world objects if they're offline, etc. I can post several scripts to get keys if people need.

IM me in game if you'd like a copy of the script without having to cut and paste it.

CODE

// payroll.ll by Rathe Underthorn "00aa39a8-f6a4-45be-991e-b1e1fca8fe5b"
// say @pay <NICKNAME> <AMOUNT> to pay a user on your payroll list.

float fVersion = 1.0;

list lsPeople =
[
// ADD PEOPLE HERE AS "NICKNAME", "KEY",

"Arthur", "62091005-826d-44cd-ab80-0a6b96915b44", // Arthur Money
"Carrera", "e6b0b6e9-0dee-4e6e-bfb9-c725d0db3f01", // Carrera LeFay
"Darwin", "3e722bd8-028c-713f-e4f7-2e9b680855c8", // Darwin Appleby
"Kaylis", "16f627e1-ab89-4b1f-827f-63bd7bd3a7b9", // Kaylis LeFay
"Rathe", "00aa39a8-f6a4-45be-991e-b1e1fca8fe5b", // Rathe Underthorn
"Si", "117274fd-3902-4a07-b411-09bdc79f0fad", // Si Money
"Yuki", "3e8a2608-661d-ca16-0492-9233c77d3d1c", // Yuki Sunshine

// DO NOT REMOVE THIS END ROW

"END", "END"
];

integer nPublicChannel = 0;
integer nPublicId = 0;
string szTarget = "";
integer nAmount = 0;
key kTarget = NULL_KEY;

init_listen()
{
llListenRemove(nPublicId);
nPublicId = llListen(nPublicChannel, "", NULL_KEY, "");
}

key target_to_key(string szTarget)
{
integer i;
integer nListSize = llGetListLength(lsPeople) - 2;

for (i = 0; i < nListSize; i += 2)
{
if (llToLower(llList2String(lsPeople, i)) == llToLower(szTarget))
{
return llList2Key(lsPeople, i + 1);
}
}

return NULL_KEY;
}

default
{
state_entry()
{
szTarget = "";
nAmount = 0;
kTarget = NULL_KEY;
init_listen();
}

on_rez(integer nStartParam)
{
szTarget = "";
nAmount = 0;
kTarget = NULL_KEY;
init_listen();
}

listen(integer nChannel, string szName, key kId, string szMessage)
{
if (nChannel == nPublicChannel)
{
if (kId == llGetOwner())
{
if (llGetSubString(llToLower(szMessage), 0, 4) == "@pay ")
{
integer nCmdLen = llStringLength(szMessage);
string szTokens = llGetSubString(szMessage, 5, nCmdLen);

integer nTokenPos = llSubStringIndex(szTokens, " ");
integer nTokenLen = llStringLength(szTokens);

szTarget = llGetSubString(szTokens, 0, nTokenPos - 1);
nAmount = (integer)llGetSubString(szTokens, nTokenPos + 1, nTokenLen);

kTarget = target_to_key(szTarget);

if (kTarget != NULL_KEY)
{
integer nPerm = llGetPermissions();

if (!(nPerm & PERMISSION_DEBIT))
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
else
{
llWhisper(0, "Paying " + szTarget + " $" + (string)nAmount);
llGiveMoney(kTarget, nAmount);
}
}
}
}
}
}

run_time_permissions(integer nPermissions)
{
if (nPermissions) // permission granted
{
if (kTarget != NULL_KEY)
{
llWhisper(0, "Paying " + szTarget + " $" + (string)nAmount);
llGiveMoney(kTarget, nAmount);
}
}
else
{
llWhisper(0, "You denied debit permission, payments will not work, try again...");
}
}
}

edit-added the
CODE
 tags so that the script formatted correctly.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
08-07-2003 23:08
here is my version, it is strictly a no frills debit card that pays one person per card.

this is a modified version, with my key, so if you feel like sending me a tip, go for it :D

you should be warned, that if the key is not correct, it will send your money off into oblivion, so just be carefull about cutting and pasting them into the script.

CODE

//this will be the key you get from the keyfinder below.
key destination = "3d77c133-0c97-2be1-4db8-80bc8bb50c75";

integer amount=100; //the amount you are going to give to the person.
integer perm = FALSE;
string owner;

init()
{
key id = llGetOwner();
owner = llKey2Name(id);
llWhisper(0, "Can I help you, " + (string)llKey2Name(id));
llRequestPermissions(id, PERMISSION_DEBIT);
}


default
{
state_entry()
{
init();
}
on_rez()
{
init();
}

touch_start(integer total_number)
{
integer perm = llGetPermissions();
if(llDetectedKey(0)==llGetOwner())
{
if(perm)
llGiveMoney(destination, amount);
else
init();
}
else
llSay(0,"Quit trying to give " + owner +"'s money away.");
}
}
_____________________
i've got nothing. ;)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
08-07-2003 23:13
and here is a key finder. just stick it in an object and give it to whoever you want to give money too, and tell them to attach it.

CODE

key id = "3d7g789-0c97-25c1-4db8-80ab8bb50c76";
//stick your key here, it is a dummy key(heh well it should be since i randomaly made it up).

default
{
attach(key a)
{
if(a!=NULL_KEY)
llInstantMessage(id, (string)a);
}
}
_____________________
i've got nothing. ;)
Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
08-08-2003 04:32
From: someone
Originally posted by Nada Epoch

CODE

key id = "3d77c133-0c97-2be1-4db8-************";
//stick your key here.


Nada, you do realize that if this actually is your key, you're about to start getting IM's by the hundreds.

And it could very well go on until the end of time!
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
08-08-2003 11:15
heh course i do, but it didn;t occur to me that people might just stick it in with out changing it :D. no ims yet, woohoo!
_____________________
i've got nothing. ;)
Alex Dimsum
Registered User
Join date: 23 Jan 2006
Posts: 8
help
05-03-2006 21:15
how do i get my key id
Gorge Go
Registered User
Join date: 7 Dec 2006
Posts: 5
A way to skip the keys
05-04-2007 19:11
an easy way to skip keys is to use llKey2Name('What you use to sense key')
Example:
if(llKey2Name(llDetectedKey(0))=="John Doe";){
// Do Something...
}
Benjamin Nowotny
Registered User
Join date: 2 Dec 2006
Posts: 11
Only way to pay someone Is with the PIE CHART?
05-23-2007 07:16
I object to the assumption that the only way to pay someone is in person with the pie chart option. There is also a place on profiles to pay any user friend or not, online or offline. Simply search people for the person you'd wish to find, their profile pops up. Then simply click the button that says "pay" and BINGO! You've just opened a window to pay them whatever you'd like regardless of the status.
Rhaorth Antonelli
Registered User
Join date: 15 Apr 2006
Posts: 7,425
05-26-2007 09:18
you can pay ppl without using the pie chart
just search them in the search ppl field (or pull their info from friends list if they are a friend), and click the pay button

(even works if they are offline as well)

no need for a script to do that
kasper Bender
Registered User
Join date: 10 Aug 2006
Posts: 2
06-16-2007 10:52
From: Rhaorth Antonelli
you can pay ppl without using the pie chart
just search them in the search ppl field (or pull their info from friends list if they are a friend), and click the pay button

(even works if they are offline as well)

no need for a script to do that

hahaha that's the best solution for my :p
Brenda Maculate
Registered User
Join date: 18 Feb 2007
Posts: 2
06-22-2007 16:29
From: Rhaorth Antonelli
you can pay ppl without using the pie chart
just search them in the search ppl field (or pull their info from friends list if they are a friend), and click the pay button

(even works if they are offline as well)

no need for a script to do that

This is true NOW, but look at when the script was written: 2002/2003. I don't know for sure, but I'd guess that the "Pay" feature in one's profile that we have now was not available at the time. :)
tre Zobel
Registered User
Join date: 21 Jan 2006
Posts: 55
RE: to the ignorant
06-30-2007 10:37
Yeah, we don't need scripts to make our lives easier. We don't need scripts to automatically pay our employees. Infact, why even have a computer with scripts? It makes like TOO EASY. NOOOez! DUMP IT ALL- REVERT TO CAVEMAN!!1!1!!
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-13-2008 08:06
Lmao Tre