|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
03-17-2007 09:49
Hi! Well, all I wanted to do is check if the buyer of my vendor machine confirmed or denied the permission_debit grant. default { state_entry() {
} changed(integer change) { if(change & CHANGED_OWNER) llSetTimerEvent(15);
} timer() { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); ownername = llKey2Name(llGetOwner()); if((llGetPermissions() & PERMISSION_DEBIT)) { state confirmed; } else { llInstantMessage(tomfoxwiranata, "buyer did not confirm"); } }
}
The problem is, that after the buyer rezzes the vendor machine, he gets asked for the permission_debit ALL THE TIME. It seems like an endless loop. What I do not get, is that the owner changed just ONCE, why does the time()-function get called every 15s? I thought I am coding here, that after 15s the new owner get asked ONCE. That is my Intention. Do you see the problem? Maybe I need more coffee^^ Thx to you 
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
03-17-2007 10:06
This is correct, llSetTimerEvent(15) will cause the timer event to trigger EVERY 15 seconds... to switch it off issue: llSetTimerEvent(0).
For a one-time event you don't really need a timer.
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
03-17-2007 10:14
Hi  Well that one thing without timer() did not work out either. I tried this: default { state_entry() {
} changed(integer change) { if(change & CHANGED_OWNER) { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT ); if((llGetPermissions() & PERMISSION_DEBIT)) { state confirmed; } else { llInstantMessage(tomfoxwiranata, "buyer did not confirm"); } }
}
}
With that code he did not ask the new owner at all  do you have a proposal for a one time asking, and reacting on the decision? thx
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
03-17-2007 11:08
Well, as llRequestPermissions triggers a run_time_permissions Event I'd expect something that includes that Event Handler. However, simply adding a run_time_permissions Event will not cater for the buyer not confirming. Knowing exactly what the user is doing and handling the timing, can be tricky.  Maybe something like this: default { changed(integer change) { if(change & CHANGED_OWNER) { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); llSetTimerEvent(15); } }
run_time_permissions(integer perm) { if (perm & PERMISSION_DEBIT) state confirmed; }
timer { if((llGetPermissions() & PERMISSION_DEBIT)) llSetTimerEvent(0); else // ask again { llInstantMessage(tomfoxwiranata, "buyer did not confirm."); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } } } What I am sure of is that you need to use the run_time_permissions Event Handler (the changed Event Handler will not wait for a response from the llGetPermissions request). What I'm not sure of is what happens if the permission request is declined. I think the above script will keep nagging until debit permission is granted... it might also result in lots of blue request dialog boxes if the user does nothing!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-17-2007 14:25
Pale, as usual, is correct. You need a run time permissions handler, your call to get permissions directly after requesting them will not give you the result you where expecting.
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
03-18-2007 12:07
Well, that solution works pretty much. Thank you very much. I have to admit, I never would have coded it that well.....
THX
|