Tomko Galicia Posted May 30, 2013 Share Posted May 30, 2013 I'm trying to add a show/hide option to a dialog menu. The problem I have is when I press the button, it works, then brings back the menu. However when I click the button again it won't action the second if statement and closes the menu. When I reclick the menu the button works again. The code I'm using is if (message == "Show/Hide"){if (show == 0){show = 1;llSetAlpha(0.0, ALL_SIDES); // set entire prim 100% invisible.}else{show = 0;llSetAlpha(1.0, ALL_SIDES); // set entire prim 100% visible.}llDialog(ToucherID, dialogInfo, buttons, dialogChannel);} Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 30, 2013 Share Posted May 30, 2013 My guess is that you haven't made "show" a global variable. If it's local to this part of the script, then you are setting it to equal 1 inside your first test and then forgetting it. If you make "show" glbal, though, it will remember that value the next time you need it. Having said that, there's a much simpler way to write that section of code (again, assuming that "show" is a global integer)... if (message == "Show/Hide"){ llSetAlpha(1.0 * (show = !show), ALL_SIDES); llDialog(ToucherID,dialoginfo, buttons, dialogChannel);} 1 Link to comment Share on other sites More sharing options...
Ron Khondji Posted May 31, 2013 Share Posted May 31, 2013 Or do you maybe close the listen at the beginning of the listen event. In that case you have to re-open it for the script to be able to hear the dialog. Link to comment Share on other sites More sharing options...
Phil Deakins Posted May 31, 2013 Share Posted May 31, 2013 It does sound like it's not listening any more. I love Rolig's llSetAlpha line. When I read your code, my first thought was to use show = !show, but the way that Rolig has used it is so beautiful 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