Some Introductory Scripting Examples


Hi everyone!

I’ve started putting together some “Scripting 101” examples designed to get folks more comfortable with the options available for building things in HiFi.

This project on Glitch is a work in progress, and if you have specific requests for example scripts to include, please feel free to let me know. These are specifically meant to be a first step into scripting with HiFi, as opposed to more complex projects, but as we figure out what resources will help out the most, this is one approach that I wanted to socialize with all of you in the community.


Hi I’d really like a door script , either one that opens a mesh door as I approach or opens when I click it
I’m totally clueless as a scripter
That said I put some music in your radio
Dumb question could it play from YouTube links just audio ?


Thanks for doing this, @MissLiviRose , even if it probably won’t enlighten me. :slight_smile:


I second that! A door script would be very useful to have for everyone.


Great idea MissLiviRose and much needed.
The docs page while a model of clarity only describes methods for creating and modifying ‘box’ entities (incl spheres and other platonic solids)
The page has not been updated for months and a tutorial is much needed which explains how to modify the properties of an imported mesh ‘model’ I would request a script which uses a loop to rock - back and forth an imported model (think rocking horse) on one of ts axis using ‘angular velocity’ & ‘damping’ properties


Hi Livi!
Thank you so much for creating these!
If I may request something, could I request a tablet script that changes the texture on a wearable?


Thanks for the responses everyone! I’ll start looking at making examples for what you’ve got here and getting them posted. No guarantees, but I’ll keep you all posted!

As a start, here’s a JSON for a door prototype. Doors can be a little weird to make highly customizable, but I tried to give this one a good base.

Here’s the JSON to import it into a domain. I also put one in Maker if you want to go take a look.

I’ll spend some time commenting the code and updating the readme. If there’s interest after you give this one a go, I can put it on the marketplace so it’s more accessible. You can customize the speed, interval, and time the door stays open through the userdata on the door. Changing the parenting and door pivot will probably make it act weird, just a heads up. Not at all a problem for experimenting, but just so you’re aware of what those changes will do!

The source is up on Glitch in the Scripting 101 project link above under the ‘Door’ directory.


As far as YouTube audio on the radio goes, let me look into that! I know there are ways to make bots play music from YouTube links so I’ll see if that’s an option for music playback.


awesome thanks Livi


Hey @Vinny.Mold! Here’s a WIP of a texture swapping utility entity client script… not quite at the stage where it will work on any given wearable just yet, but I wanted to share the link as I work on this in case there’s enough in there to work with in the meantime!


Thanks! I’ll check it out and give feedback when I get a chance :slight_smile: