Welcome, XR pioneers and future world builders! Have you ever wondered how you can design your interactive experiences? Your galaxy features a powerful and easily accessible scripting language: MiniScript.
Your galaxy, built on Unity and running seamlessly in web browsers and on VR devices, offers you the ability to bring your 3D objects to life with MiniScript. Forget complex programming environments – with MiniScript, you design interactions directly in the editor, intuitively and efficiently.
What makes MiniScript so special, and how can you use it to realize your visions in your galaxy? Let’s dive in!
The Essence of MiniScript: Clean Syntax, Maximum Metaverse
MiniScript (by Joe Strout) is a high-level, object-oriented scripting language known for its clarity and simplicity. Here are the most important syntax features:
- No Semicolon Requirement: Each statement typically stands on its own line, without a trailing semicolon. For more compact code lines, however, you can separate statements with a semicolon.
- Clear Code Blocks: Instead of curly braces (
{}
), as known from many other languages, MiniScript uses keywords likeif
,for
,while
, andfunction
to start code blocks, each concluded with a matchingend
statement (end if
,end for
,end while
,end function
). - Readability Through Indentation: Although not strictly required, indenting code blocks enhances the readability and structure of your script.
- Simple Comments: Start a line or add comments after a statement with two slashes (
//
). - No Unnecessary Parentheses: For function calls without arguments or around conditions in
if
– orwhile
-statements, parentheses are not required and should be omitted. - Local Variables by Default: Variables are local by default, which reduces error susceptibility. MiniScript is case-sensitive, so pay attention to capitalization!
- Dynamic Typing: You can assign any data type to any variable – be it a number, a string, a list, or a map.
Interaction in the Metaverse: The Custom Commands
Our platform extends MiniScript with specific “Custom Commands” that give you control over your 3D world. Here are some of the most powerful tools:
1. Object Manipulation
Change the position, rotation, and size of your objects in real-time:
moveObject "ObjectName", fX, fY, fZ
rotateObject "ObjectName", fX, fY, fZ
scaleObject "ObjectName", fX, fY, fZ
- You control light effects with
setLightObject
. - Play animations on your models with
aniObject
.
2. Interaction & User Interface
Design interactive elements and provide feedback:
openURL "URL"
: Opens external links.messageBox "Title", "Message"
: Displays informative pop-ups.examineObject
andexamineObjectWithButton
: Enable detailed object inspections, optionally with a button linking to a URL.
3. Audio & Video Playback
Immerse your users in captivating sound and visual experiences:
playSound "SoundNumber", "oneshot/loop", "2D/3D"
: For built-in sounds.playAudio "ObjectName", "MP3_URL", "loop/false", fVolume
: For custom MP3 files.playAmbientAudio
: For spatial background sounds.playVideo "ObjectName", "MP4_URL", "loop/false", fVolume
: For video playback on objects.
4. Navigation
Guide users through your worlds:
localJump "ObjectName"
: Jumps the player to a specific object within the current plot.plotJump
: Allows jumps to other plots or galaxies.
5. NPCs & Avatars
Bring your world to life with intelligent characters:
customAvatarAnim "AnimationNameOrID", "PlayMode"
: Control avatar animations. A wide range of integrated animations is available (e.g., “Cheer Jump”, “Hello Hand Wave”, “Yoga Poses”).makeNPC
: Create non-player characters with customizable messages and behaviors.
6. Network Commands
Experiences for everyone:
networkCommand "ObjectName", "Command", "Data"
: Send commands visible to all connected clients, e.g., to move, scale, rotate objects, or change textures. This is crucial for multi-user interactions.
7. Code Execution
runObjectCode "ObjectName"
: Execute MiniScript code attached to other objects.
Tips for the Editor
- Object Names: Objects are always referenced by their exact name (as a string), e.g.,
"MyCube"
. - Randomness: Use the
rnd
function to generate random numbers and create dynamic, unpredictable experiences. - Time Control:
time
indicates the script’s runtime, whilewait
pauses execution for a specified duration. - Limitations: Please note that the
new
,create
, andinput
functions are (currently) not available. Also, theprint
command is not used, as output occurs viamessageBox
.
Play Forward
MiniScript is your key to filling your galaxy with life. Its simple yet powerful syntax, combined with our specific Custom Commands, offers you unlimited possibilities to create interactive and immersive worlds. Experiment, learn, and unleash your creativity, or check out some examples.