Jump to content

Hud that use a unique channel for all vehicle riders ?


Simoo0
 Share

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

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

Recommended Posts

I am working on a vehicle that has a Hud all riders can use it, the problem in my script is that I must use a unique channel cause there will be more vehicle in the same region that's why I used this 

>>> ch1 = (integer)("0xF" + llGetSubString(llGetOwner(),0,6));

but when the rider has HUD on, It will get his key and the channel will be different and the vehicle will not listen to HUD 

I got a solution for that to create another channel in the vehicle to listen in change event like this

>>> ch_fire1 = (integer)("0xF" + llGetSubString(llGetLinkKey(17),0,6));

llGetLinkKey(17) is the key of the second rider

but i think it is not the best solution for that ..any ideas on how to fix that and i appreciate your help ^^

-----------------------------

Script in vehicle :

integer ch1;

 state_entry()
    { 

      llListen(ch1,"","","");
       ch1 = (integer)("0xF" + llGetSubString(llGetOwner(),0,6));

     }

    listen(integer channel, string name, key id, string message)
    {

        if (llAvatarOnLinkSitTarget(LINK_ROOT) != NULL_KEY)
             {

            //Do Things 

             }

      }

------------------------------------

script in HUD :

integer ch1;

default
{    
    state_entry()    
    {
        ch1 = (integer)("0xF" + llGetSubString(llGetOwner(),0,6)); 

    }

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

touch_start(integer total_number)
    {

         //Detect which button was touched
        integer button_link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
        string button_name = llGetLinkName(button_link);
        if (button_name == "Task1") 
        {

              llRegionSay(ch1,"go"); 

         }

     }

}

Edited by Simoo0
Link to comment
Share on other sites

  • Simoo0 changed the title to Hud that use a unique channel for all vehicle riders ?
2 minutes ago, Simoo0 said:

I am working on a vehicle that has a Hud all riders can use it, the problem in my script is that I must use a specific channel cause there will be more vehicle in the same region that's why I used this 

>>> ch1 = (integer)("0xF" + llGetSubString(llGetOwner(),0,6));

but when the rider has HUD on, It will get his key and the channel will be different and the vehicle will not listen to HUD 

I got a solution for that to create another channel in the vehicle to listen in change event like this

>>> ch_fire1 = (integer)("0xF" + llGetSubString(llGetLinkKey(17),0,6));

llGetLinkKey(17) is the key of the second rider

but i think it is not the best solution for that ..any ideas on how to fix that and i appreciate your help ^^

How about you use the root key of the vehicle itself?

That way the channel is easy to figure out regardless of if the script is in the vehicle or the riders, and the channel is inherently unique to that vehicle.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 551 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...