HUD-to-Object Commands โ
Texture, color and position actions reach a target directly. But a target cannot play a sound, animate itself (animesh) or run a timer on request from the outside. For that, the target gets its own project and the HUD sends it commands.
We will build a HUD that makes an animesh dog sit, stand and bark.
You need: the dog (animesh, with animations dog_sit, dog_stand and a bark sound inside), and a HUD with three prims named sit, stand, bark.
Part A: the dog's project โ
Rez the dog. Drop in:
*TARGETS(choose NEW),*BUILD,*FUNCTIONS,[add-on] - Events - 1Click.Open the dog's panel link from chat. Assets โ Search for assets to load its animations and sound.
Register three Receive Command events:
sit,stand,bark.Actions:
sitโ Object Animation Stop all and startdog_sitstandโ Object Animation Stop all and startdog_standbarkโ Sound Playbark, volume 80
Build. (Keep this tab open; you will Finish it later.)
Part B: the HUD's project โ
Rez the HUD with
*BUILDand*FUNCTIONS. Open its panel.Re-scan buttons; Targets โ Search for targets (the dog is listed).
Create the three button functions, each with one Send Command: Target = the dog, Command =
sit/stand/bark.Build. Click the buttons: the dog obeys.
Finish both โ
Press Finish! in each project. Both objects keep their *FUNCTIONS; the dog keeps its animations in Content (Finish never deletes animations), and the sound keeps working by UUID even though the sound file itself is removed.
Diagram โ
HUD (project A) Dog (project B)
btn "bark" โ Send Command "bark" โโโโบ Receive Command "bark" โ Sound "bark"Tips โ
- Commands are just names. For values (speeds, colors), use several commands or combine with variables on the receiving side.
- The dog also works on its own: give it buttons or an Attach/Rez event.
- Several HUDs can command the same object, and one HUD can command many objects (one Send Command action per object).
- Both objects must belong to the same owner and be in the same region.