← 返回
未分类 中文

VAM Scripter

Provides a JavaScript-like scripting environment inside Virt-A-Mate for automating poses, animations, audio, interactions, and scene control with lifecycle a...
在 Virt-A-Mate 中提供 JavaScript 脚本环境,用于自动化控制姿势、动画、音频、交互及场景,并支持生命周期管理。
nffdasilva nffdasilva 来源
未分类 clawhub v1.2.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 437
下载
💾 3
安装
1
版本
#automation#latest#scripter#vam

概述

VAM Scripter Skill

Virt-A-Mate Scripter v1.5.1 Language Support

Scripter is a JavaScript-inspired scripting language that runs inside Virt-A-Mate. It provides high-performance scripting without reflection, enabling automation of poses, animations, audio, and interactions.

gotolm

Scripter v1.5.1 - JavaScript-inspired VAM scripting language.

Syntax Overview

Scripter syntax closely resembles JavaScript with these characteristics:

Module System

import { module } from "vam-scripter";
export const name = value;

Variables

const name = value;  // immutable binding
let name = value;    // mutable binding
var name = value;    // mutable binding

Functions

function name(args) { body }
() => { body }       // arrow function syntax

Control Flow

if (condition) { ... } else { ... }
for (init; condition; update) { ... }
while (condition) { ... }
break; continue;

Exception Handling

try { ... } catch (e) { ... }
throw error;

Data Structures

[1, 2, 3]                        // array
{ key: value }                   // object

Core Modules

vam-scripter Module

The main module imported as "vam-scripter" exports:

ExportTypeDescription
---------------------------
scripterObjectMain plugin interface, lifecycle hooks
sceneObjectScene access (atoms, audio clips)
TimeObjectUnity Time properties
RandomObjectRandom number generation
DateTimeObjectDate/Time operations
playerObjectPlayer (VR/monitor status, hand/head transforms)
keybindingsObjectKeybinding management
InputObjectInput handling
fsObjectFile system operations

scripter Module

Provides lifecycle hooks and plugin management.

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
scripter.onUpdate(fn)fn: () => voidFunctionLinkRun every frame
scripter.onLateUpdate(fn)fn: () => voidFunctionLinkRun after Update
scripter.onFixedUpdate(fn)fn: () => voidFunctionLinkRun on physics updates
scripter.onEnable(fn)fn: () => voidFunctionLinkRun when enabled
scripter.onDisable(fn)fn: () => voidFunctionLinkRun when disabled
scripter.onDestroy(fn)fn: () => voidFunctionLinkRun when destroyed
scripter.declareFloatParam(config)config: {name, default, min, max, constrain, onChange}FloatParamDeclarationCreate float parameter
scripter.declareStringParam(config)config: {name, default, onChange}StringParamDeclarationCreate string parameter
scripter.declareBoolParam(config)config: {name, default, onChange}BoolParamDeclarationCreate boolean parameter
scripter.declareAction(name, fn)name: string, fn: () => voidActionDeclarationCreate action
scripter.containingAtom-AtomReferenceReference to the atom housing the script

scene Module

Provides access to atoms and audio clips in the scene.

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
scene.getAtom(name)name: stringAtomReferenceGet atom by name/UID
scene.getAtoms()-ArrayGet all atoms
scene.getAtomIds()-ArrayGet all atom UIDs
scene.getAudioClip(type, category, clip)`type: "Embedded\URL", category: string, clip: string`NamedAudioClipReferenceGet audio clip

player Module

Provides access to player state and transforms.

PropertyTypeDescription
-----------------------------
player.isVRbooleanTrue if in VR mode
player.lHandTransformReferenceLeft hand position/rotation
player.rHandTransformReferenceRight hand position/rotation
player.headTransformReferenceHead position/rotation

keybindings Module

Manages keybindings and commands.

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
keybindings.invokeCommand(name)name: stringvoidInvoke a keybinding action
keybindings.declareCommand(name, fn)name: string, fn: () => voidKeybindingDeclarationDeclare a new keybinding

fs Module

File system operations for script persistence.

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
fs.writeSceneFileSync(path, content)path: string, content: stringvoidWrite to scene-specific file
fs.readSceneFileSync(path)path: string`string\undefined`Read scene-specific file
fs.unlinkSceneFileSync(path)path: stringvoidDelete scene-specific file

Time Module

Unity Time properties.

PropertyTypeDescription
-----------------------------
Time.timefloatTime since level load
Time.deltaTimefloatTime since last frame
Time.fixedDeltaTimefloatFixed timestep for physics

Random Module

Random number generation.

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
Random.value-floatRandom float 0.0-1.0
Random.range(min, max)`min, max: int\float``int\float`Random number in range

Math Module

Math utilities (_available as Math_).

MethodArgumentsReturnsDescription
-----------------------------------------
Math.abs, Math.ceil, Math.floornumbernumberBasic math
Math.sin, Math.cos, Math.tannumbernumberTrigonometry
Math.sqrt, Math.pow(base, exp)numbernumberPowers/square root
Math.log, Math.log10numbernumberLogarithms
Math.max, Math.min(...args)numbersnumberMin/max
Math.random()-floatRandom 0-1
Math.lerp(start, end, t)numbersnumberLinear interpolation
Math.clamp(value, min, max)numbersnumberClamp value
Math.round, Math.signnumbernumberRounding/sign

Reference Types

AtomReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
atom.name-stringAtom name
atom.type-stringAtom type
atom.on-booleanIs atom on
atom.getStorableIds()-ArrayGet storable IDs
atom.getStorable(name)name: stringStorableReferenceGet storable
atom.getController(name)name: stringControllerReferenceGet controller
atom.distance(other)other: AtomReferencefloatDistance to another atom

TransformReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
transform.position-Vector3Position
transform.rotation-QuaternionRotation
transform.forward-Vector3Forward direction
transform.up-Vector3Up direction
transform.right-Vector3Right direction
transform.lookAt(target)target: TransformReferencevoidRotate to face target
transform.lookAt(x, y, z)coords: Vector3voidRotate to face position

StorableReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
storable.getId()-stringGet storable ID
storable.getType()-stringGet storable type
storable.getAudioAction(name)name: stringAudioActionReferenceGet audio action

ControllerReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
controller.name-stringController name
controller.transform-TransformReferenceController transform

AudioActionReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
audioAction.play(clip)clip: NamedAudioClipReferencevoidPlay audio clip
audioAction.stop()-voidStop audio

NamedAudioClipReference

Property/MethodArgumentsReturnsDescription
-------------------------------------------------
clip.name-stringClip name
clip.clip-AudioClipUnity audio clip

Common Patterns

Simple Update Loop

import { scripter, scene } from "vam-scripter";

const ball = scene.getAtom("Ball");
const person = scene.getAtom("Person");

scripter.onUpdate(() => {
    // Run every frame
});

Interaction Detection

import { scripter, scene } from "vam-scripter";

const ball = scene.getAtom("Ball");
const person = scene.getAtom("Person");
const personVoice = person.getStorable("HeadAudioSource").getAudioAction("PlayNow");
const surprisedSound = scene.getAudioClip("URL", "web", "surprised.wav");

scripter.onUpdate(() => {
    if (ball.distance(person) < 0.5) {
        personVoice.play(surprisedSound);
    }
});

Keybinding Handler

import { keybindings, scripter } from "vam-scripter";

const action = scripter.declareAction("MyAction", () => {
    // Handle action
});

keybindings.declareCommand("MyActionKey", () => {
    keybindings.invokeCommand("MyAction");
});

Parameter-Driven Animation

import { scripter, scene } from "vam-scripter";

const person = scene.getAtom("Person");
const head = person.getController("head");

const speedParam = scripter.declareFloatParam({
    name: "Animation Speed",
    default: 1.0,
    min: 0.1,
    max: 5.0,
    onChange: (value) => {
        // Parameter changed
    }
});

File Operations

import { fs, scripter } from "vam-scripter";

const state = JSON.parse(fs.readSceneFileSync("state.json") || "{}");

scripter.onUpdate(() => {
    // Use state
});

scripter.onDisable(() => {
    fs.writeSceneFileSync("state.json", JSON.stringify(state));
});

Date/Time Operations

const now = DateTime.now;
const year = now.year;
const month = now.month;
const day = now.day;

// DateTime properties: year, month, day, hour, minute, second, dayOfWeek

Development Notes

  • scripts must be loaded as index.js
  • Use import { ... } from "vam-scripter" to access modules
  • The language is case-sensitive (JavaScript-style)
  • Use // for single-line comments and / / for multi-line
  • All modules are singletons - each import gets the same reference

Files

  • SKILL.md - This documentation
  • scripts/ - Sample scripts and patterns
  • references/ - API reference details

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-03-30 21:16 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,724
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 679 📥 327,938
professional

AutoResearchClaw Integration

nffdasilva
集成AutoResearchClaw,自动基于用户研究主题生成含真实引用和实验代码的会议级学术论文。
★ 0 📥 915