Jump to content

DCS-Remote: Lua console API in Scala/Java


RvEYoda

Recommended Posts

Just wanted announce I'm working on a tool called dcs-remote.

It's a tool for modders and developers, which let's you send lua scripts/commands to your dcs game while it's running.

 

Ever tired of having to restart a mission to restart scripts?

Always wanted to be able to experiment with dcs lua in a REPL-like environment?

 

dcs-remote lets you:

  • Send any lua command to dcs
  • Get the results back of that command to your own application
  • View DCS log files as they are written live to your own IDE's console
  • Retrieve particular data to your own application from dcs
  • Hotswap game behaviour by replacing/injecting lua functions
  • Fix scripting bugs, tweak scripts and re-run without restarting the mission
  • Idea: Perhaps create your own external game master/commander tool and customize your server? :)

 

 

It's not locked to any particular lua environment, but at the moment I've only experimented in the export environment.

 

Anyone interested in helping out or trying it out is more than welcome to PM me or post in this thread. My own next step will be to use this to build some external game avionics, probably.

 

 

And here is some example use code (in Scala, but Java should hopefully work too):

 

package se.gigurra.dcsremote.exportlua.test

import scala.language.postfixOps

import org.junit.Test

import se.gigurra.dcsremote.DcsRemote
import se.gigurra.dcsremote.exportlua.ExportLua

class TestExportScript {

 @Test
 def testExportData() {

   // Connect a non-blocking akka tcp-actor (see http://akka.io/) to dcs
   implicit val client = ExportLua.connect()

   while (true) {

     if (DcsRemote.isConnected) {

       // Oldschool blocking io
       println(DcsRemote.get("return LoGetSelfData()"))

       // Or asynchronously with futures
       val request = DcsRemote.request("return dcs_remote_export_data()")
       val result = DcsRemote.await(request)
       println(result)

     }

     Thread.sleep(1000)
   }

 }

 @Test
 def testLogReading() {
   // Asynchronous log File readers/tailers area available (currently only if running locally) 
   DcsRemote.mkDcsLogReader(line => println(s"[DCS]: $line"))
   DcsRemote.mkDcsRemoteLuaLogReader(line => println(s"[DCS_REMOTE_LUA]: $line"))
   Thread.sleep(3600 * 1000)
 }

}


Edited by =RvE=Yoda

S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse'

Link to comment
Share on other sites

  • Recently Browsing   0 members

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