Jump to content

new ME commands


wolle

Recommended Posts

The mission editor manual needs to be updated to account for a bunch of stuff that has changed since its last update.

 

But the bomb in zone trigger simple checks if a bomb type is inside a zone.

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

Link to comment
Share on other sites

First thing that comes to mind is a range mission where azimuth and range can be called out.

 

Now that we have the scripting engine, the thought of someone trying to do something like that through triggers just makes me want to:

 

Facepalm100000000.gif

 

You could probably learn Lua from scratch and program this concept in 50 lines of Lua before you could figure out the trigger logic and implement all the hundreds or thousands of triggers and hundreds or thousands of zones it would take to make something like that work very well.

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

new Mission Editor trigger rule - Expression

 

Has anyone tried the new Mission Editor trigger rule - Expression?

 

What does it do, and how is it used?

[sIGPIC][/sIGPIC]

 

Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro

Link to comment
Share on other sites

Has anyone tried the new Mission Editor trigger rule - Expression?

 

What does it do, and how is it used?

 

It uses a Lua value as a trigger condition.

 

This has a large number of benefits, such as making it so that you no longer need to ever use flags again, and it allows you to make your own trigger conditions.

 

 

In the first example, I use the Lua DO SCRIPT and the EXPRESSION trigger condition to replace a flag with a Lua variable. Lua variables are much more flexible than flags and are actually NAMED, rather than just assigned an arbitrary number that requires you to use MSWord to keep track of.

 

In the second example, I use the EXPRESSION trigger condition to create a new trigger condition: effectively, "UNITS ALTITUDE ABOVE GROUND GREATER THAN". I do that with this code:

do
local unitName = 'Hawg11'
local alt = 1000  -- meters

local unit = Unit.getByName(unitName)
if unit then
	local pos = unit:getPosition().p
	local height =  land.getHeight({x = pos.x, y = pos.z})
	if pos.y - height > alt then
		return true
	end
end
end

 

I don't think that the do-end around the code is necessary in THIS case, as I believe that the code inside an EXPRESSION trigger condition is in its own closure, but I haven't tested that for a fact so I use the do-end just to be sure.

expression example 1.miz

expression example 2.miz

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

In the first example, I use the Lua DO SCRIPT and the EXPRESSION trigger condition to replace a flag with a Lua variable. Lua variables are much more flexible than flags and are actually NAMED, rather than just assigned an arbitrary number that requires you to use MSWord to keep track of.

 

Use excel instead of word. Much easier.

 

;)

 

I don't think that the do-end around the code is necessary in THIS case, as I believe that the code inside an EXPRESSION trigger condition is in its own closure, but I haven't tested that for a fact so I use the do-end just to be sure.

 

What is a do-end?

 

Not sure I see the advantage here over just using a FLAG, other than the convenience of now being able to name it.

 

Now, here is the 64 dollar question -- are we now able to pass values assigned to Expression ABC from mission to mission?

 

So if I assign a value of 99 to an expression called RIPCORD in the first mission (of a campaign), could I then refer to that same expression and read that value in a subsequent mission?

 

EDIT: probably before posting more stupid questions I should first examine your 2 examples myself and make an attempt at educating myself first. I think I'll do that.


Edited by Ripcord

[sIGPIC]sigpic65507_1.gif[/sIGPIC]

Link to comment
Share on other sites

Hi,

 

Not a trigger I know, but what the hell is this? I think it is might be related to scripting system, some kind of prodability for sure...

 

k1.jpg

 

From Wag's annoucement post:

 

Mission Editor UI for group variation placement tool added, not functional yet.

[sIGPIC]sigpic65507_1.gif[/sIGPIC]

Link to comment
Share on other sites

It uses a Lua value as a trigger condition.

 

In the second example, ... [edited out content to streamline]

do
local unitName = 'Hawg11'
local alt = 1000  -- meters

local unit = Unit.getByName(unitName)
if unit then
	local pos = unit:getPosition().p
	local height =  land.getHeight({x = pos.x, y = pos.z})
	if pos.y - height > alt then
		return true
	end
end
end

 

NOTE:

unitName is the "PILOT" name when you click the AIRPLANE GROUP in the Mission Editor (ME). It is NOT the group NAME. See attached screenshot.

attachment.php?attachmentid=77888&stc=1&d=1362241748

 

BACKSTORY:

Okay, so I loaded up your second example mission "expression example 2.miz" and it worked as described ( awesome! thank you! :thumbup: ).

 

Then I tried to use it myself with something very very simple. My test case was to create a new airplane group and use the new EXPRESSION trigger condition to simply display a message to everyone if the new airplane unit was being used in the mission. In other words... does this new unit exist? true/false... if true, display a message. Here's my code:

do
   local unitName = 'F15C'

   local unit  = Unit.getByName(unitName)
   if unit then
       return true
   end
end

 

Didn't work! :doh: Why!?!?!?

 

It is the name of the "PILOT" that is the unitName in this case. With ground vehicles there actually is a field called "UNIT NAME", which is a little more intuitive.

 

This is pretty frustrating as a newb scripter, so I wanted to pass it along to everyone else.

 

My Commentary FWIW:

I also recommend to ED that they standardize their naming. I see no reason they couldn't put a little sub-text next to the "PILOT" field for aircraft groups that says "(scripting: "unit name"), or something to that effect. Lack of standardization / naming scheme makes lining up the scripting reference and what you see in the ME a very time consuming bit of trial and error.

 

Now.. with that said... it is awesome that scripting is surfaced to us for missions and I applaud ED for it! Thank you! This is what will perpetuate this community and game. I just encourage you to really strive to clear up the ME / scripting references and make it more standardized and documented.

 

Cheers gang! Happy flying!

04_code_airplane_group_markup_2.thumb.png.1d31c318f4caf7c1de95d75864c774fc.png

"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

Oh and @Speed, just a friendly suggestion for tutorial missions like the ones you provided. It would be helpful if you used different group names from the unit / pilot names. Is there a particular reason you used the same names for both? << maybe I'm missing something?

 

Please understand this is just a suggestion from a guy who struggled with this stuff for a while. I just thought think it would make your example easier to understand.

 

And by the way, I am EXTREMELY thankful to you @Speed for being such an active participant and helping the "rest of us" figure out our arses from a hole in the ground on this stuff. Thanks man! Kudos!

"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

Found a couple issues with the wiki documentation I thought I'd pass along.

 

Coalition (coalition.side) and Country (country.id) enums, link to coalition wiki section, link to country wiki section

 

Wiki lists it as:

coalition.side = {
  NEUTRAL,
  RED,
  BLUE
}

country.id = {
  RUSSIA,
  UKRAINE,
  USA,
  TURKEY,
  UK,
  FRANCE,
  GERMANY,
  CANADA,
  SPAIN,
  THE_NETHERLANDS,
  BELGIUM,
  NORWAY,
  DENMARK,
  ISRAEL,
  GEORGIA,
  INSURGENTS,
  ABKHAZIA,
  SOUTH_OSETIA,
  ITALY
}

 

However, that's not quite it... that description (above from the wiki) leads you to believe that those two enums are numerically indexed arrays. Instead, when you iterate through the coalition.side enum you find it is actually a "dictionary" (associative array), where the side names are actually the keys, which actually are assigned values. (Maybe this changed in the most recent versions of the Sim???).

 

To see it add the following to a DO SCRIPT trigger (run once with no condition) in a mission... BTW, sorry if my debug code is a little messy, feel free to recommend on how to streamline it a bit:

 

print('(START) ***DEBUG OUTPUT of country.id global enum***\n')

print('country.id = {' .. '\n')

for key,val in pairs(country.id) do
   print('    ' .. '(' .. type(key) .. ')' .. key .. '=' .. '(' .. type(val) .. ')' .. val .. '\n')
end
print('}' .. '\n')
print('(END) ***DEBUG OUTPUT of country.id global enum***')

print('\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n')

print('(START) ***DEBUG OUTPUT of coalition.side global enum***\n')
print('coalition.side = {' .. '\n')

for key,val in pairs(coalition.side) do
   print('    ' .. '(' .. type(key) .. ')' .. key .. '=' .. '(' .. type(val) .. ')' .. val .. '\n')
end
print('}' .. '\n')
print('(END) ***DEBUG OUTPUT of coalition.side global enum***')

print(dbgOut)

 

Run the mission then navigate to "C:\Users\{REPLACE WITH YOUR COMPUTER USERNAME}\Saved Games\DCS\Logs\dcs.log". Open up that file and you will see in the output something similar to the following:

 

08242.602 UNKNOWN wWorld::initMissionScripting: (START) ***DEBUG OUTPUT of country.id global enum***
08242.602 UNKNOWN wWorld::initMissionScripting: country.id = {
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)CANADA=(number)8
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)NORWAY=(number)12
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)DENMARK=(number)13
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)ISRAEL=(number)15
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)GERMANY=(number)6
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)BELGIUM=(number)11
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)SOUTH_OSETIA=(number)19
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)UKRAINE=(number)1
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)FRANCE=(number)5
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)INSURGENTS=(number)17
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)THE_NETHERLANDS=(number)10
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)GEORGIA=(number)16
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)ABKHAZIA=(number)18
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)USA=(number)2
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)ITALY=(number)20
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)TURKEY=(number)3
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)SPAIN=(number)9
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)UK=(number)4
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)RUSSIA=(number)0
08242.602 UNKNOWN wWorld::initMissionScripting: }
08242.602 UNKNOWN wWorld::initMissionScripting: (END) ***DEBUG OUTPUT of country.id global enum***
08242.602 UNKNOWN wWorld::initMissionScripting: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08242.602 UNKNOWN wWorld::initMissionScripting: (START) ***DEBUG OUTPUT of coalition.side global enum***
08242.602 UNKNOWN wWorld::initMissionScripting: coalition.side = {
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)NEUTRAL=(number)0
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)BLUE=(number)2
08242.602 UNKNOWN wWorld::initMissionScripting:     (string)RED=(number)1
08242.602 UNKNOWN wWorld::initMissionScripting: }
08242.602 UNKNOWN wWorld::initMissionScripting: (END) ***DEBUG OUTPUT of coalition.side global enum***

 

Cleaned up, you get this:

country.id = {
   (string)CANADA=(number)8
   (string)NORWAY=(number)12
   (string)DENMARK=(number)13
   (string)ISRAEL=(number)15
   (string)GERMANY=(number)6
   (string)BELGIUM=(number)11
   (string)SOUTH_OSETIA=(number)19
   (string)UKRAINE=(number)1
   (string)FRANCE=(number)5
   (string)INSURGENTS=(number)17
   (string)THE_NETHERLANDS=(number)10
   (string)GEORGIA=(number)16
   (string)ABKHAZIA=(number)18
   (string)USA=(number)2
   (string)ITALY=(number)20
   (string)TURKEY=(number)3
   (string)SPAIN=(number)9
   (string)UK=(number)4
   (string)RUSSIA=(number)0
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

coalition.side = {
   (string)NEUTRAL=(number)0
   (string)BLUE=(number)2
   (string)RED=(number)1
}

 

[EDIT by the way, if you didn't catch it in the debug code I added the key and val type to the output so you see what types everything are.. which I find helpful]

 

Would be helpful to have the wiki updated.... not sure who has access or how to update it myself.

 

Anyhow.. learning... there goes Sunday! :)

 

Cheer!


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

arteedecco,

Those are "enumerators"- although what I don't see where Saint defined what enumerators are. Also, those numbers could change, that's part of the reason for using this structure. Also note that, the quoted country.id table is not actual Lua. If you were to treat it as Lua, technically, what it says is this:

country.id[1] = RUSSIA, where RUSSIA would have to be a variable name. So it's clear to me that you should not interpret the table as this:

country.id = {

[1] = "Russia",

[2] = "USA",

etc...

}

 

However, I agree, what the correct interpretation should be is a little murky. I'll see if I can fix it, but it might take a while for my fixes to trickle down.


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

  • 3 weeks later...
arteedecco,

Those are "enumerators"- although what I don't see where Saint defined what enumerators are.

However, I agree, what the correct interpretation should be is a little murky. I'll see if I can fix it, but it might take a while for my fixes to trickle down.

 

It's probably like in Java - the numbers are assigned internally based on the order of the enumeration values in the definition class.. So, if they later change the order, those value would be changed, too.

 

@tornado66 - Late Activation means that the unit will not appear at the start of the mission, but its appearance will be triggered in some way (e.g. via a trigger action 'activate group') - at least this is my experience with it.

i386DX40@42 MHz w/i387 CP, 4 MB RAM (8*512 kB), Trident 8900C 1 MB w/16-bit RAMDAC ISA, Quantum 340 MB UDMA33, SB 16, DOS 6.22 w/QEMM + Win3.11CE, Quickshot 1btn 2axis, Numpad as hat. 2 FPH on a good day, 1 FPH avg.

 

DISCLAIMER: My posts are still absolutely useless. Just finding excuses not to learn the F-14 (HB's Swansong?).

 

Annoyed by my posts? Please consider donating. Once the target sum is reached, I'll be off to somewhere nice I promise not to post from. I'd buy that for a dollar!

Link to comment
Share on other sites

  • 2 weeks later...
Hi.

Can someone explain how to use the "LATE ACTIVATION"?

thanks

Screen_130324_220347_zps26de71bc.jpg

 

 

Hi,

 

as far as I know this is for use with an activate groups trigger The Late Activate prepares the group to be ready when the trigger hits. If you dont press that check box, than the group will start at the time set under start.

 

hope that helps

 

cheers

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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