A InSim library for online racing simulator Live For Speed written in javascript runtime Node.js.
This library allows you to connect to the game server and share packets trought TCP stream.
The library requires Node.js runtime
(you can download and install by following official website).
Clone this library from github here and extract it in selected directory.
Run following command inside directory to install required dependencies:
npm install
InSim.Server
InSim.Events
InSim.Packets
InSim.Commands
InSim.Players
InSim.Vehicles
InSim.Buttons
InSim.Objects
InSim.Mods
This is simple example how to start your first program.
Create a file named index.js and copy this code there and save it:
// import InSim library
const InSim = require('./module/insim');
// init InSim connection
InSim.Server.start({
host: { // host name used only in module
ip: '127.0.0.1', // your host ip
port: 53330, // your host port
admin: 'admin password', // your host admin password
prefix: '!', // command prefix like (-> !command)
pps: 12 // vehicle info update per second (max: 12)
}
}, (hostName) => { // host name defined above
InSim.Server.message(hostName, '^2InSim: Node.js connected.');
});
Run command node index.js
. You will see this in terminal:
PS C:\Users\Admin\Documents\GitHub\jsinsim> node index.js
[host] Connecting to ip:port
[host] Connected.
If you get connection errors, check your host ip, port and admin password, make sure your public ip is whitelisted in host panel