Code Monkey home page Code Monkey logo

node-metaverse's Introduction

node-metaverse

A node.js interface for Second Life.

npm version Build Status Known Vulnerabilities

Install

npm install --save @caspertech/node-metaverse

Usage

Javascript

const nmv = require('@caspertech/node-metaverse');

const loginParameters     = new nmv.LoginParameters();
loginParameters.firstName = 'firstName';
loginParameters.lastName  = 'lastName';
loginParameters.password  = 'password';
loginParameters.start     = "last";

const options = nmv.BotOptionFlags.LiteObjectStore | nmv.BotOptionFlags.StoreMyAttachmentsOnly;
const bot     = new nmv.Bot(loginParameters, options);

bot.login().then((response) =>
{
    console.log("Login complete");

    //Establish circuit with region
    return bot.connectToSim();
}).then(() =>
{
    console.log("Connected");
}).catch((error) =>
{
    console.error(error);
});

Typescript

import { Bot, BotOptionFlags, LoginParameters } from '@caspertech/node-metaverse';

const loginParameters = new LoginParameters();
loginParameters.firstName = 'firstName';
loginParameters.lastName = 'lastName';
loginParameters.password = 'password';
loginParameters.start = 'last';

const options = BotOptionFlags.LiteObjectStore | BotOptionFlags.StoreMyAttachmentsOnly;
const bot = new Bot(loginParameters, options);

bot.login().then((response) =>
{
    console.log("Login complete");

    //Establish circuit with region
    return bot.connectToSim();
}).then(() =>
{
    console.log("Connected");
}).catch((error) =>
{
    console.error(error);
});

License

MIT

node-metaverse's People

Contributors

callcolor avatar daxdupont avatar dependabot[bot] avatar gwigz avatar hintswen avatar snyk-bot avatar tina-king avatar tommettam avatar wolfgangvc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-metaverse's Issues

Request: ParcelPropertiesRequest

Would be good to add ParcelPropertiesRequest so parcel data can be obtained by the position in cases where the parcelID has changed.

setGeometry does not rotate avatar

I am trying to rotate my but with avatar.setGeometry but what ever I set as rotation there is no movement at all.

another question I have, is there any event that fires when really all of the bot is initiaized? when agent for example can no longer return undefinded and all is save to use ?

Random Generation of MAC Address causes SL to Spam Email Notifications in some cases

Linden Lab has added in a email notification, whenever you login to SL from what it believes to be a new machine, it bases this seemingly off the MAC Address reported by the client. ( See here)

As Node-metaverse randomly generates one each time it starts, it can cause a lot of email spam notifications.

A Couple Potential Solutions are as follows, I could probably implement it in a pull request if anyone else thinks it's worth doing.

  1. Have it pull the MAC Address of the first network interface from the OS Module and use that.
  2. Have a login parameter that you can specify either a specific network interface you wish to use, defaulting to a random one if not defined in Parameters.

Unable to install with npm

There seems to be an issue installing node-metaverse with npm.

$ npm install --save @caspertech/node-metaverse
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/CasperTech/node-tar.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-12-17T04_04_37_447Z-debug.log

Add onMove event

It would be great if we could subscribe to a notification which is fired when the bot moves at least 1 meter in any direction.

Currently there is no way to get the bots position within a region, the event should give the following:

        "currentLocation": {
            "regionName": "Passendale",
            "x": 128,
            "y": 17,
            "z": 2074
        }

Texture Upload not implemented

When attempting to call Asset.UploadInventoryItem with the type ASSET_TETURE, the following error is logged:
Currently unsupported CreateInventoryType: texture

I need this functionality and would like to help implement it and contribute to this project. However, I need somewhere to start. Is there any documentation regarding the underlying Linden Labs API that I can reference, or any other source of information?

Documentation?

Is there any documentation written anywhere for this library other than the examples and readme?

Also, where on the SL wiki are the messages that you get event specifications from? I would like to help with that.

Group Functions: (un)Muting

A use case for muting would be good for enforcing a rate limit in a group for individual speakers.

Pretty low priority though.

[Feature] Add Event RegionRestart

I'd like the ability to receive a region restart event, so a client software package could implement restart evasion to prevent being logged out.

I'm sure the SL Library has some form of this otherwise the viewer couldn't know of the restart.

Payment-related features

Hello! First and foremost, I have to say that I love your project! That being said, I'd like to propose some interesting features that would make the project more complete:

  • Send a payment to an specific UUID with a new bot.clientCommands.grid.sendPayment method.
  • Subscribe to incoming payments with a new bot.clientEvents.onPaymentReceived.subscribe method.
  • Check your balance using a new bot.clientCommands.grid.checkBalance method.
  • Add the field joinPrice to GroupInviteEvent that indicates the amount of cash required to join the group.

Ideally the sendPayment method would be promise-based to check if the payment was sent properly, or perhaps a new method bot.clientEvents.onPaymentCompleted method to check for that would be better?

Thanks for your work!

Request: Receiving Group Notices

Could you add the ability to check past group notices as well as an event for new notices, this would allow a bot to delay a notice if one has been posted recently.

Scraping profiles

Being able to pull all data from profiles would be handy.

From SL/RL, visible groups to picks.

Use case would be grabbing information used for contests and checking public groups could help identify potential bad actors as part of a sort of 'spam rating'-esque system.

unhandledRejection timeout @ Circuit.ts:191:28

You have triggered an unhandledRejection, you may have forgotten to catch a Prom
ise rejection:
Error: Timeout
    at Timeout.timeoutFunc [as _onTimeout] (/home/nodejs/friendComputer/node_mod
ules/@caspertech/node-metaverse/lib/classes/Circuit.ts:191:28)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)

Add bot.clientCommands.group.updateGroupProfile()

It would be great if we could update group profile settings. Such as "Show in my profile", "Show in search", "Anyone can join", "Cost to join", "Charter", "Land Contribution"

It would also be good if later could be added ability to manage group roles.

Thanks

Group session not restarting after a timeout

My bot was in a group which had nothing posted for over 24 hours, I then sent a message to the group and the bot did not see it or even rejoin the group chat. It stayed in all other group sessions and they all had multiple messages posted during this time.

Ability to get a list of all avatars in region

It would be great to get a list of all avatars in a region.

Would also be good to add an event for a new avatar entering a region.

The output should be simply be an object containing each avatars data as followed:

{
        "agentID": "c1c32889-0b09-4bce-8219-95f38e605198",
        "firstName": "somefirstname",
        "lastName": "somelastname",
        "position": {
            "x": 68,
            "y": 17,
            "z": 43
        }
}

Get Region Stats

Ability to get all the regions stats such as:
ActiveScripts
Agents
AgentTime
AgentUpdates
ChildAgents
ConnectTime
Dilation
FPS
FrameTime
ImageTime
IncomingBPS
INPPS
LastLag
LastPingID
LastPingSent
LSLIPS
MissedPings
NetTime
Objects
OtherTime
OutgoingBPS
OUTPPS
PendingDownloads
PendingLocalUploads
PendingUploads
PhysicsFPS
PhysicsTime
ReceivedPongs
ReceivedResends
RecvBytes
RecvPackets
ResentPackets
ResidentSize
ScriptedObjects
ScriptTime
SentBytes
SentPackets
SentPings
UnackedBytes
VirtualSize

Error : Don't Know What Causes it

So I got node-metaverse configured for Opensim Grid "Neverworld Grid".

image

I'm Fairly Good with Node.js but I don't know what Causes this error

Documentation

I seen someone open an issue for this and then closed it with no replies.
Installation, went fine, just had to install git & node since it was a new server. created app.js & copied the Usage: Javascript replaced the firstname, lastname and password with correct information & bot logs in when I run node app.js.

So, I now have a bot logged in and that's where I'm at.

Any direction on how to actually use the bot/avatar?
How do send commands to the bot?
Is there a list of current commands?
How do you receive or intercept anything from the bot?
(IM's, Nearby, Group, Inventory offers, Dialogs, TP Lures, etc)

Inventory Commands fail to load folders unless cache explicitly ignored

The Inventory Cache does not cache folders, at all

Currently the saveCache method saves;

        const json = {
            version: this.version,
            items: this.items
        };

While inversely, the loadCache method only looks at this.items

However, folders are under this.folders and when loading the inventory via

const inv = bot.clientCommands.inventory.getInventoryRoot();
inv = inv.populate();

You end up with a inv.folders of [] instead of the array of folders you'd expect, so you're basically forced to not use the cache at all if you want your inventory to be usable in any way

Unit tests

This project is in dire need of some unit tests. Hugs and cookies to anyone who can help!

Question about replacing currently worn outfit

detachfromavatar and attachtoavatar do not seem to work unless i am completely missing something. which to be fair i most probably am.

the bot has all its worn items in the same folder. i would like to simply remove the items currently worn and replace them with a new item in the same folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.