Skip to content

Starscript

Evan Husted edited this page Jan 23, 2023 · 5 revisions

Starscript is the formatting language currently used in various aspects of Meteor. Full syntax information can be found here.


Variables & functions

A list of standard library functions/variables can be found here.

The following categories (until Objects) have up to 2 sections: Variables and Functions.

  • Variables are accessed just by name, after a dot accessor if the variable is on an object (just player is also valid). For example, player.health: player is the object, in this case your player, the dot accesses that object and allows you to use values on that object. In this case, health is the value on the object we're accessing.
  • Functions cannot be accessed and only called. You call a function by using (), with variables/values inside of the parenthesis if the function has arguments (all Starscript functions do, this isn't the case for regular programming though). For example, player.getItem(slot): Again, here player is the object, and is being accessed by the dot. You then follow it up with the name of the function and the parenthesis with the comma-separated (if multiple) values of arguments to give the function. In the example given, player.getItem(slot), the argument is slot, which is the inventory slot number you want to get the item of. An example call to getItem is player.getItem(0) which retrieves the item in the very first slot in your hotbar.

General

Variables

  • kotlin - Currently loaded version of Kotlin.

  • gameVersion - Current Minecraft version.

  • fps - Current FPS.

  • ping - Your ping.

  • time - A formatted version of your system's current time.

Meteor

Functions

  • meteor.isModuleActive(id) - Returns value of true when the module with the specified ID is active.

    • id should be of type String.
  • meteor.getModuleInfo(id) - Returns an informational string about the module.

    • id should be of type String.

Variables

  • meteor.version - Current version & revision of this fork of Meteor.

  • meteor.modules - Number of currently loaded modules.

  • meteor.activeModules - Number of currently active modules.

Baritone

Variables

  • baritone.isPathing: Whether or not Baritone is actively controlling your Minecraft player.

  • baritone.distanceToGoal: Approximate distance to the current Baritone pathing goal.

  • baritone.process: Current Baritone process. Relatively long result typically.

  • baritone.processName: Current Baritone process name, such as "Mine."

Camera

Variables

  • camera.pos.{x, y, z}: Camera's X/Y/Z coordinate, respectively.

    • Proper usage example: camera.pos.x.
  • camera.posOpposite.{x, y, z}: Camera's X/Y/Z coordinate, respectively, in the opposite dimension.

    • Proper usage example is similar to above.
  • camera.yaw: Camera's yaw (horizontal) rotation.

  • camera.pitch: Camera's pitch (vertical) rotation.

  • camera.direction: Camera's cardinal or ordinal direction.

Fabric Loader

Variables

  • mods - The amount of mods currently loaded by Fabric.

  • mods.list - A comma-separated list of mods currently loaded by Fabric.

  • mods.*

    • This one is different.
      • When typing the dot accessor in Meteor, you'll see a lot of autocompletions. Simply type the mod ID (usually a shorter version of the mod name) you want until you see it in the suggestions list (easiest way to verify it's the actual name). You now have the Mod object associated with the mod of that ID.

Player

Functions

  • player.hasPotionEffect(id): Checks whether you have the specified potion effect.

  • player.getPotionEffect(id): Returns the effect with the given ID if the player has it, null otherwise. See Potion Effect.

  • player.getStat(id), player.getStat(id, type): Returns the specified statistic for yourself.

    • Supported Stat IDs
      • mined
      • crafted
      • used
      • broken
      • picked_up
      • killed
      • killed_by
      • custom (default)

Variables

  • player: Your username.

  • player.health: Your health.

  • player.hunger: Your hunger.

  • player.speed: Your speed in blocks/second.

  • player.breakingProgress: Your progress in breaking the block you're currently mining.

  • player.biome: The biome you're currently in.

  • player.dimension: The dimension you're currently in.

  • player.dimensionOpposite: The opposite dimension to the one you're currently in.

  • player.pos: Your position in the world, formatted as X: _ Y: _ Z: _.

  • player.pos.{x, y, z}: The specific X/Y/Z coordinate you're located in.

    • Proper usage example: player.pos.z.
  • player.posOpposite.{x, y, z}: The specific X/Y/Z coordinate of the opposite dimension to the one you're currently in.

    • Proper usage example is similar to the above.
  • player.yaw: Your player's yaw (horizontal) rotation.

  • player.pitch: Your player's pitch (vertical) rotation.

  • player.direction: Your player's cardinal or ordinal direction.

  • player.hand: The item stack currently in your main hand. See Item.

  • player.offhand: The item stack currently in your offhand. See Item.

  • player.handOrOffhand: Your main item stack. See Item.

  • player.xp.{level, progress, total}: Your various XP values. level is your current level, progress is your percentage of XP bar towards the next level, and total is the total number of experience points you have.

    • Proper usage example: player.xp.progress

Crosshair Target

Variables

  • crosshairTarget.type - One of [miss, block, entity] string.

  • crosshairTarget.value - Either an empty String, a Block, or an Entity.

Server

Variables

  • server - Current server's name in your Server list.

  • server.ip - Current server's IP address.

  • server.tps - Current server's ticks/second.

  • server.time - Current server's time in 24h format.

  • server.playerCount - Current server's online player count.

  • server.difficulty - Current server world's difficulty.




Objects

Various variables and functions can return more complex objects on which other objects or values can be accessed on via the dot accessor.

On the items listed below, _toString is not to be called or accessed. It is simply the result that is achieved from using the object itself as a value rather than accessing a field or function on it.

ItemStack

  • _toString - Item name formatted as <name> x<count> (like Sculk x13), or just <name> if there's only one item.

  • name - The name of the item type.

  • count - Number of items in the stack.

  • isTool - Whether or not this ItemStack contains a tool item.

    • Useful in tandem with durability/durabilityMax to determine if there's a meaningful value with those.
  • durability - Current durability of the tool in this stack; or 0 if there is no tool.

  • durabilityMax - The maximum durability of the tool in this stack; or 0 if there is no tool.

Block

  • _toString - Block name

  • pos - Block position in the world, formatted as X: _ Y: _ Z: _.

  • pos.{x, y, z}: The specific X/Y/Z coordinate the block is at.

    • Proper usage example: pos.z.

Entity

  • _toString - Entity name

  • health - Entity health, or 0 if the entity doesn't have health.

  • pos - Entity position in the world, formatted as X: _ Y: _ Z: _.

  • pos.{x, y, z}: The specific X/Y/Z coordinate the entity is at.

    • Proper usage example is identical to the example provided in Block.

Potion Effect

  • _toString - Potion effect type name

  • duration - Effect duration, in game ticks.

  • level - Effect level

Mod

  • _toString - Mod name

  • authors - Comma separated list of authors of the mod.

  • version - Mod version

  • description - Description of the mod from its fabric.mod.json.

  • getValue(id) - Get a custom value of with the specified ID from the mod's fabric.mod.json.