Jump to content
Sign in to follow this  
jordanit0

HUD help

Recommended Posts

Hey everyone so I trying to get a HUD to work ive done the sender part and most of the reciever part 

this is what i got so far 

default
{
    state_entry()
    {
        llListen(-1456465,"","","");
    }

    listen(integer channel, string name, key id, string message){
        //If owner do something
        if (llGetOwnerKey(id)==llGetOwner()){
            if (message == "[BTN_1]"){
               llSetAlpha(1.0, ALL_SIDES);
               
            }
            else llSay(0, "Unknown Request");
        }
    }
}

 Now i want to add another button to turn the alpha off and i thought it would be simple enough but i get an error when i add another if statement 

default
{
    state_entry()
    {
        llListen(-1456465,"","","");
    }

    listen(integer channel, string name, key id, string message){
        //If owner do something
        if (llGetOwnerKey(id)==llGetOwner()){
            if (message == "[BTN_1]"){
               llSetAlpha(1.0, ALL_SIDES);
               if (message == "[BTN_2]"){
                  llSetAlpha (0.0, ALL_SIDES);
            }
            else llSay(0, "Unknown Request");
        }
    }
}

 Im a noob at this so any help would be great.

Thanks Jordan

Share this post


Link to post
Share on other sites

Sorry one last question. Is there a way to get the script to add and remove say a shoe base? If so could you point me in the right direction to look.

Thanks jordan

Share this post


Link to post
Share on other sites

Not without using RLV.  You can't put a script into system clothes the way you could in a prim or mesh skirt, for example, so there's no way to tell it to detach on command.

Share this post


Link to post
Share on other sites

Sorry me again now I have a problem when I click on the second button it doesn't work 

this is what im putting in button 1 

default{    state_entry()    {          }    touch_start(integer total_number)    {        llSay(-1456465, "[bTN_1]");    }}

 and button 2

default{    state_entry()    {          }    touch_start(integer total_number)    {        llSay(-1456465, "[bTN_2]");    }}

 and in the object I want to switch the alpha on and off 

default{    state_entry()    {        llListen(-1456465,"","","");    }    listen(integer channel, string name, key id, string message){        //If owner do something        if (llGetOwnerKey(id)==llGetOwner()){            if (message == "[bTN_1]"){               llSetAlpha(1.0, ALL_SIDES);               if (message == "[bNT_2]"){                   llSetAlpha(0.0, ALL_SIDES);            }            else llSay(0, "Unknown Request");        }        }    }}

 Clicking on button 1 just gives unkown request.  

Do I need to have the buttons using different channels?

Thanks Jordan 

Share this post


Link to post
Share on other sites

Three suggestions:

1.  Check to be sure that all Open brackets { are matched by closed brackets }   (Yours aren't.)

2.  Check all spelling.  BNT != BTN.

3.  Consider using llDetectedTouchST and a single texture instead of making separate scripted prim buttons.  It's a MUCH better use of resources.

  • Like 1

Share this post


Link to post
Share on other sites

Your bracketing was wrong.   Try this (I've also added an "else" to it, so that, if condition 1 is true, it doesn't bother to evaluate condition 2 (which must be false, if 1 is true);

 

	listen(integer channel, string name, key id, string message){		//If owner do something		if (llGetOwnerKey(id)==llGetOwner()){			if (message == "[bTN_1]"){				llSetAlpha(1.0, ALL_SIDES);			}			else if (message == "[bTN_2]"){				llSetAlpha(0.0, ALL_SIDES);			}			else llSay(0, "Unknown Request");		}	}//end of listen

 

  • Like 1

Share this post


Link to post
Share on other sites

Ah thank you both like i said noob here and your help is very much appreciated :) 

I'll have a look at that Rolig :)

Hopefully I wont be back to pick your brains.  I do stress hopefully lol 

Thanks again though :) 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...