Jump to content

Show/Hide Help


Jenny Ashland
 Share

You are about to reply to a thread that has been inactive for 1100 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I thought what I was doing was fairly simple. I have a prim that I am wearing that has text over it; Simple enough.

I want to show and hide the prim and the text with menu buttons. I made the menu and all that which works fine and for the buttons I have:

if(message == "Hide"){
            llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
            llSetText("", <1.0,1.0,1.0>, 0.0);}

and this 

 if(message == "Show"){
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
            llSetText("", <1.0,1.0,1.0>, 1.0);

Now for the problem... it will hide both the prim and the text; however it will only show the prim not the text. I have been at this for days, and I can't figure it out what I am doing wrong.

Now ideally: This script is working with other scripts and there is a chat command "/28 Show" that will turn the text back on. If I could turn that chat command into a button on a menu, that would be awesome, but nothing I seem to do works. I tried to think simpler and do:  llOwnerSay("/28 Show!"); but that only says "/28 Show" in the chat and does nothing. 

At this point I am at a stale mate, any help would be greatly appreciated. 

 

Link to comment
Share on other sites

Since you're setting text to "" (empty string) even on "Show" command then it's natural you'll see nothing. You need to save the hover text value in a variable or get it on show/hide and set it instead of clearing it like this. Alpha 0.0 - 1.0 should be enough for your usage.

integer gListenHandle;
 
stopListener()
{
    llListenRemove(gListenHandle);
    llSetTimerEvent(0);
}
 
default
{
    touch_start(integer nd)
    {
        key toucherKey = llDetectedKey(0);
        if (toucherKey == llGetOwner())
        {
            gListenHandle = llListen(-1234567, "", toucherKey, "");
            llDialog(toucherKey, "Select an option", ["Show", "Hide"], -1234567);
            llSetTimerEvent(60);
        }
    }

    timer()
    {
        stopListener();
    }

    listen(integer channel, string name, key id, string message)
    {
        stopListener();
        string hoverText = llList2String(llGetPrimitiveParams([PRIM_TEXT]), 0);
        if (message == "Hide")
        {
            llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
            llSetText(hoverText, <1.0, 1.0, 1.0>, 0.0);
        }
        else if (message == "Show")
        {
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
            llSetText(hoverText, <1.0, 1.0, 1.0>, 1.0);
        }
    }

    on_rez(integer start_param)
    {
        llResetScript();
    }

    changed(integer change)
    {
        if (change & CHANGED_OWNER)
        {
            llResetScript();
        }
    }
}

 

Edited by panterapolnocy
Link to comment
Share on other sites

Well, neither of your llSetText statements actually contains any text.  You have to put something in the quotation marks:

 if(message == "Show"){
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
            llSetText("Text goes here", <1.0,1.0,1.0>, 1.0);

An easier way to write your script would be:

float Which = (float)llListFindList(["Hide", "Show"],[message]);
llSetLinkAlpha(LINK_SET, Which, ALL_SIDES);
llSetText("Text goes here", <1.0,1.0,1.0>, Which);

 

Link to comment
Share on other sites

Thank you so much for your fast response, I was wondering if it was because I didn't define it. The text is something that is always changing with the other scripts, so that means that if I have to define it, it will not work. So that answers that question.

So the next try would be to change a chat command into a menu button. I will work on that, thanks again :) 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1100 days.

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
 Share

×
×
  • Create New...