|
Regan Flasheart
Adulterated content
Join date: 25 Nov 2005
Posts: 25
|
09-24-2007 14:51
I'm slowly getting acquainted with LSL but I've hit a (hopefully) minor stumbling block, I can't seem to get a HUD attachment driven menu to talk to another attachment, or perhaps the attachment isn't listening correctly. The attachment has a very simple owner listen which changes the texture opacity to preset levels, this works fine when the commands are given by the avatar. Thinking an attachment speaking would be indistinguishable from the actual avatar speaking, I made/copypasted this script to send the same messages as the chat commands: From: someone list menu = [ "Off", "25%", "50%", "75%", "100%"]; key owner; default { state_entry() { owner = llGetOwner(); } on_rez(integer a) { llResetScript(); } touch_start(integer total_number) { llDialog(owner, "Please select a glow intensity", menu, 33); } listen(integer channel, string name, key id, string m) { if (llListFindList(menu, [m]) != -1) { if (m == "Off"  llSay(33, "eoff"  ; else if (m == "25%"  llSay(33, "e25"  ; else if (m == "50%"  llSay(33, "e50"  ; else if (m == "75%"  llSay(33, "e75"  ; else if (m == "100%"  llSay(33, "e100"  ; } } } The listener in the other attachment: From: someone default { state_entry() { llListen(33,"",llGetOwner(),""  ; } on_rez(integer param) { llResetScript(); } listen(integer channel, string name, key id, string m) { if (m=="eoff"  { llSetAlpha(0.0, ALL_SIDES); } if (m=="e25"  { llSetAlpha(0.25, ALL_SIDES); } if (m=="e50"  { llSetAlpha(0.5, ALL_SIDES); } if (m=="e75"  { llSetAlpha(0.75, ALL_SIDES); } if (m=="e100"  { llSetAlpha(1.0, ALL_SIDES); } } } Is there some rudimentary error here? I have to admit to being a bit lost on the Wiki o_o; Any help would be most appreciated !
|
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
09-24-2007 15:31
i think its llListen(33,"",llGetOwner(),""  ; its listening for you to say it not the attachment. why not just use the dialog? in the listener listen for what the dialog is saying, a dialog is the same as owner saying it. get rid of the say and event and then in the listener script listen for "Off", "25%", "50%", "75%", "100%" ~LW
_____________________
L$ is the root of all evil videos work! thanks SL 
|
|
Regan Flasheart
Adulterated content
Join date: 25 Nov 2005
Posts: 25
|
09-25-2007 06:49
Thank you, that seems to have worked perfectly  And it's so much simpler that I think I understand how it works. Today a HUD menu, tomorrow, the world ^_^
|
|
Phineas Flanagan
Registered User
Join date: 25 Feb 2007
Posts: 65
|
09-30-2007 07:58
Thanks for answering this! This is totally what I was doing wrong with my first HUD attempt! I figured out how to make a HUD without looking at examples even, but then the buttons didn't seem to be triggering the attachments on the avatar. Sure enough, I was using llGetOwner in the attachment scripts. I set id to NULL_KEY and had the scripts listen to the object's name instead, and it works perfectly. A whole new vista is opened before me! bwaha. 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
09-30-2007 10:03
the other option is to make the attachment listen for "hud name here"
|
|
Regan Flasheart
Adulterated content
Join date: 25 Nov 2005
Posts: 25
|
10-04-2007 16:59
I tried NULL_KEY before, but all that did was allow anyone with the same HUD to command my attachments, which was a little disconcerting (In case you're wondering, I did put a reset on rez in it so it wouldn't still see me as owner). I suspect the same problem would arise with a listener 'tuned' to the HUD name. I now realise why dialogs are so much more efficient than multi button HUDs, although I still have to remember to put the list in the peculiar order that the buttons are sorted to O.o Edit: There's also this page on the LSL Wiki, which would be useful with a 'classic' HUD, multiple buttons etc. http://lslwiki.net/lslwiki/wakka.php?wakka=ExampleHUDCommunication
|