|
Orcus Hax
Registered User
Join date: 14 Jul 2007
Posts: 8
|
08-02-2007 16:41
OK I'm trying to write a menu (dialog) based DJ chair, but I can't seem to get past the "if (llAvatarOnSitTarget() != NULL_KEY)" statment. I've set the llSitTarget in the state_entry() function, but when you sit on the chair... nothing... anyway here's the whole of the code (except the mutipul if statments), if anyone has any ideas, I'd love to here them. P.S. Does LSL have something like C's case statment? I'm using a load of if statments but that *must* be so ineffective. -------------- -------------------------------------------- integer CHANNEL = 42; // dialog channel list MENU_MAIN = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
default { state_entry() { llSetSitText("DJ"); llListen(CHANNEL, "", NULL_KEY, ""); llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
}
changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY) { llSay(0,"changed"); llDialog(llDetectedKey(0), "Choose a station: \n 1 CroniX Aggression (Alternative) \n 2 1.FX - Channel X (Alternative) \n 3 Radio.Wazee (Alternative) \n 4 Station FM-Les Meillrues (Techno) \n 5 DeviantAudio (Techno) \n 6 PulseRadio (Techno) \n 7 Magic Radio (80's) \n 8 Generation Disco Funk (80's) \n 9 WBITS Internet Radio NL (80's) ", MENU_MAIN, CHANNEL); } } }
listen(integer channel, string name, key id, string message) { if (message == "1"){ llSetParcelMusicURL( "http://64.236.34.97:80/stream/1039" ); llSay(0,message); }
/////// deleted for space } }
----------]End of Code[--------------------
|
|
Orcus Hax
Registered User
Join date: 14 Jul 2007
Posts: 8
|
Nb
08-02-2007 16:44
I've just realised this also includes my debuging code... please ingore the "llSay(0,"changed"  ;"'s that are littered around. Well I guess it shows I've tryed to find the problem out myself *grins*
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
08-02-2007 16:59
You need to set your sit target to something other than <0,0,0>. Even <0,0,.1> is ok. Just all zeros clears it. http://rpgstats.com/wiki/index.php?title=LlSitTarget
|
|
Silje Russell
lsl geek
Join date: 2 Oct 2005
Posts: 63
|
08-02-2007 20:14
default { state_entry() { llSetSitText("DJ"  ; llListen(CHANNEL, "", NULL_KEY, ""  ; llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); } changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change if (llAvatarOnSitTarget() != NULL_KEY) { llSay(0,"changed"  ; llDialog(llAvatarOnSitTarget(), "Choose a station: \n 1 CroniX Aggression (Alternative) \n 2 1.FX - Channel X (Alternative) \n 3 Radio.Wazee (Alternative) \n 4 Station FM-Les Meillrues (Techno) \n 5 DeviantAudio (Techno) \n 6 PulseRadio (Techno) \n 7 Magic Radio (80's) \n 8 Generation Disco Funk (80's) \n 9 WBITS Internet Radio NL (80's) ", MENU_MAIN, CHANNEL); } } } listen(integer channel, string name, key id, string message) { if (message == "1"  { llSetParcelMusicURL( "http://64.236.34.97:80/stream/1039" ); llSay(0,message); } /////// deleted for space } } you cant use llDetectedKey(0) in change event use llAvatarOnSitTarget() insted 
_____________________
Yes i know i got typos.. I got writing and reading problems. but i am still a humen!!
|
|
Orcus Hax
Registered User
Join date: 14 Jul 2007
Posts: 8
|
Thanks
08-03-2007 00:28
Thanks
|