2 // huffware script: report to merchants, by fred huffhines.
4 // this script lets merchants know that one of their items has been rezzed or attached.
5 // it only reports this the first time it happens.
9 integer SCRIPT_ZAPS_SELF_AFTER_REPORT = FALSE;
10 // if this is true, the script will destroy itself once it reports the object rez or attach.
12 // the list of UUIDs for reporting the customer event.
14 // "addfa58f-e42e-4dde-9eb0-755bbf4e23ec", // damara's alt.
15 "71649242-6abe-4288-b45b-a057621d35ea" // SL fred.
16 "1e7f0c5e-9d15-428b-8873-846d87a9c064" // hal fred.
19 // the list of emails that should be alerted.
20 list EMAILS_TO_ALERT = [
21 // "damradbruch@hotmail.com", // damara's alt email.
22 "fred@gruntose.com" // fred.
25 // global variables...
27 integer REPORTED_ABOUT_REZ = FALSE; // did we tell the merchants yet?
29 key CURRENT_OWNER = NULL_KEY; // the guy who owns the hud right now.
31 // helper functions...
33 // let the merchants who sold this product know that it was either rezzed or attached.
34 // either event should cause a nice report to them.
35 alert_the_merchants(string word)
38 if (CURRENT_OWNER != llGetOwner()) {
39 // if the owner has changed, then we always believe that we need to report.
40 REPORTED_ABOUT_REZ = FALSE;
41 CURRENT_OWNER = llGetOwner();
43 if (!REPORTED_ABOUT_REZ) {
44 // we have not reported before (for this owner), so we can tell the merchants now.
45 REPORTED_ABOUT_REZ = TRUE;
46 string message_for_merchants = "Your product '" + llGetObjectName() + "' was "
47 + word + " by " + llKey2Name(llGetOwner())
48 + " in " + llGetRegionName()
49 + " at " + llGetTimestamp();
50 // send instant messages about this event.
51 for (i = 0; i < llGetListLength(IDS_TO_ALERT); i++) {
52 key id = (key)llList2String(IDS_TO_ALERT, i);
53 llInstantMessage(id, message_for_merchants);
55 // send emails about it too.
56 for (i = 0; i < llGetListLength(EMAILS_TO_ALERT); i++) {
57 string addr = llList2String(EMAILS_TO_ALERT, i);
58 llEmail(addr, "customer event for " + llKey2Name(llGetOwner())
59 + " regarding " + llGetObjectName(),
60 message_for_merchants);
62 // see if the script should go away now.
63 if (SCRIPT_ZAPS_SELF_AFTER_REPORT) {
64 llRemoveInventory(llGetScriptName());
70 state_entry() { if (llSubStringIndex(llGetObjectName(), "huffotronic") < 0) state real_default; }
71 on_rez(integer parm) { state rerun; }
73 state rerun { state_entry() { state default; } }
77 state_entry() { CURRENT_OWNER = llGetOwner(); }
80 if (id != NULL_KEY) { alert_the_merchants("attached"); }
83 on_rez(integer start_parm) { alert_the_merchants("rezzed"); }