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" // fred.
18 // the list of emails that should be alerted.
19 list EMAILS_TO_ALERT = [
20 // "damradbruch@hotmail.com", // damara's alt email.
21 "fred@gruntose.com" // fred.
24 // global variables...
26 integer REPORTED_ABOUT_REZ = FALSE; // did we tell the merchants yet?
28 key CURRENT_OWNER = NULL_KEY; // the guy who owns the hud right now.
30 // helper functions...
32 // let the merchants who sold this product know that it was either rezzed or attached.
33 // either event should cause a nice report to them.
34 alert_the_merchants(string word)
37 if (CURRENT_OWNER != llGetOwner()) {
38 // if the owner has changed, then we always believe that we need to report.
39 REPORTED_ABOUT_REZ = FALSE;
40 CURRENT_OWNER = llGetOwner();
42 if (!REPORTED_ABOUT_REZ) {
43 // we have not reported before (for this owner), so we can tell the merchants now.
44 REPORTED_ABOUT_REZ = TRUE;
45 string message_for_merchants = "Your product '" + llGetObjectName() + "' was "
46 + word + " by " + llKey2Name(llGetOwner())
47 + " in " + llGetRegionName()
48 + " at " + llGetTimestamp();
49 // send instant messages about this event.
50 for (i = 0; i < llGetListLength(IDS_TO_ALERT); i++) {
51 key id = (key)llList2String(IDS_TO_ALERT, i);
52 llInstantMessage(id, message_for_merchants);
54 // send emails about it too.
55 for (i = 0; i < llGetListLength(EMAILS_TO_ALERT); i++) {
56 string addr = llList2String(EMAILS_TO_ALERT, i);
57 llEmail(addr, "customer event for " + llKey2Name(llGetOwner())
58 + " regarding " + llGetObjectName(),
59 message_for_merchants);
61 // see if the script should go away now.
62 if (SCRIPT_ZAPS_SELF_AFTER_REPORT) {
63 llRemoveInventory(llGetScriptName());
70 state_entry() { CURRENT_OWNER = llGetOwner(); }
73 if (id != NULL_KEY) { alert_the_merchants("attached"); }
76 on_rez(integer start_parm) { alert_the_merchants("rezzed"); }