Jump to content

Recommended Posts

Posted

I know I saw it somewhere and I can't remember where and I can't find it, but....

How do you set a script's variables from within the running mission?

For example the ctld.lua has

ctld.Trace = false

a variable set with the default value 'false'. There is some why to change 'ctld.Trace' to another value, like 'true' through a trigger within a mission which has loaded the script, something like under TRIGGER - - ACTIONS

DO SCRIPT 'ctld.Trace = true'

but that is not the correct format for the command.

Anyone know how to do this?

Thank you

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Posted (edited)

@cfrag has a real time debugger as part of DML. It allows you to manually update a mission flag while the mission is running.  Do a search on DML as I don't remember exactly where it resides.

 

Edit:  it's pinned in this subforum.

Edited by Mistermann

System Specs:

Spoiler

📻Callsign:Kandy  💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, VKB STECS Standard, Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

📹 Video Capture Software:  Open Broadcaster Software (OBS), 🎞️ Video Editing Software:  PowerDirector 35

 Into The Jungle (MP Mission)  F18: Scorpion's Sting  Apache Campaign - Griffins  Kiowa Campaign - Assassins 

 

Posted
25 minutes ago, Mistermann said:

eal time debugger as part of DML.

There's also a stand-alone version of the debugger here: https://www.digitalcombatsimulator.com/en/files/3324851/

Of course, it's not as comfortable to use when you have to go without DML's zone abilities, but it's still an interactive debugger. 

As @Mistermann already kindly mentioned, the debugger can set flags, and set alerts when flag values change. It cannot, at this point in time, set script values.

Posted

unless i'm misunderstanding the question, wouldn't this work for you? The first line could be a DO SCRIPT as shown, or alternatively a DO SCRIPT FILE to pull the ctld.lua into the miz, but the second line "ctld.TRACE = true" should work either way, to set the value without you changing the lua.
 

image.png

Posted
On 11/25/2023 at 10:58 PM, Zyll said:

unless i'm misunderstanding the question, wouldn't this work for you? The first line could be a DO SCRIPT as shown, or alternatively a DO SCRIPT FILE to pull the ctld.lua into the miz, but the second line "ctld.TRACE = true" should work either way, to set the value without you changing the lua.

I think that indeed, that should be workable, and can be tied to some radio menus to be triggered at will.

The challenge as I understood it is: provided that you do not know the table element before you run the mission, how can you change an arbitrary table element, or red the value of an table element at any given time (i.e. full debug capabilities)? I experimented with that (and have a running version that can do this), but it's currently not in a user-presentable way: a single typo will cause an ugly error, and while I might be comfortable seeing it, most people do not, and therefore I do not include this capability in the Debugger. 

If you are curious, Lua provides a method 'loadString()' that allows any string to be executed as Lua code. Yeah. I won't let my godson play with my chainsaw either 🙂

 

Posted (edited)

CTLD was only a ready example to illustrate what I'm actually trying to achieve.

I'm actually trying to find a way to use the rangescript.lua (https://github.com/ciribob/DCS-SimpleRangeScript) without editing it to implement the setting I want.

I'm still trying to find a away to test changing variables, but it seems that the script used the same variable name (same variable??) in two different functions, setting the variable each time, so probably my efforts are for naught *frown*

I want to set maxAlt, minAlt, and range.bombingMinAlt from within the mission.

Edited by Captain Orso

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Posted (edited)
4 hours ago, Captain Orso said:

I'm still trying to find a away to test changing variables, but it seems that the script used the same variable name (same variable??) in two different functions, setting the variable each time, so probably my efforts are for naught *frown*

Here's an experimental version of "The Debugger 2.0", which can (and will, be warned) read and set any variable interactively for you while the mission is running. It's based on 

so it works the same way (place a mark on the F10 map, and enter the debugging command as text, and CLICK OUTSIDE THE MARK to have the debugger execute the command.

All debugger commands start with a '-' sign. To get an overview of all commands, do a "-?"

New to version 2 (and not fully tested are)

  • fully interactive event monitoring (subscribe to events to be notified about, e.g. "-eventmon 5" notifies you whenever event 5 (crash) occurs). 
  • QUERY (READ) LUA MSE VARIABLES: '-q <qualifiedVarname>' will return the value of the MSE variable, for example,
    image.png
    returns
    image.png
     
  • WARNING WARNING WARNING -- SET ANY LUA MSE VARIABLE TO ANY VALUE: '-w <Lua Varname> = <Lua Expression>' 
    does exactly what you tell it to do. Can overwrite anything in memory, so '-w env = {}' is a BAD idea. 

The debugger comes with a host of ME integration features (based on trigger zone attributes) that DML users know and expect but that you can ignore unless you want to reduce your workload. 

A manual for the OLD (stand-alone) version of the debugger is included with the standalone at the ED user files (and part of the DML documentation). I expect version 2.0 of the debugger to become officially part of DML by year's end, when I'll also update the stand-alone version (and documentation). If you want to use 2.0 of the debugger in your mission now, simply copy the three doscripts from the demo mission below to your mission as an ONSTART trigger (in the order: dcsCommon, cfxZones, debugger)

Hope this helps,

-ch

demo - debug events and more.miz

Edited by cfrag
Posted

It also depends a whole lot on global vs local values. ctld and that range script look like they both use global values so it isn't a problem. Otherwise you'd need to make a global function within the script that has access to the local values to change it. 

 

Anyway. The maxAlt and minAlt values look to be associated with each zone. If you wanted to change it for every zone then a simple loop will do the trick. 

for i = 1, #range.strafeTargets do
  range.strafeTargets[i].maxAlt = 799 -- or whatever
  range.strafeTargets[i].minAlt = 350
end

range.bombingMinAlt is just a global value used once, you can edit that at any point.

Or you could make a function to look for certain zones and edit the values as needed. 

 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

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