SeeAirAhh Josephina Posted February 24, 2021 Share Posted February 24, 2021 I was trying to make a hud that would give the owner a choice of URL's to load using a dialog menu, unfortunately it's not working; string button1 = "Google"; string button2 = "MSN"; string button3 = "Yahoo"; list MENU = [button1,button2,button3]; string menu_message = "Multi URL Hud"; integer DIALOG_CHAN; integer listen_handle; default { touch_start(integer total_number) { if (listen_handle != 0) { llListenRemove(listen_handle); listen_handle = 0; } listen_handle = llListen(DIALOG_CHAN,"","",""); llDialog(llDetectedKey(0),menu_message,MENU,DIALOG_CHAN); } listen(integer channel, string name, key id, string message) { if( channel == DIALOG_CHAN) { if(message == button1) { key id = llDetectedKey(0); integer avatarInSameSim = (llGetAgentSize(id) != ZERO_VECTOR); if (avatarInSameSim) { string info = "Google"; string url = "http://www.google.com/"; llLoadURL(id, info, url); } else { llInstantMessage(id, "I can only open a URL dialog on your screen if you're in my sim!"); } } if(message == button2) { llSay(0,llKey2Name(id)+" now you clicked button 2"); } if(message == button3) { llSay(0,llKey2Name(id)+" now you clicked button 3"); } llListenRemove(listen_handle); listen_handle = 0; } } } Should the detect avatar key be at the top? Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 24, 2021 Share Posted February 24, 2021 (edited) You don't need the line that says key id = llDetectedKey(0); For one thing, the llDetected * functions won't work unless they are in an event that detects something (like a touch_start event or a sensor event). For another (better) thing, the variable id is already defined in the listen event, so you don't need to do it again. You also don't need to create a new variable string info = "Google"; because you have already defined that as button1 anyway. All you need to do is check whether message == button1. Then you can llLoadURL (id, info, button1); And of course you still need to do the same thing for button2 and button3. I suggest being very careful about indenting properly. That will make it a lot easier to check for matching { } brackets. I didn't check them myself, but you should. Edited February 24, 2021 by Rolig Loon Additional information 1 Link to comment Share on other sites More sharing options...
SeeAirAhh Josephina Posted February 24, 2021 Author Share Posted February 24, 2021 6 minutes ago, Rolig Loon said: You don't need the line that says key id = llDetectedKey(0); Oh that made all the difference, thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now