Discussion: Since dwell is dying.. quick HUD tipper :)
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
04-18-2006 12:56
Instructions: Rez a plywood cube, drop this script into it, pick it up, then attach it to "HUD bottom right". It'll fix its own size and texture. This will give you a handy button in the corner of your screen which, when clicked, pays L$1 to the owner of the land you're on. It might not seem like much, but it's more than dwell. Unfortunately, it doesn't work with group owned land. I'm not sure how to make it do so. integer first_time = TRUE;
default { attach(key attacher) { if (attacher != NULL_KEY) { if (first_time) { llSetPos(<0,0.05170,0.07860>); llSetScale(<0.5,0.07241,0.02286>); llSetTexture("9c1f6fd2-3491-d174-da4b-e29f52616173",4); first_time = FALSE; } llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } } touch_start(integer total_number) { if (llDetectedKey(0) != llGetOwner()) return; llGiveMoney(llGetLandOwnerAt(llGetPos()),1); } }
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Original Thread
04-18-2006 19:24
_____________________
i've got nothing. 
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
04-19-2006 01:53
you should check permissions before trying to give money, as if the user click no to debit money, then clicks the prim, it return an error. Yeah it would fail on groups, because groups aren't avatars, llGiveMoney only works on avatars... i think. Though it should be extended to support groups.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
04-19-2006 05:02
From: Strife Onizuka you should check permissions before trying to give money, as if the user click no to debit money, then clicks the prim, it return an error. Yeah it would fail on groups, because groups aren't avatars, llGiveMoney only works on avatars... i think. Though it should be extended to support groups. That's exactly the problem - llGiveMoney only works on avatars.. and if a group key gets returned, there's no way of establishing who the money should be given to, since scripts can't access group data. The only way I can think of doing it would be to have a central server that mapped group UUIDs to individual UUIDs, but that could be rather abusable.. I left out permission checking to keep the script as short as possible, but here's a version that adds it: integer first_time = TRUE;
default {
attach(key attacher) { if (attacher != NULL_KEY) { if (first_time) { llSetPos(<0,0.05170,0.07860>); llSetScale(<0.5,0.07241,0.02286>); llSetTexture("9c1f6fd2-3491-d174-da4b-e29f52616173",4); } llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } }
run_time_permissions(integer perms) { if (!(perms & PERMISSION_DEBIT)) { llOwnerSay("Debit permission must be granted to use Quick Tipper."); llDetachFromAvatar(); } } touch_start(integer total_number) { if (llDetectedKey(0) != llGetOwner()) return; llGiveMoney(llGetLandOwnerAt(llGetPos()),1); } }
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
04-20-2006 06:37
you legaly cannot detach from the av without requesting the permission. How about... default { state_entry() { if (llGetAttached()) { llSetPos(<0,0.05170,0.07860>); llSetScale(<0.5,0.07241,0.02286>); llSetTexture("9c1f6fd2-3491-d174-da4b-e29f52616173",4); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } } on_rez(integer a) { llResetScript(); } run_time_permissions(integer perms) { if (perms & PERMISSION_DEBIT) state Money; } }
state Money { on_rez(integer a) { if(llGetPermissionsKey() != llGetOwner()) llResetScript(); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) llGiveMoney( llGetLandOwnerAt( llGetPos()), 1); } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Gabriel Commons
Panda Press prophet
Join date: 21 Apr 2006
Posts: 7
|
Group ownership
05-11-2006 09:07
I'd like to start distributing this to friends and acquaintances ASAP -- my only concern is about the Group-Owned sims. Right now, as I understand it, if a sim is owned by a group, the money will be sent but to nobody? Can the script check if the sim is group-owned and, if so, not send it (and OwnerSay to that affect)? On my version, I added a simple Whisper line to confirm that it was clicked: llWhisper(0,"/me has forwarded your donation to this Sim's owner. Thank you for encouraging content creation." ; //This line added by Gabriel Commons to let you know it worked.(It could've done OwnerSay but wanted to pat the user on the back)
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
05-11-2006 09:20
From: Gabriel Commons Can the script check if the sim is group-owned and, if so, not send it (and OwnerSay to that affect)?
AFAIK, the only way to check if it's group owned is to ask for the land owner, call the dataserver to get the agent data of the land owner; then, if it doesn't return a value after a particular time, it must be group owned. However, to the best of my knowledge llGiveMoney() just doesn't do anything if the key it's given is a group key, so you wouldn't lose your money, it just wouldn't give money to anyone.
|
Gabriel Commons
Panda Press prophet
Join date: 21 Apr 2006
Posts: 7
|
Although...
05-11-2006 12:18
Tested it on group-owned land - - money went out.
Edit: never mind -- twas my newbishness showing itself
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
05-11-2006 12:43
From: Gabriel Commons Tested it on group-owned land - - money went out. Yeeeeeeeek! Who did it go to?
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
05-11-2006 13:16
Ok, turns out the land wasn't group deeded, just had a group set. Phew  One more try, though: integer mutex = FALSE; key landowner_key; key query_key; integer DATASERVER_TIMEOUT = 5;
resetQuery() { mutex = FALSE; landowner_key = NULL_KEY; query_key = NULL_KEY; llSetTimerEvent(0); }
dontRezMe() { llDialog(llGetOwner(),"Quick tipper should be worn on your HUD, not rezzed in the world.",[],-1); if (llGetObjectPermMask(MASK_OWNER) & PERM_COPY) llDie(); }
default { state_entry() { if (llGetAttached()) { llSetPos(<0,0.05170,0.07860>); llSetScale(<0.5,0.07241,0.02286>); llSetTexture("9c1f6fd2-3491-d174-da4b-e29f52616173",4); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } else dontRezMe(); } on_rez(integer a) { llResetScript(); } run_time_permissions(integer perms) { if (perms & PERMISSION_DEBIT) state Money; else llDialog(llGetOwner(),"Quick tipper cannot work without permission to use your money for tips. Please detach Quick Tipper, re-attach it again, and answer Yes to the permissions dialog.",[],-1); } }
state Money { state_entry() { resetQuery(); } on_rez(integer a) { if(llGetPermissionsKey() != llGetOwner()) llResetScript(); if(llGetAttached()) resetQuery(); else dontRezMe(); } touch_start(integer total_number) { if (mutex) { llOwnerSay("Quick Tipper is still busy trying to find out who to send your last tip to."); return;} if (llDetectedKey(0) != llGetOwner()) return; mutex = TRUE; landowner_key = llGetLandOwnerAt(llGetPos()); query_key = llRequestAgentData(landowner_key,DATA_NAME); llSetTimerEvent(DATASERVER_TIMEOUT); } dataserver(key reqid, string response) { if (reqid != query_key) return; if (!mutex) return; // Just in case! if (llGetSubString(response,-6,-1) == "Linden") { llDialog(llGetOwner(),"This land is owned by Linden Labs, the company that runs Second Life. They cannot recieve tips in L$.",[],-1); resetQuery(); return; } llGiveMoney(landowner_key,1); resetQuery(); } timer() { llDialog(llGetOwner(),"Unable to identify the owner of this land. It may be shared by a group.",[],-1); resetQuery(); } }
|
Designer Madonna
Designer
Join date: 14 Oct 2005
Posts: 9
|
Help understanding script
05-16-2006 15:44
I am trying to lear about HUD. I have used this script and attached it to HUD and it displays "Quick Tip". What I cannot see is where these words come from. Could someone explain that to me.
MOD
|
Russell Hansen
Texi pets are here!
Join date: 11 Apr 2006
Posts: 107
|
05-16-2006 15:56
This line llSetTexture("9c1f6fd2-3491-d174-da4b-e29f52616173",4) sets the texture on the button. In this case, the texture is a picture of the text "Quick Tip". That's the only way at the moment to actually place text on objects directly.
|