Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

discussion: Personal Alt Bank

Deight Boccara
I AM DEIGHT BOCCARA >:(
Join date: 24 Sep 2005
Posts: 10
07-22-2006 02:35
Since it's now super-easy to create your own alt, people all over have made alts just to carry around cash. Which make tools like the Alt Vault and the Personal ATM really really great to have, however, there is a catch. Tools like the Alt Vault and the Personal ATM cost money. After buying all of them and feeling sad about every single one of them, I decided to make my own. And now I give it to you, because I am too damn lazy to set up a vendor for this stuff.

To Work the Voodoo that This do:

First, you should find out the key of your main character. To do this, click a box that contains this one liner script: default{touch_start(integer q){llSay(0,(string)llDetectedKey(0));}}
Now that you got your main key, log in as your alt, and take this script:

CODE

// A FREAKING BANK OMG; v1.1.1 by Deight Boccara



// Let's initialize some global variables! Whoohoo! Exciting!
integer cash;
key whosOn;

// This function is called whenever we want to know how much cash is left.
// By default, we just IM the user, but we can use floating text and can
// email people just by uncommenting things
howMuchLeft()
{
llInstantMessage(whosOn, "I now have L$" + (string)cash);
//llSetText("L$" + (string)cash, <0,1,0>, 1);
//llEmail("user@example.org", "SL Bank Activity: " + llGetDate(),
// "I now have L$" + (string)cash);
}

// This function is called to see if the user has permission to do stuff.
// Adding people is easy, just use a "boolean or" to check if the id equals
// the authorized people's keys. To find out your key, use
// llSay(0,(string)llGetOwner());, or check http://w-hat.com/name2key
integer isAllowed(key id)
{
if (id == "7cd4e362-3df8-ed6c-f74d-994d24f14664")
return TRUE;
else
return FALSE;
}



// When we start, we ask the owner if we can pay people money. Again and again. Until they say yes. When they do, we switch to the "deposit" state.
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

run_time_permissions(integer perm)
{
if (perm == PERMISSION_DEBIT)
state deposit;
else
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
}



// The Deposit State. Here (only authorized) people can deposit money via the normal Pay function, or (if they are authorized) they can simply touch the bank to shift into withdrawl mode.
state deposit
{
money(key id, integer amt)
{
if (isAllowed(id))
{
whosOn = id;
cash += amt;
howMuchLeft();
}
else
{
llGiveMoney(id, amt);
}
}

touch_start(integer total_number)
{
if (isAllowed(llDetectedKey(0)))
{
whosOn = llDetectedKey(0);
state withdraw;
}
}
}



// The Withdrawl State. Here, whoever was authorized to click gets their own
// private (random) listener. They then have 60 seconds to say how much they
// want to withdraw on that listener (for example, "/743 5" will get you
// L$5). If they type in a weird value or take too long, we go back to the
// Deposit State.
state withdraw
{
state_entry()
{
integer randChan = (integer)(llFrand(899)+100);

llInstantMessage(whosOn, "Type how much to withdraw on" +
"channel /" + (string)randChan + "; I now have L$" +
(string)cash);

llListen(randChan, "", whosOn, "");
llSetTimerEvent(60);
}

listen(integer chan, string name, key id, string msg)
{
integer amt = llRound((integer)msg);
integer difference = cash - amt;

if (difference >= 0 && amt > 0)
{
cash -= (integer)amt;
llGiveMoney(id, amt);
howMuchLeft();
state deposit;
}
else
{
llInstantMessage(whosOn, "Try again, but with a sane value");
state deposit;
}
}

timer()
{
llInstantMessage(whosOn, "TIMES UP");
state deposit;
}
}



// SOME LEGAL STUFF:

// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:

// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source
// distribution.


Got it? Awesome! You see where it says "id == "7cd4e362-3df8-ed6c-f74d-994d24f14664""? Change that fake key into the key for your main character! And now congratulations, you are a winner at life! Stick this in a prim somewhere, and logoff, confident that you'll never ever EVER have to log in again under that alt!

To deposit money into the bank, just pay the prim you put the script in.
To withdraw, click the prim. Now, it will tell you a random channel like /471. Type in /471, then the number of dollars you want. Like, if you want 250 dollars, that would be "/471 250".

Now if you'll excuse me, I have to go think of a good way to close this post.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
07-22-2006 19:30
/15/78/123171/1.html
_____________________
i've got nothing. ;)
Velvet Tripp
Temptress
Join date: 4 May 2006
Posts: 51
07-25-2006 03:49
Thats a nice script ... but what is it for? Just to deposit the money on another character in case someone "take money from you"-script fools on you or LL closes your account? Thats the point i guess?

VT, confused.
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
07-25-2006 03:55
Can't you just pay your alt to transfer money?
_____________________
Aodhan's Forge shop at slurl.com/secondlife/Rieul/95/213/107
CJ Carnot
Registered User
Join date: 23 Oct 2005
Posts: 433
07-25-2006 04:12
From: Aodhan McDunnough
Can't you just pay your alt to transfer money?


If you're on as the alt this would require logging off and then on as your main to make the payment, then off and back on as the alt. I use alts for content creation and frequently have this problem when they require money. The use of a bank or wallet simply allows you to access the balance of your main account from any other.
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
07-25-2006 04:31
From: CJ Carnot
If you're on as the alt this would require logging off and then on as your main to make the payment, then off and back on as the alt. I use alts for content creation and frequently have this problem when they require money. The use of a bank or wallet simply allows you to access the balance of your main account from any other.


Considering how quickly one can logout and back in SL is it that big a problem as to need a bank?

Then again as someone who creates with the main and using alt only for testing of permissions and other things about my stuff that needs a character other than my main, I guess I just don't encounter the kinds of things you do.
_____________________
Aodhan's Forge shop at slurl.com/secondlife/Rieul/95/213/107
Malana Spencer
Registered User
Join date: 18 Sep 2003
Posts: 368
cool idea..
07-25-2006 05:21
From: Aodhan McDunnough
Considering how quickly one can logout and back in SL is it that big a problem as to need a bank?

Then again as someone who creates with the main and using alt only for testing of permissions and other things about my stuff that needs a character other than my main, I guess I just don't encounter the kinds of things you do.




While it SHOULD be easy just to log in & out of accounts to pass money it can also be VERY inconvenient especially if you need money "right now"

Also, there's the consideration of how many times have you logged out of SL thinking you would simply be able to log back in & instead encountered log in issues and/or shut downs.

So yes for those who have alt banks I see this as a useful tool.
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
07-25-2006 05:32
zomgz! Malana! In a scripting forum!? :p
_____________________
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
07-26-2006 06:18
also, "out of sigh, out of mind". im less likely to spend my money if i dont have it that moment lol. i have my own alt atm script. also good for sharing of funds.
_____________________
Alan Edison
Ty Zvezda
Join date: 28 Jun 2004
Posts: 420
08-01-2006 06:33
i liek this idea... one thing though

are you sure it's secure? liek could i leave the primsitting out and ne1 could fiddle with it and not steal the money from my other char?
_____________________
Ty Zvezda
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
08-01-2006 10:42
This is a great idea, I made my own version of some thing just like this. Now thanks to this script I can finally finish that old dusty project, take a few code blocks here, delete some here, edit there, DONE.

Since it uses random channels, the only way that someone could take money from you is if the person had modify rights to your script, and that person somehow found out your secret code (which changes with every use).

My hat is off to you, oh brilliant creator!
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
08-07-2006 01:55
well, mine uses the dialog box (so the listener only listens to the owner of the bank). start with the user clicking on it, the bank checking if the key of the avatar that clicked is on the access list, if it is then open up the dialog box with the options.
since you cant fake an avatar key, its as secure as you can get.(also all listens are not kept open. they are started when the user clicks and expire after 30sec, and also generate a random channel to listen on for the dialog)
_____________________
Zonax Delorean
Registered User
Join date: 5 Jun 2004
Posts: 767
08-07-2006 02:21
From: Gattz Gilman
also, "out of sigh, out of mind". im less likely to spend my money if i dont have it that moment lol. i have my own alt atm script. also good for sharing of funds.


Yep, I agree! It's like a piggy bank. You store money there, so you don't spend it needlessly. When you really need it, you can access it.

The script seems secure. One thing, I would've taken the person's key and made it a 'constant' variable, and put it in the first few lines, instead of inlining it. That way configuration would be easier.

Some ideas:
1. The script could have a constant, with the person's NAME, eg. "string ALTNAME = "Zonax Delorean"
2. Then the script could have a 'initialize' state, where it waits for touches. Once the person touching's name matches the ALTNAME, it could store the key of the person into a variable, and go into 'running' state. This might be a bit more convenient.
3. Even better: have a simple input system, that asks (prompts) for the ALTNAME in chat (only accepting chat from the owner!). That way no fiddling with the script is needed, just put it in a plywood cube, rez it, type the alt name, then login with alt, give permissions, and voila!
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
08-07-2006 17:39
well, the money permissions can only be given by the owner of the object, so you have to have your alt rez the bank. then the script asks for the name of your main.
_____________________
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
08-07-2006 17:53
i'd be most happy to script this for a 1% commission on all transactions ;)
_____________________
http://slurl.com/secondlife/Together
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
08-09-2006 10:16
From: Escort DeFarge
i'd be most happy to script this for a 1% commission on all transactions ;)


lol, too bad for you that there are already these alt piggy baks out there.
_____________________
Kator Bergson
I'm freakin out man!
Join date: 24 Nov 2005
Posts: 125
Multi-user ATM
10-23-2006 00:03
for those out there who still cant figure out how the hell to make this work with more than one user...
CODE

// A FREAKING BANK OMG; v1.1.1 by Deight Boccara



// Let's initialize some global variables! Whoohoo! Exciting!
integer cash;
key whosOn;

// This function is called whenever we want to know how much cash is left.
// By default, we just IM the user, but we can use floating text and can
// email people just by uncommenting things
howMuchLeft()
{
llInstantMessage(whosOn, "I now have L$" + (string)cash);
//llSetText("L$" + (string)cash, <0,1,0>, 1);
//llEmail("user@example.org", "SL Bank Activity: " + llGetDate(),
// "I now have L$" + (string)cash);
}

// This function is called to see if the user has permission to do stuff.
// Adding people is easy, just use a "boolean or" to check if the id equals
// the authorized people's keys. To find out your key, use
// llSay(0,(string)llGetOwner());, or check http://w-hat.com/name2key
integer isAllowed(key id)
{
//Heres Kators Additon to this script for those too lazy to figure out how to do more than
//one person themselves... or for those people who dont know what the hell a "boolean or"
//value is...
//first user
if (id == "a0a0a0a0-a000-0a0a-a00a-000aaa000a00")
return TRUE;
//Second user
else if (id == "b1bbb11b-111b-1b11-111b-11111111b11b")
return TRUE;
//Third User
else if(id == "c3c3c3c3-3cc3-3c33-333cc33cc333")
return TRUE;
//and so on, and so on....
else
return FALSE;
}



// When we start, we ask the owner if we can pay people money. Again and again. Until they say yes. When they do, we switch to the "deposit" state.
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

run_time_permissions(integer perm)
{
if (perm == PERMISSION_DEBIT)
state deposit;
else
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
}



// The Deposit State. Here (only authorized) people can deposit money via the normal Pay function, or (if they are authorized) they can simply touch the bank to shift into withdrawl mode.
state deposit
{
money(key id, integer amt)
{
if (isAllowed(id))
{
whosOn = id;
cash += amt;
howMuchLeft();
}
else
{
llGiveMoney(id, amt);
}
}

touch_start(integer total_number)
{
if (isAllowed(llDetectedKey(0)))
{
whosOn = llDetectedKey(0);
state withdraw;
}
}
}



// The Withdrawl State. Here, whoever was authorized to click gets their own
// private (random) listener. They then have 60 seconds to say how much they
// want to withdraw on that listener (for example, "/743 5" will get you
// L$5). If they type in a weird value or take too long, we go back to the
// Deposit State.
state withdraw
{
state_entry()
{
integer randChan = (integer)(llFrand(899)+100);

llInstantMessage(whosOn, "Type how much to withdraw on" +
"channel /" + (string)randChan + "; I now have L$" +
(string)cash);

llListen(randChan, "", whosOn, "");
llSetTimerEvent(60);
}

listen(integer chan, string name, key id, string msg)
{
integer amt = llRound((integer)msg);
integer difference = cash - amt;

if (difference >= 0 && amt > 0)
{
cash -= (integer)amt;
llGiveMoney(id, amt);
howMuchLeft();
state deposit;
}
else
{
llInstantMessage(whosOn, "Try again, but with a sane value");
state deposit;
}
}

timer()
{
llInstantMessage(whosOn, "TIMES UP");
state deposit;
}
}



// SOME LEGAL STUFF:

// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:

// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source
// distribution.
_____________________
Zeera Xi
Real Join Date: Mid '05
Join date: 21 Sep 2006
Posts: 54
10-23-2006 02:09
I don't really understand the importance of this script. I could easily log in a second client while keeping my main client on. If you can't figure this out then i give you a hint to read on the wiki about something called "Command Line Parameters".
Kator Bergson
I'm freakin out man!
Join date: 24 Nov 2005
Posts: 125
11-01-2006 08:05
seems to be a slight issue with this code as the llTimer event is firing too soon or just not being seen at all and getting skipped.
so the line
CODE

llSetTimerEvent(60);

I think personally should be moved just under
CODE

llInstantMessage(whosOn, "Type how much to withdraw on" +
"channel /" + (string)randChan + "; I now have L$" +
(string)cash);

but I'm not sure if this will do something or not. (not yet anyway I'll check when I'm not so damn tired and edit this post with a update)
_____________________
Scalar Tardis
SL Scientist/Engineer
Join date: 5 Nov 2005
Posts: 249
11-01-2006 09:45
This seems to be a potential way for a vendor script to know how much money it has, since LSL does not return any response from llPay.

Vendor script wants to know: how much funds do I have available ?
(Vendor actually has L$122942)

Tell Alt-bank "I NEED A BALANCE-CHECK!"
Alt-bank replies: "READY TO START. GO AHEAD"
Attempt to pay out all funds, up to L$262143 (about US$900), to alt-bank:
Pay L$131072 to alt-bank (fails)
Pay L$65536 to alt-bank (success! Remaining: 57406)
Pay L$32768 to alt-bank (success! Remaining: 24638)
Pay L$16384 to alt-bank (success! Remaining: 8254)
Pay L$8192 to alt-bank (success! remaining: 62)
Pay L$4096 to alt-bank (fails)
Pay L$2048 to alt-bank (fails)
Pay L$1024 to alt-bank (fails)
Pay L$512 to alt-bank (fails)
Pay L$256 to alt-bank (fails)
Pay L$128 to alt-bank (fails)
Pay L$64 to alt-bank (fails)
Pay L$32 to alt-bank (success! remaining: 30)
Pay L$16 to alt-bank (success! remaining: 14)
Pay L$8 to alt-bank (success! remaining: 6)
Pay L$4 to alt-bank (success! remaining: 2)
Pay L$2 to alt-bank (success! remaining: 0)
Pay L$1 to alt-bank (fails)
Tell Alt-bank "YOU WERE PAID. STATUS?"

Alt-Bank replies with:
"YOU PAID ME L$122942. RETURNING IT BACK NOW."
Pay L$122942 back to vendor
Or if nothing received:
"NO FUNDS RECEIVED, NOTHING TO RETURN."


Or you could use it to do spot-checking to know if payouts to winners will succeed:

- When a vendor wants to pay out, it first notifies the alt-bank it wants a spot-check.
- If another vendor of yours is transacting with the alt-bank, the bank tells this vendor to wait a bit and try agan. (Bank should also track if another vendor recently did a check in the last 15 seconds, to prevent the vendor payouts from stepping on each other.)
- Vendor tries to pay the amount to the alt-bank.
- Alt-bank replies with whether or not the payment succeeded and returns the funds.
- Vendor either notes insufficient funds to do payout and sends you a mail message, or pays out to the customer.
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
11-01-2006 15:27
The listen should recheck the ID as someone else could say the value and get the money if you do something silly like miss the slash on the channel number.

Edit: Nevermind. I see the listen filter filters on the key.
Zeera Xi
Real Join Date: Mid '05
Join date: 21 Sep 2006
Posts: 54
11-01-2006 20:04
From: grumble Loudon
The listen should recheck the ID as someone else could say the value and get the money if you do something silly like miss the slash on the channel number.

Edit: Nevermind. I see the listen filter filters on the key.


Well if the llGiveMoney function in the script only gives to the owner than it is a different story as the only thing it would do is transfer between main and alt and not to the ID of the chatter.
_____________________
"RPG sim?

Why did I imagine a massive rocket propelled grenade, with people living on it." - Neil Robinson
Deight Boccara
I AM DEIGHT BOCCARA >:(
Join date: 24 Sep 2005
Posts: 10
01-21-2007 21:34
From: Kator Bergson
CODE

//First User
if (id == "a0a0a0a0-a000-0a0a-a00a-000aaa000a00")
return TRUE;
//Second user
else if (id == "b1bbb11b-111b-1b11-111b-11111111b11b")
return TRUE;
//Third User
else if(id == "c3c3c3c3-3cc3-3c33-333cc33cc333")
return TRUE;
//and so on, and so on....
else
return FALSE;


Or you could just do this:

CODE

if (id == "a0a0a0a0-a000-0a0a-a00a-000aaa000a00" ||
id == "b1bbb11b-111b-1b11-111b-11111111b11b" ||
id == "c3c3c3c3-3cc3-3c33-333cc33cc333")


Either or.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
01-21-2007 23:23
The elses are redundant, so:

CODE

//First User
if (id == "a0a0a0a0-a000-0a0a-a00a-000aaa000a00")
return TRUE;
//Second user
if (id == "b1bbb11b-111b-1b11-111b-11111111b11b")
return TRUE;
//Third User
if(id == "c3c3c3c3-3cc3-3c33-333cc33cc333")
return TRUE;
//and so on, and so on....
else
return FALSE;

Would not pass programming 101 but we need to do things like this in lsl to cope with the stack limitations of the lsl compiler.

Bring on mono and third party external compilers!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-22-2007 00:45
From: ed44 Gupte
The elses are redundant, so:

CODE

//First User
if (id == "a0a0a0a0-a000-0a0a-a00a-000aaa000a00")
return TRUE;
//Second user
if (id == "b1bbb11b-111b-1b11-111b-11111111b11b")
return TRUE;
//Third User
if(id == "c3c3c3c3-3cc3-3c33-333cc33cc333")
return TRUE;
//and so on, and so on....
else
return FALSE;

Would not pass programming 101 but we need to do things like this in lsl to cope with the stack limitations of the lsl compiler.

Bring on mono and third party external compilers!



Personally I'd just put them all into a list and use llListFindList.
far easier to maintain and no multiple if's
1 2