Freebie vendor script

  • Welcome to the new forums! Please note that we are continueing to work on the look and feel of the forum. If you experience any broken images, miscolor, or broken pages please report them to the forum administrator. Please bear with us while we make this transition as we hope to have it completed soon.
  • Please note: This forum is primarily intended for receiving help from other DigiWorldz residents. Getting support from the DigiWorldz staff team isn't guaranteed here. If you require urgent support it is highly recommended that you Create a Support Ticket with the relevant information.

VenumusVortex

Community Resident
Community Resident
#1
This is so you can give freebie items to digi residents but prevent any HG visitor from getting your freebie items
Place the script in a prim along with 1 or all of your freebie items and let everyone know ;)

Code:
string hguri = "login.digiworldz.com"; // uri to the grid via hypergrid just leave out the :8002
// dont worry about the rest below, the script will self configure itself
integer localchan;
integer glisten;
list defbtns = ["GET FREEBIE", "EXIT"];
diamenu(key toucher) {
    glisten = llListen(localchan, "", toucher, "");
    llDialog(toucher, "How may I help you "+llKey2Name(toucher)+"?", defbtns, localchan);
}
deliveritems(key avi) {
    list invlist = [];
    integer c = llGetInventoryNumber(INVENTORY_ALL);
    integer i = 0;
    for (i; i < c; ++i) {
        string iname = llGetInventoryName(INVENTORY_ALL, i);
        if (iname != llGetScriptName()) {
            invlist += iname;
        }
    }
    if (invlist != []) {
        llGiveInventoryList(avi, llGetObjectName(), invlist);
        llSay(0, "items sent!");
    }else{
        llSay(0, "Sorry no items to freely give in this prim at this time.");
    }
}
default {
    state_entry() {
        localchan = -(llRound(llFrand(999999)) + 99999);
    }
    touch_end(integer nd) {
        string aviname = llDetectedName(0);
        key toucher = llDetectedKey(0);
        if (llSubStringIndex(aviname, "@") == -1) {
            diamenu(toucher);
        }else if (llSubStringIndex(aviname, hguri) != -1) {
            diamenu(toucher);
        }else{
            llSay(0, "You are not of this world.");
        }
    }
    listen(integer chan, string name, key id, string msg) {
        if (chan == localchan) {
            llListenRemove(glisten);
            if (msg == "EXIT") {
                // do nothing and just close the listen silently
            }
            if (msg == "GET FREEBIE") {
                deliveritems(id);
            }
        }
    }
    on_rez(integer sp) {
        llResetScript();
    }
    changed(integer c) {
        if (c & CHANGED_REGION_START) {
            llResetScript();
        }
    }
}