Skip to content

Global Functions & Statements

Omar Mohamed edited this page Mar 11, 2026 · 7 revisions

Global Functions & Statements

These are available globally in every script without needing a type instance.


Functions

importScript(packId, script)

Imports a reusable Vyn script library from a resource pack. Use this to share common logic across multiple scripts.

  • Parameters:
    • packIdString — The resource pack ID that contains the script
    • scriptString — The name of the script to import
importScript("mypack", "math_utils")
importScript("mypack", "animation_lib")

excludeScript(packId, script)

Disables an active script, preventing it from running.

  • Parameters:
    • packIdString — The resource pack ID that owns the script
    • scriptString — The name of the script to disable
~ Disable a script conditionally
check modLoader.isModLoaded("somemod") do
    excludeScript("mypack", "compat_script")
end

debugText(text)

Displays a debug string on screen. Only works when Resource Pack Debug Mode is enabled in the mod config (see InteractiveStuffConfig).

  • Parameters:
    • textString — The text to display
debugText("Player health: " + player.getHealth())
debugText("Biome: " + player.getWorld().getBiomeAt(player.getPosition()))
debugText("Velocity Y: " + player.getVelocityY())

getDelta()

Returns the normalized frame delta time. Use this to make animations and transitions framerate-independent — the result scales consistently at any FPS.

  • Returns: Double
~ Rotate item at a consistent speed regardless of FPS
make item player.getMainHandItem()
item.rotateY(90 * getDelta())

~ Smooth translation using delta
make speed 0.05
item.translateY(speed * getDelta())

Statements

wait <ticks> do ... end

Executes a block of code after a delay of the given number of ticks (20 ticks = 1 second). The rest of the script continues running immediately — the wait block runs in the background.

  • Parameters:
    • ticksInteger — Number of ticks to wait before executing the body
~ Play a sound, then play another sound 1 second later
player.playSound("minecraft:entity.experience_orb.pickup", 1.0, 1.0)

wait 20 do
    player.playSound("minecraft:block.note_block.bell", 1.0, 1.2)
end
~ Delayed debug message
debugText("Starting sequence...")

wait 40 do
    debugText("2 seconds have passed!")
end
~ Chained waits
wait 10 do
    debugText("0.5 seconds")
    wait 10 do
        debugText("1 second")
        wait 20 do
            debugText("2 seconds")
        end
    end
end

📖 InteractiveStuff Docs


🧱 Types


⚙️ Scripting

📃 Built-in Library

Clone this wiki locally