Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer gListener; // Identity of the listener associated with the dialog, so we can clean up when not needed
- default
- {
- touch_start(integer total_number)
- {
- // Kill off any outstanding listener, to avoid any chance of multiple listeners being active
- llListenRemove(gListener);
- // get the UUID of the person touching this prim
- key user = llDetectedKey(0);
- // Listen to any reply from that user only, and only on the same channel to be used by llDialog
- // It's best to set up the listener before issuing the dialog
- gListener = llListen(-99, "", user, "");
- // Send a dialog to that person. We'll use a fixed negative channel number for simplicity
- llDialog(user, "\nDo you wish this prim to die?", ["Give to...", "Get Group..." ] , -99);
- // Start a one-minute timer, after which we will stop listening for responses
- llSetTimerEvent(60.0);
- }
- listen(integer chan, string name, key id, string msg)
- {
- // If the user clicked the "Yes" button, kill this prim.
- if (msg == "Give to...")
- {
- integer channel = -13572468;
- // "" saves byte-code over NULL_KEY
- gListener = llListen( channel, "", "", "");
- llTextBox(llDetectedKey(0), "Some info text for the top of the window...", channel);
- }
- listen(integer channel, string name, key id, string message)
- { llListenRemove(gListener);
- name_key_query = llRequestUserKey(message);
- }
- dataserver(key queryid, string data)
- {
- if ( name_key_query == queryid )
- {
- llGiveInventory( data,"Revenland Dice v1.4");
- }
- }
- //Insert Else command here
- {
- llOwnerSay("Here is a link to the secondlife:///app/group/e5c17f1d-fa0b-8a6e-ef62-940d71be398c/about group.");
- // Stop listening. It's wise to do this to reduce lag
- llListenRemove(gListener);
- // Stop the timer now that its job is done
- llSetTimerEvent(0.0);// you can use 0 as well to save memory
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement