Jump to content

DCS-SimpleRadio Standalone


Ciribob

Recommended Posts

Audio output error. Problem initialising audio output

 

I got this message when I try "preview audio" or to connect to a server:

 

Audio output error. Problem initialising audio output

 

After that the SR-ClientRadio.exe shuts down.

 

Error log:

 

21:18:50 Ciribob.DCS.SimpleRadio.Standalone.Client.Audio.AudioPreview Error starting audio Output - Quitting! Retrieving the COM class factory for component with CLSID {F447B69E-1884-4A7E-8055-346F74D6EDB3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

 

Is there any way to fix this? Or a workaround?

 

Thx

Link to comment
Share on other sites

I got this message when I try "preview audio" or to connect to a server:

 

Audio output error. Problem initialising audio output

 

After that the SR-ClientRadio.exe shuts down.

 

Error log:

 

21:18:50 Ciribob.DCS.SimpleRadio.Standalone.Client.Audio.AudioPreview Error starting audio Output - Quitting! Retrieving the COM class factory for component with CLSID {F447B69E-1884-4A7E-8055-346F74D6EDB3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

 

Is there any way to fix this? Or a workaround?

 

Thx

Are you on a windows N version? If so it doesn't include some media codecs so they need to be installed.

 

Either way install the two updates below.

 

Should solve it for you :)

 

 

.NET Version - PLEASE INSTALL THIS or it may not work: https://www.microsoft.com/en-gb/download/details.aspx?id=53345

 

Windows 7/8/10 N Users - PLEASE INSTALL THIS OR IT WILL NOT WORK - Adds the media codecs you need which are removed in the N Version - https://www.microsoft.com/en-gb/download/details.aspx?id=48231

 

 

 

 

Sent from my SM-G900F using Tapatalk

  • Like 1

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

The controls will appear if the radio supports controls from the radio or not.

 

If you're seeing no radio, are you connected to a server and in a mission, either spectator or in an aircraft?

 

If yes, upgrade your tacview (it'll break SRS) and if you're still having trouble:

 

  • Post Export.lua
  • Post a screenshot of your DCS Scripts folder

 

And i'll help you solve it :)

 

 

 

It should connect automatically when the server is first joined but for an ATIS channel, i'd just connect to the server once and leave it? Shouldn't really matter what the server is doing as long as the player that the radios attached to is in at least spectators.

 

Good to know about setting VAC to 48KHz!

 

 

 

Check the first post of this entire thread. Its already fully supported :)

 

As in encryption on the Mirage, Gazelle and FC3 aircraft

 

Or checkout this review which also demos it in a great pit!

 

Now is working, the problem was that the script line was not the last one in Export.lua!

 

Thanks!!

Link to comment
Share on other sites

Hey Ciribob!

 

Couple of patches ago we stopped getting that beep beep beep sound when you turn on encrypted radio and silence it with PTT. Any idea what happened there?

 

Ah thats not actually been added yet to SRS, I do have the files, and its on the list but unfortunately i've not programmed in weeks :(

 

so i can connect to server fine and it sows as connected but unfortunately even if my radios are on it shows as all unknown.

 

You've got the CDU Export file

 

You need to remove

 

os.setlocale("ISO-8559-1", "numeric")

 

From the top and then it'll work fine. You'll find that the CDU export isn't working either

 

Hope that helps! :)

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Hi there. I hope I'm posting this in the right thread to find help. 3 hours of searching the forums hasn't yielded any solutions for me yet.

 

I've installed SimpleRadio Standalone and put all the files in the folders as instructed. I've also added it to the export.lua script. I've created firewall exceptions for the SR client, and also created firewall rules for port 5002 on UDP and TCP, so I think I've covered just about everything

 

A fellow pilot tried to help me get it all set up yesterday, but we ran into a snag. The client managed to connect ok, and at the time showed that there were 2 of connected to the server, BUT when I brought up the GUI overlay in DCS no radios were showing and I couldn't tune anything, speak or hear anything. It appear that for some reason SR isn't hooking into my DCS properly. I was in a fully powered A-10C with all 3 radios powered. I've included some images below...

 

In-cockpit showing radios and overlay

2n72o0z.jpg

 

SimpleRadio Client

9fxson.jpg

 

DCS game settings showing comms setup

2d9y0qe.jpg

 

DCS version is 1.5.5.58891, running under Windows 10 Home x64. We couldn't manage to work out what's wrong, so hopefully someone here will have some advice for me. Thanks in advance.

Link to comment
Share on other sites

Are you running the client.exe from the installed folder, default should be c:/program files/simpleradiostandalone if I remember right. Seems like a dumb question but this happened to a squadron mate. He was running the client.exe from the unzipped install folder, not the one from the "installed" folder. Other than that it's for sure an error in the export.lua then since you are connecting fine to the server but not the game....

VFA-25 Fist of the Fleet

[sIGPIC][/sIGPIC]

Virtual Carrier Strike Group One | Discord

Link to comment
Share on other sites

Are you running the client.exe from the installed folder, default should be c:/program files/simpleradiostandalone if I remember right. Seems like a dumb question but this happened to a squadron mate. He was running the client.exe from the unzipped install folder, not the one from the "installed" folder. Other than that it's for sure an error in the export.lua then since you are connecting fine to the server but not the game....

 

Affirmative. I'm executing the client from C:\Program Files\DCS-SimpleRadio-Standalone

 

One thing you can try is to get an Export.lua sent to you by someone for whom it works. It solved a few problems on our server for clients who'd tried everything else and failed.

 

That, I have to say, is a stunning idea! It should rule out any simple config errors. I'll try and grab one from someone in the squadron and report back. In the meantime, this is what my export.lua looks like:

 

local Tacviewlfs=require('lfs');dofile(Tacviewlfs.writedir()..'Scripts/TacviewExportDCS.lua')
local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[scripts\DCS-SimpleRadioStandalone.lua]])


Edited by frostycab
Link to comment
Share on other sites

Affirmative. I'm executing the client from C:\Program Files\DCS-SimpleRadio-Standalone

 

 

 

That, I have to say, is a stunning idea! It should rule out any simple config errors. I'll try and grab one from someone in the squadron and report back.

 

If you delete your export.lua and then run the srs installer it'll create a new export.lua with just the line you need :)

 

Sorry on mobile, so short!

 

 

Sent from my SM-G900F using Tapatalk

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Just tried that, but no joy. New export.lua file looks ok, so it has to be something more "under-the-hood."

 

did you try running it as administrator? that is what fixed it for me, right click on .exe > run as admin.

Intel i9-9900K 32GB DDR4, RTX 2080tiftw3, Windows 10, 1tb 970 M2, TM Warthog, 4k 144hz HDR g-sync.

Link to comment
Share on other sites

Dedicated Support on Discord: https://discord.gg/baw7g3t

 

Please follow the list below (even if you've done it before!) so that everyone's hopefully got the same setup and should hopefully solve a lot of issues :)

 

1. Install the latest .NET https://www.microsoft.com/en-gb/download/details.aspx?id=53345 - Even if you think you have it!

 

1.a If you're on Windows N edition (No media components installed) then install this - https://support.microsoft.com/en-us/help/3145500/media-feature-pack-list-for-windows-n-editions (Likely just specific European versions)

 

2. Backup and then DELETE the Scripts folder in

 

C:/Users//Saved Games/DCS/

C:/Users//Saved Games/DCS.openbeta/

C:/Users//Saved Games/DCS.openalpha/

 

3. Download the latest release ZIP from here: https://github.com/ciribob/DCS-SimpleRadioStandalone/releases/latest

 

4. EXTRACT the contents of the zip file to a folder

 

5. Run the installer as ADMINISTRATOR in the EXTRACTED folder

 

6. Verify that the Scripts folders in:

 

C:/Users//Saved Games/DCS/

C:/Users//Saved Games/DCS.openbeta/

C:/Users//Saved Games/DCS.openalpha/

 

Has just these 5 files:

 

DCS-SRSGameGUI.lua

DCS-SimpleRadioStandalone.lua

DCS-SRS-OverlayGameGUI.lua

DCS-SRS-Overlay.dlg

Export.lua

 

AND

 

that the Export.lua has just this one line:

 

local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[scripts\DCS-SimpleRadioStandalone.lua]])

 

You can copy the files manually from the zip if they're missing.

 

7. Go to where SimpleRadio Standalone (SRS) Installed to: i.e C:\Program Files\DCS-SimpleRadioStandalone

 

8. Run the Client.exe as ADMINISTRATOR

 

9. Enter this address 5.189.162.17:5014 and hit connect. Say YES to any Firewall prompts!

 

10. Launch DCS, start a single player mission with a hot start aircraft

 

11. Open overlay, as long as the aircraft is hot start you should now see a frequency on the overlay

 

12. Whoop and shout, you have radio comms :)

 

IT STILL DOESNT WORK

 

Double check you've done all the steps in order above!

 

Remember that you wont get a frequency on the overlay until you're in an aircraft (spectators on multiplayer will also work) and connected to a server.

 

If you have an older CDU export or Tacview export it won't work either, but by following the steps above they'll be removed to work down the problem list.

 

1. Check that the windows firewall or antivirus is not blocking the Radio client or DCS Network

 

2. Double check that the export file has just the one line listed above in it and the 4 other files (

DCS-SRSGameGUI.lua, DCS-SimpleRadioStandalone.lua , DCS-SRS-OverlayGameGUI.lua ,DCS-SRS-Overlay.dlg) are in the same folder

 

 

Final Steps

 

If you're sure that everything is OK and you've followed the steps above 100% the same and verified the two points above then:

 

Post all the logs (DCS & 5 SRS ones) that you find in

 

C:/Users//Saved Games/DCS/Logs

C:/Users//Saved Games/DCS.openbeta/Logs

C:/Users//Saved Games/DCS.openalpha/Logs

 

As well as your export.lua and a screenshot of your Scripts folder

 

Adding back in Helios / TacView

 

SRS should be fully compatible with any other Export script as long as the line

 

local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[scripts\DCS-SimpleRadioStandalone.lua]])

 

is at the bottom of your export script.

 

 

Once your radio is fully working and you start adding export scripts back in, make sure SRS is always at the end!

 

 

Hope this helps! :)


Edited by Ciribob

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Since I have a dynamic IP I have a problem hosting with autoconnect.. I'm wondering if I'm missing something that allows me to use the current external IP address somehow because DCS itself is able to figure it out without a problem.. Now I'm trying to add a piece of code to DCS-SRS-AutoConnectGameGUI.lua but somehow keeps crashing due to a couple of require statements.. Just can't seem to figure it out quite well.. So far I've got the following code :

 

externalip = function()
local http = require("socket.http")     -- these are the two lines that crash
local json = require("dkjson")            -- right here...
local resp,code,headers,status = http.request("[url]http://ipinfo.io/json[/url]")
if code ~= 200 then return nil, "Failed fetching external IP; "..tostring(status) end
local data, err = json.decode(resp)
if not data then 
 return nil, "Failed fetching external IP; "..tostring(err)
end
if data.ip then
 return data.ip
else
 return nil, "Failed fetching external IP; no ip field was returned"
end
end

-- User options --
local SRSAuto = {}
SRSAuto.SERVER_SRS_HOST = tostring(externalip())..":9987"
SRSAuto.SERVER_SEND_AUTO_CONNECT = true -- set to false to disable auto connect or just remove this file

Any idea how I can fix this or even better, throw away this stuff because I missed a functionality that's already available & does exactly the job I want?

Just to clarify, whenever I host a server (both DCS & SimpleRadio), everything is running on the same machine..

Also wondering why I can't autoconnect to my own server because when I try other servers it works perfectly fine..

 

 

EDIT: I believe the requires are crashing because it can't find the right files.. However I'm not sure since you also use require("socket") so I have my doubts...


Edited by Raffson

Gigabyte X470 AORUS UG

Ryzen 5 2600X

NVidia GTX 1070Ti 8GB

Vengance RGB DDR4 32GB

TrackIR5

TM HOTAS Warthog

Link to comment
Share on other sites

Hi there. I hope I'm posting this in the right thread to find help. 3 hours of searching the forums hasn't yielded any solutions for me yet.

 

I've installed SimpleRadio Standalone and put all the files in the folders as instructed. I've also added it to the export.lua script. I've created firewall exceptions for the SR client, and also created firewall rules for port 5002 on UDP and TCP, so I think I've covered just about everything

 

A fellow pilot tried to help me get it all set up yesterday, but we ran into a snag. The client managed to connect ok, and at the time showed that there were 2 of connected to the server, BUT when I brought up the GUI overlay in DCS no radios were showing and I couldn't tune anything, speak or hear anything. It appear that for some reason SR isn't hooking into my DCS properly. I was in a fully powered A-10C with all 3 radios powered. I've included some images below...

 

In-cockpit showing radios and overlay

2n72o0z.jpg

 

SimpleRadio Client

9fxson.jpg

 

DCS game settings showing comms setup

2d9y0qe.jpg

 

DCS version is 1.5.5.58891, running under Windows 10 Home x64. We couldn't manage to work out what's wrong, so hopefully someone here will have some advice for me. Thanks in advance.

 

Hello i had same problem today when i decide to test SR . one hour i try solve problem and after more then ten restart program and game i look on firewall , and firewall silently block SR , no window pop up.

After i alow it problem was solved , look on firewall setings.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Since I have a dynamic IP I have a problem hosting with autoconnect.. I'm wondering if I'm missing something that allows me to use the current external IP address somehow because DCS itself is able to figure it out without a problem.. Now I'm trying to add a piece of code to DCS-SRS-AutoConnectGameGUI.lua but somehow keeps crashing due to a couple of require statements.. Just can't seem to figure it out quite well.. So far I've got the following code :

 

externalip = function()
local http = require("socket.http")     -- these are the two lines that crash
local json = require("dkjson")            -- right here...
local resp,code,headers,status = http.request("[url]http://ipinfo.io/json[/url]")
if code ~= 200 then return nil, "Failed fetching external IP; "..tostring(status) end
local data, err = json.decode(resp)
if not data then 
 return nil, "Failed fetching external IP; "..tostring(err)
end
if data.ip then
 return data.ip
else
 return nil, "Failed fetching external IP; no ip field was returned"
end
end

-- User options --
local SRSAuto = {}
SRSAuto.SERVER_SRS_HOST = tostring(externalip())..":9987"
SRSAuto.SERVER_SEND_AUTO_CONNECT = true -- set to false to disable auto connect or just remove this file

Any idea how I can fix this or even better, throw away this stuff because I missed a functionality that's already available & does exactly the job I want?

Just to clarify, whenever I host a server (both DCS & SimpleRadio), everything is running on the same machine..

Also wondering why I can't autoconnect to my own server because when I try other servers it works perfectly fine..

 

 

EDIT: I believe the requires are crashing because it can't find the right files.. However I'm not sure since you also use require("socket") so I have my doubts...

 

Can't you use your hostname instead of your IP? It would need to resolve though. You can check what yours is on http://www.whatsmyip.org/

-

If man were meant to fly he'd be filled with helium.

Link to comment
Share on other sites

Since I have a dynamic IP I have a problem hosting with autoconnect.. I'm wondering if I'm missing something that allows me to use the current external IP address somehow because DCS itself is able to figure it out without a problem.. Now I'm trying to add a piece of code to DCS-SRS-AutoConnectGameGUI.lua but somehow keeps crashing due to a couple of require statements.. Just can't seem to figure it out quite well.. So far I've got the following code :

 

externalip = function()
local http = require("socket.http")     -- these are the two lines that crash
local json = require("dkjson")            -- right here...
local resp,code,headers,status = http.request("[url]http://ipinfo.io/json[/url]")
if code ~= 200 then return nil, "Failed fetching external IP; "..tostring(status) end
local data, err = json.decode(resp)
if not data then 
 return nil, "Failed fetching external IP; "..tostring(err)
end
if data.ip then
 return data.ip
else
 return nil, "Failed fetching external IP; no ip field was returned"
end
end

-- User options --
local SRSAuto = {}
SRSAuto.SERVER_SRS_HOST = tostring(externalip())..":9987"
SRSAuto.SERVER_SEND_AUTO_CONNECT = true -- set to false to disable auto connect or just remove this file

Any idea how I can fix this or even better, throw away this stuff because I missed a functionality that's already available & does exactly the job I want?

Just to clarify, whenever I host a server (both DCS & SimpleRadio), everything is running on the same machine..

Also wondering why I can't autoconnect to my own server because when I try other servers it works perfectly fine..

 

 

EDIT: I believe the requires are crashing because it can't find the right files.. However I'm not sure since you also use require("socket") so I have my doubts...

 

I'd guess a path issue as well. Try copying the path import that I have in the radio lua as it adds more search paths.

 

As an easier fix though sign up for this:

 

http://www.noip.com/

 

(others are available)

 

it'll give you a Domain name with the IP automatically kept up to date either by your router directly (if it supports it) or a small desktop program.

 

Add that domain to the lua and you're sorted

 

:)


Edited by Ciribob

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

I'd guess a path issue as well. Try copying the path import that I have in the radio lua as it adds more search paths.

 

As an easier fix though sign up for this:

 

http://www.noip.com/

 

(others are available)

 

it'll give you a Domain name with the IP automatically kept up to date either by your router directly (if it supports it) or a small desktop program.

 

Add that domain to the lua and you're sorted

 

:)

 

 

I've used noip in the past & while it's a possible solution, I rather not use it cause suppose I don't use my computer for a month, the domain will be released. Another slightly less possible issue would be that my IP stays the same for more than a month which would require me to manually refresh the noip domain so I'd rather use what I have so far without the need to manually update the file every time I intend to host a server.. I will look into the search paths that you mentioned & keep you posted..

 

Thanks for your time though!

 

 

EDIT : K I'm getting closer here, I managed to execute the code in a lua terminal so now I just need to figure out how I can get it to work in the AutoConnectGameGUI file.. Also thinking about asking the router for my external IP instead of bothering a website for it since my router supports UPnP cause otherwise the external IP would not show up on DCS itself.. Do you by any chance have experience with it? I read that it's a simple http request to a specific multicast address with a specific port but somehow I doubt that it's that simple..

 

EDIT2 : looks like I should've just used require("http") & move the package.path statements to the top.. also I needed to include dkjson file which I found now.. But now the require's aren't crashing anymore, it's the request itself..


Edited by Raffson

Gigabyte X470 AORUS UG

Ryzen 5 2600X

NVidia GTX 1070Ti 8GB

Vengance RGB DDR4 32GB

TrackIR5

TM HOTAS Warthog

Link to comment
Share on other sites

Can't you use your hostname instead of your IP? It would need to resolve though. You can check what yours is on http://www.whatsmyip.org/

 

Not sure where you're going with this, either you mean entering a domain name which I don't have or I'm missing something here.. Checking my ip is what I want to automate if you look at the code so guessing your advise is not going to work for me..

 

Thanks for trying though!

Gigabyte X470 AORUS UG

Ryzen 5 2600X

NVidia GTX 1070Ti 8GB

Vengance RGB DDR4 32GB

TrackIR5

TM HOTAS Warthog

Link to comment
Share on other sites

I've used noip in the past & while it's a possible solution, I rather not use it cause suppose I don't use my computer for a month, the domain will be released. Another slightly less possible issue would be that my IP stays the same for more than a month which would require me to manually refresh the noip domain so I'd rather use what I have so far without the need to manually update the file every time I intend to host a server.. I will look into the search paths that you mentioned & keep you posted..

 

Thanks for your time though!

 

 

EDIT : K I'm getting closer here, I managed to execute the code in a lua terminal so now I just need to figure out how I can get it to work in the AutoConnectGameGUI file.. Also thinking about asking the router for my external IP instead of bothering a website for it since my router supports UPnP cause otherwise the external IP would not show up on DCS itself.. Do you by any chance have experience with it? I read that it's a simple http request to a specific multicast address with a specific port but somehow I doubt that it's that simple..

 

EDIT2 : looks like I should've just used require("http") & move the package.path statements to the top.. also I needed to include dkjson file which I found now.. But now the require's aren't crashing anymore, it's the request itself..

 

Can you post the full snippet?

 

If you wrap the code in a pcall, what error is generated by the http request?

 

I'd use the built in JSON parser as well (look at the top the the SRS lua) as that seems to work fine and its how SRS communicates with DCS

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Can you post the full snippet?

 

If you wrap the code in a pcall, what error is generated by the http request?

 

I'd use the built in JSON parser as well (look at the top the the SRS lua) as that seems to work fine and its how SRS communicates with DCS

 

I'm not a Lua expert so I'm not sure what the pcall should look like..

When you're asking for a full snippet, I'm assuming you mean the whole AutoConnectGameGUI file which looks like this at the moment..

 

-- Version 1.2.9.2
-- ONLY COPY THIS FILE IS YOU ARE GOING TO HOST A SERVER!
-- The file must be in Saved Games\DCS\Scripts or Saved Games\DCS.openalpha\Scripts
-- Make sure you enter the correct address into SERVER_SRS_HOST below.
-- You can add an optional Port. e.g. "127.0.0.1:5002"
package.path  = package.path..";.\\LuaSocket\\?.lua;"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll;"
package.path  = package.path..";.\\Scripts\\JSON.lua;"
externalip = function()
net.log("WTF...before")
local h = require("socket.http")
local json = loadfile("Scripts\\JSON.lua")()
net.log("WTF...after")
local resp,code,headers,status = h.request("[url]http://ipinfo.io/json[/url]")
net.log("WTF...after2")
if code ~= 200 then return nil, "Failed fetching external IP; "..tostring(status) end
local data, err = json.decode(resp)
if not data then 
 return nil, "Failed fetching external IP; "..tostring(err)
end
if data.ip then
 return data.ip
else
 return nil, "Failed fetching external IP; no ip field was returned"
end
end
-- User options --
local SRSAuto = {}
net.log("WTF..."..tostring(externalip()))
net.log(string.format("%s:%s", tostring(externalip()), "9987"))
SRSAuto.SERVER_SRS_HOST = "127.0.0.1:9987"
SRSAuto.SERVER_SEND_AUTO_CONNECT = true -- set to false to disable auto connect or just remove this file
-- DO NOT EDIT BELOW HERE --
SRSAuto.unicast = false
-- Utils --
local HOST_PLAYER_ID = 1
SRSAuto.MESSAGE_PREFIX = "SRS Running @ " -- DO NOT MODIFY!!!
local socket = require("socket")
SRSAuto.UDPSendSocket = socket.udp()
SRSAuto.UDPSendSocket:settimeout(0)
SRSAuto.logFile = io.open(lfs.writedir()..[[Logs\DCS-SRS-AutoConnect.log]], "w")
function SRSAuto.log(str)
   if SRSAuto.logFile then
       SRSAuto.logFile:write(str.."\n")
       SRSAuto.logFile:flush()
   end
end
-- Register callbacks --
SRSAuto.onPlayerConnect = function(id)
if not DCS.isServer() then
       return
   end
if SRSAuto.SERVER_SEND_AUTO_CONNECT and id ~= HOST_PLAYER_ID then
       SRSAuto.log(string.format("Sending auto connect message to player %d on connect ", id))
 net.send_chat_to(string.format(SRSAuto.MESSAGE_PREFIX .. "%s", SRSAuto.SERVER_SRS_HOST), id)
end
end
SRSAuto.onPlayerChangeSlot = function(id)
   if not DCS.isServer() then
       return
   end
   if SRSAuto.SERVER_SEND_AUTO_CONNECT and id ~= HOST_PLAYER_ID then
       SRSAuto.log(string.format("Sending auto connect message to player %d on switch ", id))
       net.send_chat_to(string.format(SRSAuto.MESSAGE_PREFIX .. "%s", SRSAuto.SERVER_SRS_HOST), id)
  end
end
DCS.setUserCallbacks(SRSAuto)
net.log("Loaded - DCS-SRS-AutoConnect")

For some reason http is being bitchy again.. I has it working earlier with a line looking like:

 

local http = require("http")

 

but that gave me troubles again so I tried something different with no luck.. the json still works when doing it like you did..

 

Any suggestions for that http?

 

 

EDIT: now stuff tend to really go bananas on me.. can't see the messages of other components in the log :s

EDIT2: reinstalled everything & getting "LuaNET: Loaded - DCS-SRS GameGUI" back in the log.. still trying to get http to work though..

EDIT3: man wtf, I have no clue what's going on here but turns out it's require("socket.http") after all.. probably got confused since I tried adding files manually n shit but anyway, request call is still crashing.. edited the code to the most recent version again..

EDIT4: if the right way to do a pcall is the following:

local stat,err = pcall(http.request, ("[url]http://ipinfo.io/json[/url]"))
net.log(tostring(err))
net.log(tostring(stat))

then the log strangely says:

LuaNET: attempt to call a nil value

LuaNET: false


Edited by Raffson

Gigabyte X470 AORUS UG

Ryzen 5 2600X

NVidia GTX 1070Ti 8GB

Vengance RGB DDR4 32GB

TrackIR5

TM HOTAS Warthog

Link to comment
Share on other sites

  • Recently Browsing   0 members

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