Jump to content

Recommended Posts

Posted (edited)

Hi @ all,

 

as the titel already says,

I'm trying to figure out, how I can use the Witchcraft-Lua-Console on a dedicated Server which runs 3 different instances with one DCS account.

 

all three instances have there own ports (server-port, webgui-port, srs-port), but if I start all three servers the witchcraft lua console is working only with the last server that started.

 

witchcraft = {}
witchcraft.host = "localhost"
witchcraft.port = 3001
dofile(lfs.writedir()..[[scripts\witchcraft.lua]])

 

above shown code has do be written down in the MissionScripting.lua, but as I said, I'm running 3 instances with one Install of DCS (using the same account details).

 

Is there a way, to give each instance an own port for witchcraft? for example, if you copy above shown code into a file hosted in the Saved Games-Folder for each instance?

 

looking forward for your :helpsmilie:

 

happy flying :pilotfly:

Edited by b0rnkilla
Posted (edited)

Hi @ all 👍

 

I could solve the Problem by my own and want to share the solution with you.

 

So if you have multiple Server Instances running and you want to have access to the Witchcraft Luaconsole for each Server Instance you have to do following steps:

 

1. MissionScripting.lua

Path: C:\Program Files\Eagle Dynamics\DCS World OpenBeta Server\Scripts

Add the following code before the "function sanitizeModule" is defined:

witchcraft = {}
dofile(lfs.writedir()..[[scripts\witchcraft.lua]])
 

 

2. Witchcraft.lua

Path: C:\Users\your_name\Saved Games\your_DCS_instance\Scripts

Find the Line inside the "function witchcraft_start(mission_env_)"

witchcraft.conn:connect(witchcraft.host, witchcraft.port)
 

and add "--" in front of it, so that it looks like this:

--witchcraft.conn:connect(witchcraft.host, witchcraft.port)
 

Add a new Line and add following code:

witchcraft.conn:connect("localhost", 3001)
 

Instead of "3001" you can write down any port you want that witchcraft is listen to.

 

Then find the Line

witchcraft.log = witchcraft_log
 

and create a new line after it and add the following code:

witchcraft.start(_G)
 

It should finally looks like attached picture "Witchcraft-lua.jpg".

 

3. server.js

Path: C:\Users\your_name\Saved Games\your_DCS_instance\Scripts\dcs-witchcraft-master\src\backend

Find the Line

var port = 3000;
 

and change the port to whatever you want to open the luaconsole with.

For exampe, you changed it to 3002, so you have to open the luaconsole in your browser via: "http://localhost:3002/"

 

Scroll down in the server.js and find the Line

}).listen(3001);
 

and change the port to the same port as you have written down in the Witchcraft.lua

 

Finally it has to look like the attached picture "server-js.jpg".

 

4. witchcraft.cmd

Path: C:\Users\your_name\Saved Games\your_DCS_instance\Scripts\dcs-witchcraft-master\windows

Start the "witchcraft.cmd"

 

5. Lua Console

Open your Browser and call the Lua Console via: "http://localhost:yourport/"

 

et voilà! 😄

 

Repeat above shown steps for each of your Instance-Folders (located in your Saved Games Folder.

 

Please note, that you do not need to add "witchcraft.start(_G)" in a mission trigger anymore!

 

I have three Server Instances running with Witchcraft and have access to each Luaconsole.

For example, I've done it as follows:

Instance0:

Luaconsole Port: 3000

Port to listen to: 3001

Instance1:

Luaconsole Port: 3002

Port to listen to: 3003

Instance2:

Luaconsole Port: 3004

Port to listen to: 3005

 

Remember to start the "witchcraft.cmd" in each instance-folder for each instance!

 

Greetings and happy flying :joystick:

witchcraft-lua.thumb.jpg.a6e0139ecca8b2fea512e18563b0f1ec.jpg

server-js.thumb.jpg.58973194dd4a82fa86b3a8b12da0217b.jpg

Edited by b0rnkilla
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...