AUX VM Node
A set of utilities required to run an AUX in Node.js.
Installation
npm install @casual-simulation/aux-vm-node
Usage
Connect to an AUX served from a remote server
import { nodeSimulationWithConfig } from '@casual-simulation/aux-vm-node';
import { AuxUser, Simulation } from '@casual-simulation/aux-vm';
start();
async function start() {
const user: AuxUser = {
id: 'myUserId',
username: 'myUsername',
name: 'myName',
token: 'mySecretToken',
isGuest: false,
};
const sim = nodeSimulationWithConfig(
user,
'hello',
{
config: {
isBuilder: false,
isPlayer: false,
version: 'v1.0.0',
versionHash: 'abc',
},
partitions: {
shared: {
type: 'remote_causal_repo';
branch: 'hello';
host: 'https://auxplayer.com';
}
}
}
);
await sim.init();
sim.connection.syncStateChanged.subscribe(synced => {
if (synced) {
console.log("We're synced!");
} else {
console.log('No longer synced.');
}
});
}
Create a bot
await sim.helper.createBot(undefined, {
auxColor: 'red',
auxScaleZ: 2,
});
Run a script
const result = await sim.helper.search('=getBots("auxColor", "red")');