Simoo0 Posted October 22, 2022 Share Posted October 22, 2022 (edited) 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 October 22, 2022 by Simoo0 Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted October 22, 2022 Share Posted October 22, 2022 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. 2 Link to comment Share on other sites More sharing options...
Simoo0 Posted October 22, 2022 Author Share Posted October 22, 2022 that's great ! but how the HUD will know the key of the vehicle ? Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted October 22, 2022 Share Posted October 22, 2022 Just now, Simoo0 said: that's great ! but how the HUD will know the key of the vehicle ? A sitting avatar becomes part of the linkset, so a HUD could do llGetObjectDetails(llGetOwner(), [OBJECT_ROOT]) to get the key of the vehicle. 1 1 Link to comment Share on other sites More sharing options...
Simoo0 Posted October 22, 2022 Author Share Posted October 22, 2022 Thanks @Wulfie Reanimator, That Fixed my problem!! You are brilliant ^^ 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