Quick Start
Getting started with Homunculus
This library is a work in progress!
It is not intended for use yet, large changes are due to happen. This library is primarily intended for chat functionality in Second Life. Other features may not work as intended or may be incomplete. Use at your own risk.
Introduction
Homunculus is a minimal set of Node.js packages that allows basic interactions with the virtual world Second Life, utilizing the official Second Life UDP protocol.
Homunculus is not affiliated with or sponsored by Linden Research, Linden Lab or Second Life.
Installation
npm init -y
npm install @gwigz/homunculus-core
npm install --save-dev @types/node
bun init -y
bun add @gwigz/homunculus-core
bun add --dev @types/node
Authentication
It's recommended that you create an .env
file in the root of your project, see the example file.
Basic Usage
This is a simple example of how to connect to Second Life and listen for nearby chat messages.
If you're planning on primarily adding chat commands or LSL/SLua bindings, consider using the @gwigz/homunculus-bot
package for a more "abstracted" experience.
import { Client, Constants } from "@gwigz/homunculus-core"
const client = new Client()
client.nearby.on("chat", (chat) => {
if (
chat.chatType === Constants.ChatTypes.NORMAL &&
chat.sourceType === Constants.ChatSources.AGENT
) {
if (chat.message.includes("ping")) {
client.nearby.message("pong")
}
console.log(chat)
}
})
// by default, we connect using the SL_USERNAME, SL_PASSWORD, and SL_START
// environment variables -- alternatively, you can just pass those values in
client.connect()
To run the script, you can use the following command:
npx dotenv-cli npx tsx index.ts
bun run index.ts
That's it!