Jump to content

Cant get os.execute to work in game.


A Hamburgler

Recommended Posts

To start off I did edit the MissionScripting.lua file but anyway Im having trouble getting os.execute to work. In game I use a trigger with do script file to call a script with

os.execute[[Test2]] or os.execute[[Test2.bat]]

I see the bat file pop up for a second but nothing happens. When I double click on the bat file it runs and executes my code perfecty. Im just having trouble executing it from within the game.

 

 

My bat code is

start "Generate First Mission" cmd /k "..\..\..\..\bin\luae.exe Init_Next_Mission.lua & exit"

 

 

And the Init_Next_Mission.lua code is

Data_Side1 = 1
Data_Side2 = 0	
Data_Side3 = 0	
Data_Side4 = 0	
Data_Side_String = string.format("AlphaZone1_Side11 = %s AlphaZone2_Side11 = %s AlphaZone3_Side11 = %s AlphaZone4_Side11 = %s ",Data_Side1,Data_Side2,Data_Side3,Data_Side4)
local file = io.open("Var_Carryed_Over.lua", "w")
file:write(Data_Side_String)
file:close()

 

Again every works as it should when I run it straight from the bat file but nothing happens when I run the same file from in game. Basically my goal here is to transfer some mission variables to a newly create lua file at which point my next mission will run that newly created file with those updated variables. So if anyone knows a better way please point me in the right direction. Thanks


Edited by A Hamburgler
Link to comment
Share on other sites

If it opens and immediately closes, I'd put the full path in the bat file and also cd to the right directory to be sure it's not a working directory issue.

 

Sent from my ONEPLUS A3003 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

If it opens and immediately closes, I'd put the full path in the bat file and also cd to the right directory to be sure it's not a working directory issue.

 

Sent from my ONEPLUS A3003 using Tapatalk

Thanks for the reply I have not tried it yet I will on the weekend and report back. But I forgot to mention I tried to run the main script ( Init_Next_Mission.lua ) directly from dcs too and nothing happened that’s the only reasons why I was using the batch method. I am curious as to why when it’s called from the game nothing happens but when called externally it works.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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