Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

odd LLGiveMoney Errors

Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-07-2008 18:45
just played around with this, and it works... but the script is giving errors, the specific error is 'invalid amount for llGiveMoney()' and occasionally something about not finding an avatar for permissions if the av hasn't recently been on the sim

the code is as follows
CODE

key gKeyAuth = "<av key of authorized user>";

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

touch_start( integer vIntTouched ){
if (gKeyAuth == llDetectedKey( 0 )){
llDialog( gKeyAuth, "/311 #", [], 311 );
llListen( 311, "Name of Autorised User", gKeyAuth, "" );
llSetTimerEvent( 30.0 );
}
}

listen( integer vIntNull, string vStrNull, key vKeyNull, string vStrHeard ){
llGiveMoney( gKeyAuth, (integer)vStrHeard );
}

timer(){
llSetTimerEvent( 0.0 );
state sListenKill;
}
}

state sListenKill{
state_entry(){
state default;
}
}


it works, but keeps spouting errors on the debug channel... and I'm clueless as to why
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
01-07-2008 22:13
I think is because the integer for the givemoney is taken from the "ok" message in the menu dialog and the "not finding an avatar for permissions" its because the state_entry in the default state is trying to get the owner again and if you are not there the debit permision fails,try this one.
CODE


key gKeyAuth = "authorized key";
integer handle;
integer channel=311;
string gNameAuth;
list command=["Take L"];
string vStrHeard;
string PermDebit="0";
key owner;


default
{
state_entry()
{if (PermDebit=="0")//prevents a debit permision when de object pay
{
owner=llGetOwner();
llRequestPermissions( owner, PERMISSION_DEBIT );
PermDebit="1";
}else{ llSay(0,"Im ready to take commands again");
}
}
touch_start( integer vIntTouched )

{
if (gKeyAuth == llDetectedKey( 0 ))
{
gNameAuth=llKey2Name(gKeyAuth);

handle= llListen(channel,"",gKeyAuth,"");
llSetTimerEvent(15);
llDialog( gKeyAuth, "/311 #", command, channel );

}else {
llSay(0,"Ups you are not authorized to use me");
}
}

listen( integer vIntNull, string vStrNull, key gKeyAuth, string vStrHeard )
{
if(vStrHeard=="Take L");
{llSetTimerEvent(0);

state GiveAmount;
}
}


timer()
{
llSetTimerEvent( 0 );
llSay(0,"Time is over try again");
llListenRemove(handle);
}
}


state GiveAmount

{



state_entry()
{llSetTimerEvent(15);
llListenRemove(handle);
handle= llListen(channel,"",gKeyAuth,"");
}

listen( integer vIntNull, string vStrNull, key gKeyAuth, string vStrHeard )

{
integer amount = llRound((integer)vStrHeard);

llGiveMoney( gKeyAuth, amount);
llSetTimerEvent(0);
state default;
}

timer()
{
llSetTimerEvent( 0 );
llSay(0,"Time is over try again");
llListenRemove(handle);
}

}

Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
01-07-2008 23:29
Caution:

Do not assume you have permission_debit just because you requested it.

there is a reason why requesting permissions will trigger a specific event.

And that reason is to allow you to verify you have the proper permissions.
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
01-08-2008 04:16
run time permission add Like Squirrel says and some sintax.

CODE

key gKeyAuth = "authorized key";
integer handle;
integer channel=311;
string gNameAuth;
list command=["Take L"];
string vStrHeard;
string PermDebit="0";
key owner;


default
{
state_entry()
{if (PermDebit=="0")//prevents a debit permision when de object pay
{
owner=llGetOwner();
llRequestPermissions( owner, PERMISSION_DEBIT );
PermDebit="1";
}else{ llSay(0,"Im ready to take commands again");
}
}

run_time_permissions( integer perm )
{
if ( (perm && PERMISSION_DEBIT) )
{
llOwnerSay ( "Permission debit granted.");
}
else
{
llOwnerSay ( "I must have money(DEBIT) permissions to get this work.. try again.");

llResetScript();
}

}
touch_start( integer vIntTouched )

{
if (gKeyAuth == llDetectedKey( 0 ))
{
gNameAuth=llKey2Name(gKeyAuth);

handle= llListen(channel,"",gKeyAuth,"");
llSetTimerEvent(15);
llDialog( gKeyAuth, "/311 #", command, channel );

}else {
llSay(0,"Ups you are not authorized to use me");
}
}

listen( integer vIntNull, string vStrNull, key gKeyAuth, string vStrHeard )
{
if(vStrHeard=="Take L");
{llSetTimerEvent(0);

state GiveAmount;
}
}


timer()
{
llSetTimerEvent( 0 );
llSay(0,"Time is over try again");
llListenRemove(handle);
}
}


state GiveAmount

{



state_entry()
{llSetTimerEvent(15);
llListenRemove(handle);
handle= llListen(channel,"",gKeyAuth,"");
}

listen( integer vIntNull, string vStrNull, key gKeyAuth, string vStrHeard )

{
integer amount = (integer)vStrHeard;

llGiveMoney( gKeyAuth, amount);
llSetTimerEvent(0);
state default;
}

timer()
{
llSetTimerEvent( 0 );
llSay(0,"Time is over try again");
llListenRemove(handle);
}

}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-08-2008 13:17
doh, complete oversight on the dialog returning 'ok' to the listen... sleep blindness =)

the other thing is a bit odder, I can assume I have debit permissions (since I'm the ont that gave them) and did....

so why then would it give an error about not finding the avatar with permissions? especially AFTER it had already worked it's magic (debit was successful). but then stop giving the error AFTER I came to the sim once that log on? and continued not to after I'd logged from that sim (I'm assuming that had something to do with the sim being my last known location, so it still worked after the fashion of llOwnerSay which only works across sims if you've been to the sim that logon)

please note, the assumptions on permissions were made because this is not a production model, but rather something for me and my sister to be able to transfer funds between us since I'm doing a bit of selling and she's managing most of it (yes I trust her that much and as much as I owe her RL it'd be a drop in the bucket if she cleaned me out =)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
01-08-2008 13:42
Whenever I read «... and stops working when I leave the SIM...» I wave the flag «GROUP OWNED???»...

If it's group owned, try to deed or share the object with the group... and check the settings for scripts 'n stuff in the Land-Options...

Just a thought, though - but this group-stuff tricked me into so many problems alike that I meanwhile tend to blame almost anything not working on group-issues...
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-08-2008 14:07
The business about being group-owned usually has to do with land/parcel functions. It SHOULDN'T affect giving money. And DEEDING to group will not help with this kind of application anyway. Group owned objects cannot give money.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-08-2008 16:24
usually I'd look there to Haruki... but in this case it DOES work, and as heewee pointed out, groups can't give money.

I'm not complaining, it works regardless of errors, just can't seem to peg why it generates an error at all.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -