llDialog without touch_start -- need help
|
|
Miles Beck
MilesBeck.com
Join date: 20 Mar 2007
Posts: 537
|
02-18-2008 04:15
I'm using the wiki script below as a foundation for a new script. I want llDialog to start immediately after the item is rezzed, but everything I've tried has failed. I've tried removing touch_start and using on_rez in place of state_entry; most of my attempts have compiled, but none results in a menu. What do I need to do to get the dialog to appear upon rezzing the object? Thanks. integer channel = 1000; list pairs = []; default { state_entry() { llListen(channel,"", "",""); } touch_start(integer count) { llDialog(llDetectedKey(0), "This is a test dialog.\n\nPlease choose one of the below options.", ["Yes", "No", "0", "1"], channel);
} listen(integer chan, string name, key id, string mes) { if(id == llGetOwnerKey(id))//won't listen to objects unless they aren't in the region. llSay(0,name + " (" + (string)llGetObjectDetails(id, (list)OBJECT_POS) + ") chose option " + mes); }
}
|
|
Whispering Hush
™
Join date: 20 Mar 2007
Posts: 277
|
02-18-2008 04:51
on_rez event
replace the touch_start not the state_entry.
|
|
Sho Iuga
Registered User
Join date: 6 Jun 2007
Posts: 35
|
02-18-2008 04:52
You have to replace touch_start with on_rez (and give llDialog the UUID of the person that shall see the dialog, llDetectedKey() wont work in on_rez event). The llListen function call in the state_entry is still needed or the object wont listen to the dialog (though you can put that in the on_rez event too) The script should look like the following. And please dont forget to remove the listener once the script has fulfilled its purpose. integer channel = 1000; list pairs = []; integer iListenHandle;
default { on_rez(integer start_param) { iListenHandle = llListen(channel,"", "",""); //setting up the listener llDialog(llGetOwner(), "This is a test dialog.\n\nPlease choose one of the below options.", ["Yes", "No", "0", "1"], channel); //will show dialog to owner }
listen(integer chan, string name, key id, string mes) { if(id == llGetOwnerKey(id))//won't listen to objects unless they aren't in the region. llSay(0,name + " (" + (string)llGetObjectDetails(id, (list)OBJECT_POS) + ") chose option " + mes); llListenRemove(iListenHandle); // remove the listener after we are done. }
}
|
|
Whispering Hush
™
Join date: 20 Mar 2007
Posts: 277
|
02-18-2008 04:54
lol, hi sho 
|
|
Sho Iuga
Registered User
Join date: 6 Jun 2007
Posts: 35
|
02-18-2008 04:56
You were a bit faster in replying, Whispering. But Miles said he tried on_rez though seemingly not correctly. So I gave a little longer answer.
|
|
Whispering Hush
™
Join date: 20 Mar 2007
Posts: 277
|
02-18-2008 04:58
yeah, he replaced the listen in state_entry by the sound of it.
|
|
Miles Beck
MilesBeck.com
Join date: 20 Mar 2007
Posts: 537
|
02-18-2008 05:01
Thanks, Sho, but it didn't work. After rezzing, no menu appeared. Any other ideas?
|
|
Whispering Hush
™
Join date: 20 Mar 2007
Posts: 277
|
02-18-2008 05:04
integer channel = 1000; list pairs = []; default { state_entry() { llListen(channel,"", "",""  ; } on_rez(integer hiya) { llDialog(llGetOwner(), "This is a test dialog.\n\nPlease choose one of the below options.", ["Yes", "No", "0", "1"], channel); } listen(integer chan, string name, key id, string mes) { if(id == llGetOwnerKey(id))//won't listen to objects unless they aren't in the region. llSay(0,name + " (" + (string)llGetObjectDetails(id, (list)OBJECT_POS) + "  chose option " + mes); } }
|
|
Miles Beck
MilesBeck.com
Join date: 20 Mar 2007
Posts: 537
|
02-18-2008 05:05
Nevermind, got it. Thanks, Sho!!!!!!!!!!!!
|
|
Whispering Hush
™
Join date: 20 Mar 2007
Posts: 277
|
02-18-2008 05:07
take it into inventory and rez it 
|
|
Miles Beck
MilesBeck.com
Join date: 20 Mar 2007
Posts: 537
|
02-18-2008 06:18
From: Whispering Hush take it into inventory and rez it  Wasn't the problem, but thanks. I had copy/pasted only 99% of Sho's script. "nteger channel" didn't work very well. 
|