Controler HUD Creation - How?
|
Bezilon Kasei
Registered User
Join date: 20 Sep 2006
Posts: 11
|
08-16-2009 03:29
Hello! I'd like to know how to create the script of a hud and the reciver object. For example I want to make the reciver be visible/invisible by the push of a hud button. And what's more important, I want it to be owner based controled, so it doesn't confuse control others' recivers. If you could show it in a script I'd be very greatful =)
|
Kephra Nurmi
winged bug
Join date: 12 Jan 2007
Posts: 180
|
08-16-2009 05:25
Moin Bezilon, From: Bezilon Kasei Hello! I'd like to know how to create the script of a hud and the reciver object. For example I want to make the reciver be visible/invisible by the push of a hud button. And what's more important, I want it to be owner based controled, so it doesn't confuse control others' recivers. If you could show it in a script I'd be very greatful =) you could use lsDialog from my http://wiki.secondlife.com/wiki/User:Kephra_Nurmi Wiki sources as a HUD, without the need to write any LSL ... just define the behavoir in the notecard. From: .lsDialog Dialog=Once
[Switch] Visible=region 123 become,visible Invisible=region 123 become,invisible
The action part should be something like: From: visible,123 default { state_entry() { integer channel = llList2Integer(llCSV2List(llGetObjectDesc()),2); if (0 == channel) channel = 123; llListen(channel, "", NULL_KEY, ""  ; } listen( integer ch, string name, key id, string message ) { key k = id; if (llGetAgentInfo(id)<=0) k = llGetOwnerKey(id); if (llGetOwner() != k) return; if ("become,visible" == message) becomeVisible(1); if ("become,invisible" == message) becomeVisible(0); } on_rez(integer p) { llResetScript(); } } ciao,Kephra
|
Bezilon Kasei
Registered User
Join date: 20 Sep 2006
Posts: 11
|
08-16-2009 05:57
Thanks, but it's far too complicated for me and I don't want it to be notcard driven. I know there's a simple way to do this but I don't know lsl that much to just make this kind of a script. That's why I'm asking you for your kind help.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-16-2009 06:12
To make the receiving object visible/invisible, just use llSetAlpha in the receiving object and switch between llSetAlpha(1.0, ALL_SIDES) and llSetAlpha(0.0,ALL_SIDES). To be sure that the receiver only responds to your HUD, all you have to do is communicate on a private channel. Set the communications channel to some large, randomly-selected negative number that is only known to your HUD. You can of course always make doubly sure by scripting the receiver to listen only to messages from llGetOwner().
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Bezilon Kasei
Registered User
Join date: 20 Sep 2006
Posts: 11
|
08-16-2009 06:33
Thank you but could you provide a script too? I knew 90% of the method this connection was made but I don't know how to write it into lsl script  Please if it's not a burden to you write it down.
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
08-16-2009 06:54
From: Bezilon Kasei I know there's a simple way to do this but I don't know lsl that much to just make this kind of a script. That's why I'm asking you for your kind help. Sounds like you have got no clue at all  I hope you are not just fishing for free scripts! Here are some anyway: The first script goes in the hud. The hud is made of two prims, one to push for ON and the other to push for OFF. The script goes in the root. The slave has no script. integer kanal = -15667; string sayon = "turn glow ON"; string sayoff = "turn glow OFF";
default { touch_start(integer num_detected) { if ( llDetectedLinkNumber(0) == 1 ) llRegionSay( kanal, sayon ); else if ( llDetectedLinkNumber(0) == 2 ) llRegionSay( kanal, sayoff ); } }
The second script is the receiver. It goes in the prim you want to turn on and off: integer kanal = -15667; string sayon = "turn glow ON"; string sayoff = "turn glow OFF";
default { state_entry() { llListen( kanal, "", NULL_KEY, "" ); }
listen(integer channel, string name, key id, string message) { if ( llGetOwnerKey( id ) == llGetOwner() ) { if ( message == sayon ) llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 1.0]); if ( message == sayoff ) llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.0]); } }
on_rez(integer param) { llResetScript(); } }
I am aware you want to turn the transparency on and off. I will leave it up to you to modify the script for that. Happy Scripting 
_____________________
From Studio Dora
|
Bezilon Kasei
Registered User
Join date: 20 Sep 2006
Posts: 11
|
08-16-2009 08:01
Thank you very much! I've got it almost all, but the only problem is that I'm not good enough at lsl to write my own scripts (I don't know most of the "LL" commands) that I could do in C# for eg. I know they're very similar, but still lsl has commands I don't know what they do =S But I'm really greatful for your kindness to write me an example! Thank you =)
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-16-2009 08:52
This is the place to learn how to script. Your project is a simple starting project, and Dora has given you a nice (almost finished) example. Run with it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-16-2009 12:24
If you haven't already, start poking around in http://wiki.secondlife.com/wiki/LSL_Portal and http://www.lslwiki.net/lslwiki/wakka.php?wakka=HomePage (they contain a lot of the same information, but there are also gems in each). Reading or skimming through them category by category is a good way to get an idea of what can be done in an LSL script.
|