Jump to content

Scripting


Recommended Posts

Sorry if this is redundant, but I have searched quite a bit and am coming up empty.

 

 

  1. Is there a sticky / thread out there that provides a primer or intro into mission scripting?
  2. Is an updated manual coming out soon that will include a scripting SDK, or at least more detail on scripting (I've heard rumors of such)?
  3. Is the scripting in A-10c similar, or derived from Black Shark or Flaming Cliffs?
    • If so, do those games have scripting resources
    • What I'm wondering is how people have figured out what files to edit, what the functions are, etc.?
    • I can figure out Lua (the scripting language), but I don't understand what files are necessarily called by which things and when?

 

For example, I want to make some edits that add a new radio command to the JTAC radio menu (easy) that allows you to get position updates on your target and updated sADL / TAD SPIs from JTAC (not obvious). My idea is to find the code that tells reconnaissance aircraft to send out bullseye coordinates of targets they see and to call that function whenever the new radio menu option is called by the user in the JTAC menu. However, I cannot find the blasted command / function that the reconnaissance aircraft / AWACS are calling to execute that radio call.

 

I poked around in the radio .lua files and found the calls / commands, but I got lost when I came to the _G global table that is populated dynamically in the mission. I tried using the mission from Swift (I believe) that dumps to a log file, but I've been unable to get log files to work from logs.lua either.

 

All in all, I'm lost and cannot find anywhere to get started.

 

Help!

 

[feel free to move this thread as appropriate, but I've been searching so long that I figured others have been too, so I wanted it in general distribution at least initially]

 

[arteedecco ==> Turd_Fergusen]

 

Cheers!


Edited by arteedecco

"Snipe"

--------------------------------------------------------------------------------

OS => Win7 64-bit Ultimate | MOBO => ASUS M2N-SLI Deluxe | RAM => 8GB | VIDEO CARD => XFX ATI 4850 | CONTROLLER => Saitek X52 | DISPLAY => ASUS 25.5" 1600x1280 | HDD => 150GB WD Raptor (10K RPM)

Link to comment
Share on other sites

Huh? Swift's mission works fine, it dumps _G to your Temp folder in the A-10C directory. This is how I learned A-10C's functions, I started with Swift's mission. Anyway, those are the functions that can be called from the game, via the Triggered action command "Run Script". Not everything that we want to do is possible. Custom radio messages, for example, do not appear to be possible without a mod, could be wrong about this though. However, see the link in my sig for a lua script I made that gives not custom radio messages, but dynamically generated chat messages in multiplayer. That's the best we can do I believe, as actual "message to all" text has to be pre-defined at mission load time. Message to all is also not an available lua function anyway. Furthermore, lua code only executes locally on the host's machine, so multiplayer chat messages are pretty much the only way I know of it send dynamically generated text messages to clients. This will not work in single player, but one can always host a mission by themselves and fly by themselves if they really want to be anti-social single player users :P

 

I'm working on a lua function guide. ED was supposedly going to work on one, but I haven't heard anything about it really. Lua scripting is also broken in that syntax errors are not reported correctly in this current version, so with 1.1.0.7, if you want to lua script, you need to install Beta 4 or earlier. I'm planning on releasing my first lua scripting guide around the same time that patch 1.1.0.8 comes out, because c0ff (ED dev) said that lua syntax error reporting is fixed in 1.1.0.8.


Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Huh? Swift's mission works fine, it dumps _G to your Temp folder in the A-10C directory.

I'm running 1.1.0.7, so do I have to run BETA 4 to get this to work, per your comment that lua scripting is broken in my version?

 

What do you do to get the log file to be created? Do you have join in the A-10C? or fly, or move the A-10? Or something? What's the enemy w/ the IGLA doing?

 

 

via the Triggered action command "Run Script".

Does dofile() work in the Run Script inside the ME?

 

Custom radio messages, for example, do not appear to be possible without a mod, could be wrong about this though.

[edited] You can add to the "other" radio menu [Actually, as you noted previously, this menu has to be edited during mission creation in the ME and cannot be done dynamically via lua scripting, my mistake.] [/edited] and I found the .lua scripts that have the various menu options listed out in arrays, but... changes to those files would, as you say, only be client side so you would have to release a MOD for everyone to have the same options.

 

This is true of the modification I did to the F8 Ground Crew, Rearm radio menu. I added a couple new options, "SEAD" and "MAXI", which have custom armaments. This is nice as it works no matter what server I'm playing on, but is lame because only people who have updated their .lua files have the same options. Again, Mod'ing takes care of that, I assume? I have no background in mod'ing.

 

Furthermore, lua code only executes locally on the host's machine

Good point! I had overlooked this. Mod, mod, mod...

 

I'm working on a lua function guide.

Purdy please w/ sugar on top! :pilotfly:

 

Lua scripting is also broken in that syntax errors are not reported correctly in this current version, so with 1.1.0.7, if you want to lua script, you need to install Beta 4 or earlier.

I noticed I wasn't getting any error messages, but I just figured they were suppressed? Should be a config file that allows toggling this, IMO.

 

 

I'm planning on releasing my first lua scripting guide around the same time that patch 1.1.0.8 comes out, because c0ff (ED dev) said that lua syntax error reporting is fixed in 1.1.0.8.

Sweet deal!

 

Thanks for your reply!!! It's tough getting started as a lot of this is "tribal knowledge". A guide would be quite nice.

 

Lastly, how do you install 1.1.0.7 and BETA 4 side by side on same comp.?

 

TY!!!!! :thumbup:


Edited by arteedecco
correction

"Snipe"

--------------------------------------------------------------------------------

OS => Win7 64-bit Ultimate | MOBO => ASUS M2N-SLI Deluxe | RAM => 8GB | VIDEO CARD => XFX ATI 4850 | CONTROLLER => Saitek X52 | DISPLAY => ASUS 25.5" 1600x1280 | HDD => 150GB WD Raptor (10K RPM)

Link to comment
Share on other sites

I'm running 1.1.0.7, so do I have to run BETA 4 to get this to work, per your comment that lua scripting is broken in my version?

If you write function oriented code for lua (not quite sure if or how object oriented works in lua), then errors within the functions that are NOT syntax errors are properly reported in the dcs.log file in your <User>/Saved Games/DCS A-10/Logs folder. HOWEVER, syntax errors (such as me forgetting that not equals is ~= and not != in lua) are not reported properly. See: http://forums.eagle.ru/showthread.php?t=68571 If you do NOT use function oriented programming, then I believe that NO errors are reported correctly.

 

 

What do you do to get the log file to be created? Do you have join in the A-10C? or fly, or move the A-10? Or something? What's the enemy w/ the IGLA doing?

Just run the mission till it says flag 1 is true, then look in your A-10C directory, NOT SAVED GAMES, the actual A-10C directory on your hard drive, and inside the temp folder will be "Dump _G.txt" or something like that.

 

Does dofile() work in the Run Script inside the ME?

Never used it, but yes, I see no reason to believe that it will not work. That's the function that opens and reads the contents of a file as lua code, and executes it, right? Or is that loadfile()? I don't remember. But almost all standard lua functions are going to work just fine in a mission. There appear to be a few io lua functions that are missing from DCS though.

[edited] You can add to the "other" radio menu [Actually, as you noted previously, this menu has to be edited during mission creation in the ME and cannot be done dynamically via lua scripting, my mistake.] [/edited] and I found the .lua scripts that have the various menu options listed out in arrays, but... changes to those files would, as you say, only be client side so you would have to release a MOD for everyone to have the same options.

 

This is true of the modification I did to the F8 Ground Crew, Rearm radio menu. I added a couple new options, "SEAD" and "MAXI", which have custom armaments. This is nice as it works no matter what server I'm playing on, but is lame because only people who have updated their .lua files have the same options. Again, Mod'ing takes care of that, I assume? I have no background in mod'ing.

With the right mods and programs, you could do a lot more, but actually interacting with the game world is likely to be very limited. Alot of stuff is hard-coded, and you have no way to access it or control it through lua. You set tasks and set flags, there is a "setPosition" function I think for like, objects or something, but I have never been able to get it to do anything. One can generate radio messages, I finally got that working, but it's very, very complex. No way I saw to generate custom radio messages, but if there is a way I missed, it would still most likely only work for the host.

 

I noticed I wasn't getting any error messages, but I just figured they were suppressed? Should be a config file that allows toggling this, IMO.

You make code as the triggered action of a unit, preferably just one unit, that you place far away from all the action. To make the code run, you have to run the triggered action with a trigger. Error messages will appear in dcs.log.

 

Lastly, how do you install 1.1.0.7 and BETA 4 side by side on same comp.?

 

Run the Beta 4 installer, there were no conflicts for me. The two go into two separate folders, and beta versions do not use the Saved Games folder. Like, two months ago, I was able to do a beta 4 download, there were still enough seeders that it went pretty fast. I donno about now though.


Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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