Jump to content

HUD help


jordanit0
 Share

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

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

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

Link to comment
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 

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...