This script will give a certain configured amount (GIVE_MONEY
) of money to agents touching the primitive once per RESET_TIME
. In other words, agents have to touch the primitive once per RESET_TIME
in order to get a sum of money configured by the GIVE_MONEY
variable.
It probably can be used to increase traffic by baiting agents to come back and touch the primitive after a configurable time.
RESET_TIME
and GIVE_MONEY
variables in the configuration section of the script./////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // CONFIGURATION // ////////////////////////////////////////////////////////// // Time in seconds after which the giver will be reset // and agents are allowed to claim money again. // (Default) one week. integer RESET_TIME = 604800; // Set this to the amount of money to give an avatar once // per RESET_TIME. integer GIVE_MONEY = 10; /////////////////////////////////////////////////////////////////////////// // INTERNALS // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// string wasKeyValueSet(string var, string val, string kvp) { list dVars = llParseString2List(kvp, ["&"], []); if(llGetListLength(dVars) == 0) return var + "=" + val; list result = []; do { list data = llParseString2List(llList2String(dVars, 0), ["="], []); string k = llList2String(data, 0); if(k == "") jump continue; if(k == var && val == "") jump continue; if(k == var) { result += k + "=" + val; val = ""; jump continue; } string v = llList2String(data, 1); if(v == "") jump continue; result += k + "=" + v; @continue; dVars = llDeleteSubList(dVars, 0, 0); } while(llGetListLength(dVars)); if(val != "") result += var + "=" + val; return llDumpList2String(result, "&"); } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// string wasKeyValueGet(string var, string kvp) { list dVars = llParseString2List(kvp, ["&"], []); do { list data = llParseString2List(llList2String(dVars, 0), ["="], []); string k = llList2String(data, 0); if(k != var) jump continue; return llList2String(data, 1); @continue; dVars = llDeleteSubList(dVars, 0, 0); } while(llGetListLength(dVars)); return ""; } list vGive = []; default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) { wasKeyValueSet("start", (string)llGetUnixTime()); state wait; } } on_rez(integer num) { llResetScript(); } } state wait { state_entry() { llSetTimerEvent(1); } touch_start(integer num) { key av = llDetectedKey(0); if(llListFindList(vGive, (list)av) != -1) return; vGive += av; llGiveMoney(av, GIVE_MONEY); } on_rez(integer num) { llResetScript(); } timer() { integer start = (integer)wasKeyValueGet("start"); if(start == 0) { llSay(DEBUG_CHANNEL, "\"start\" variable not set."); return; } if(llGetUnixTime() - start > RESET_TIME) vGive = []; } }