Pete
Pete

Reputation: 567

Getting the result of llGiveInventory

I have an LSL script that gives an object to a user using llGiveInventory(). Is there a way for my script to know if the user accepted or rejected the object?

In my viewer (Firestorm), when I accept the object being given I can see a message:

"Grid: Primitive owned by Test User gave you Pizza. Primitive is located at MyRegion <107.7737, 137.6579, 23.5>.

That message even shows up on the Conversation log, so it seems to appear as a message. I tried listening on channel 0 and DEBUG_CHANNEL, but both didn't hear the message.

Here's the current script:

string objName = "Pizza";
default {
    state_entry() {
        llListen(DEBUG_CHANNEL, "", NULL_KEY, "");
    }

    touch_start(integer num_detected) {
        llGiveInventory(llDetectedKey(0), objName);
    }

    listen (integer channel, string name, key id, string message) {
        llOwnerSay("Did you hear that?  I heard " + message);
    }
}

Upvotes: 1

Views: 387

Answers (2)

SaskiaWood
SaskiaWood

Reputation: 1

The answer is right, but not complete in my humble opinion.

If you want to know, if somebody accepted and attached/rezzed this object, so you'll have to add a script into the object itself.

You use the function "on_rez(){}" or "state_entry(){ }" and let the object inform you, that llDetected_Key(0) has rezzed the object. Or you can send an email to the server, which sent the object to specified residents with some informations WHAT was rezzed/attached and WHO has rezzed/attached.

Then a serverscript can analyse and compare the list of receivers with the list of "openers".

Upvotes: 0

OntaFreng
OntaFreng

Reputation: 36

There is no way to know if the transaction failed. Unless you send a message when inventory is given to a prim and prim's script checks its inventory and sends a message back using llRegionSay. - LSL Wiki

Unfortunately you cannot see whether the transaction was successful or not

http://wiki.secondlife.com/wiki/LlGiveInventory

Upvotes: 2

Related Questions