Jump to content

Recommended Posts

Posted

As far as you know, is it possible to recognize by script if terrain is town or free country? I would like.to make an arty script that should.fire only outside.cities

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

You'd have to make a script to search an area around a random point you selected and then figure out where buildings are at. If enough buildings are in a given volume then generate a new point and start over.

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

Posted

I'm having an issue with -

mist.flagFunc.units_in_polygon

 

It seems the toggle option is not working.

I fixed a problem in the if statement that was using trigger.action.getuserflag instead of trigger.misc.getuserflag.

But, the toggle option is still not working, by checking the MIST lua file, I couldn't find anything wrong.

 

WWould appreciate some looking at it and checking if I missed something.

 

Thanks

Posted

Fixed it. Get download here: http://forums.eagle.ru/showpost.php?p=2090603&postcount=538

 

Minor fixes, so just a minor patch again

 

-teleportToPoint now accepts vars.gpName or vars.groupName for the groups name

-fixed bug with mist.flagFunc.units_in_polygon() toggle option

 

Any requests for v3.5?

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

Posted

- Get units in polygon zone (by unit type).

- Set group route.

 

Getting units in a polygon would be useful. My initial thoughts on the functions would be to have one that simply returns a list of all of the units in the zone, and another to do it by type or via an mist.makeUnitTable entry. Also I'd probably overload it so multiple polyzones would be accepted in the search area.

 

How is setting a group route different from mist.goRoute?

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

Posted
You are right, must have missed it.

TThere's a script by bushmanni that does goroute but starts from the closest WP to the group, might be valuable to add to MIST.

 

It starts from closest point along the path, not just closest waypoint.

DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community

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

SF Squadron

Posted (edited)

I'm getting an error that I can't explain so I'm hoping to get some help. I'm building a simple visual recon script so that a designated recon/scout air unit will generate spotting messages giving positions of enemy aircraft, ship, helos and ground units relative to the bullseye that it "sees".

 

The messages are being sent by mist.message.add and work fine until they hit the expiry time I've given of 3 minutes. I'm naming each message and I can see the spotting reports for a particular enemy unit updating as the enemy moves (ie the range and bearing etc change) rather than new messages appearing so at present I'm assuming that I'm populating the message name correctly. However when the expiry time is reached it looks like the scheduled remove done under the covers by mist is failing with the error:

SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\xxx\AppData\Local\Temp\DCS\/~mis..."]:3652: attempt to call method 'remove' (a nil value)

 

After this I get no more new messages even though I'm definitely in "visual" range of an enemy unit. Do I have to actually manually remove messages created by mist.message.add? or should they be handled automatically still (as I understand from the doco) and maybe there is a bug?

 

Thanks for any clues someone can provide.

 

Cheers,

Stonehouse

 

PS I've checked the logic of my script by doing each type of unit by itself and all works fine.

Edited by Stonehouse
Posted

It handles it automatically, it shouldn't have a problem removing messages at all. Could you post a code snippet so I can see what could possibly be breaking it?

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

Posted

Sure no problems. If it's easy to do I can pm you the test mission and script if you like in case there is a problem in how I'm running it from the ME triggers. I don't think there is since I get the messages ok but if there's nothing else maybe there is an issue there.

 

_vars={}

--check if recon is under air attack and if so call for help

if bogeyrange <= airattack then

_vars.units = _reconunits

_vars.alt = reconalt

else

_vars.units = _planename

_vars.alt = planealt

end

 

if friendly == 'blue' then

_vars.ref = coalition.getMainRefPoint(coalition.side.BLUE)

else

_vars.ref = coalition.getMainRefPoint(coalition.side.RED)

end

_vars.metric = 1

 

coordstring = mist.getBRString(_vars)

_msg = {}

--check if recon is under air attack and if so call for help

if bogeyrange <= airattack then

_msg.text = 'MAYDAY MAYDAY - Recon under attack by bandits at bearing and range from bullseye : '..coordstring..' ASL'

_msg.name = _reconunits[1]

else

_msg.text = 'RECON ALERT - Bandits bearing and range from bullseye : '..coordstring..' ASL'

_msg.name = _planename[1]

end

_msg.msgFor = {coa={friendly}}

_msg.displayTime = 180

--send the message

mist.message.add(_msg)

end

Posted

Well it would be nice to figure out what was screwed up with the initial version to get that error. At the least to see if I can further protect against any errors within the script.

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

Posted

I'm really tired so this may not be 100% accurate, but i'm pretty sure this is the problem. (also I had posted an answer, but then deleted said post because I thought I was wrong. Time for sleep)

 

The message name isn't a string, but a unit object.

 

msg = 
{
   [1] = 
   {
       ["addedAt"] = 59.901,
       ["msgFor"] = 
       {
           [1] = 3,
           [2] = "BLUE",
       }, -- end of ["msgFor"]
       ["name"] = 
       {
           ["id_"] = 16777472,
       }, -- end of ["name"]
       ["messageID"] = 1,
       ["displayTime"] = 180,
       ["displayedFor"] = 0,
       ["text"] = "RECON ALERT - Enemy Ships bearing and range from bullseye : 258 for 65 at 0 ASL",
   }, -- end of [1]
} -- end of msg

 

Apparently mist.getUnitsInMovingZones() returns a list of unit objects, not unit names. I completely forgot.

 

So change this

 

_msg.name = _spottedShip

 

into this

 

_msg.name = _spottedShip:getName()

  • Like 1

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

Posted

Ok thanks Grimes lol I'll get this stuff into my head one day I swear. I should have seen that too as I was passing _msg.name _planename[1] for the aircraft and didn't see I'd got the wrong table for ships.

 

Thanks again.

 

Cheers,

Stoney

Posted (edited)

Hi Grimes,

I tried what you suggested and I'm afraid no luck I'm sorry. I added debug to dump the table prior to the ships call to message.add and this is what was passed:

 

00865.202 INFO SCRIPTING: message {

["displayTime"] = 180,

["text"] = "RECON ALERT - Enemy Ships bearing and range from bullseye : 260 for 65 at 0 ASL",

["name"] = "Unit #1",

["msgFor"] = table: 0000000061461550 {

["msgFor"]["coa"] = table: 000000002988DB00 {

["msgFor"]["coa"][1] = "blue",

},

},

}

 

Unit #1 is the unit name for the ship. I was talking to a mate who writes the odd bit of C++ and other unix based languages and he felt that part of the issue might be the # in the name. So I changed the name to 'ship' and it then seemed to work so I got messages for the first 2 planes, the ship and then the helo. I didn't get messages for the vehicle but that's probably a bug on my side as I also renamed it to be something without a special char.

 

The other thing is that when I got to the helo I saw the old messages about the planes and the ship whereas I thought they would be gone. ie I thought the helo message would be on line 1 of the msg box but instead it was on line 5 (ship msg, two bandit msgs, and the mayday msg from one of the planes getting close and then the helo msg).

 

I'm attaching the last point of edits on the mission and script below, if you have time to look that would be great. I'll keep looking at it in the meantime.

 

Again I got the message below in the log, however I assume this is from the helo and not the ship now as I don't get messages from the vehicle??

 

00104.114 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Users\xxx\AppData\Local\Temp\DCS\/~mis..."]:3652: attempt to call method 'remove' (a nil value)

 

 

<edit> I went back and suppressed the in game output of the table debug and just let it go to the log as I was concerned that maybe it was overlaying the message box. I also reduced the displayTime to 20 secs in case 180 was too long. Anyway it still seems to be the ship somehow although I don't know why. The table entry for the msg being passed to mist.message.add seems ok but the error seems to kill the ability for mist to display the message.

 

Updated script, mission and log section attached. Log has been trimmed to remove personal info and bulk and renamed dcs.txt

<endedit>

 

Cheers,

Stonehouse

Recon.lua

testrecon.miz

dcs.txt

Edited by Stonehouse
Posted

Fixed. get D/l here: http://forums.eagle.ru/showpost.php?p=2090603&postcount=538

 

It was a problem with updating messages via mist.message.add. I forgot to test a specific scenario and it turns out it was broken. It is fixed now.

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

Posted

Gonna try an experiment of starting to host some of the files/updates on github. Considering Speed is still AFK and I am relying on linking forum posts for the latest download, I figured it might be a good idea to at least try this out. It probably doesn't help that mist is just a single file, but we will see. It is probably better suited for slmod, which I may also add.

 

MIST on Github

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

  • 2 weeks later...
Posted

Just a little update on mist 3.5. I've so far added 9 new functions and have 6 or 7 more that I need to finish and test. I have published the changes on the github development branch of mist. While not not all of the planned functions are added yet, this update pretty heavily focuses on group randomization. Specifically I am adding functions to randomize the order of a group, exploring a group variant feature, and a function that can build a random group from input values. The new flagFuncs are there to make it easier for users to set flags based on the existence of dynamically spawned AI.

 

Feel free to test out the development branch from the link earlier in this post. I'm trying to keep it as stable as possible, testing functions separately to make sure everything is working as intended before adding it to the dev branch. Keep in mind though that I haven't added any documentation, as that is typically the last thing I do before a release, so you'll have to figure the new functions out on your own. However if anyone likes doing documentation and wants to fix any old issues from the doc file, it is up there so it can be edited. :thumbup:

 

 

I floated this idea in another thread, but is there any interest in a version of mist that is divided into multiple files focused on different functions and the user decides which files to load based on what they need? This would be in addition to the single large mist file. I ask because mist is getting quite large and I seem to be added less and less general purpose functions with each release. So it stands to reason that more advanced users might want the general purpose stuff without anything else in there.

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

Posted

I floated this idea in another thread, but is there any interest in a version of mist that is divided into multiple files focused on different functions and the user decides which files to load based on what they need? This would be in addition to the single large mist file. I ask because mist is getting quite large and I seem to be added less and less general purpose functions with each release. So it stands to reason that more advanced users might want the general purpose stuff without anything else in there.

 

Hi Grimes,

Yes, I would like this.

My use of Mist is all about the functions 'mist.flagFunc.units_in_zones' and 'mist.flagFunc.units_in_moving_zones'. Zone Type & Toggle arguments are quite useful.

 

mist.flagFunc.units_in_moving_zones{

units = {'[blue][plane]'},

zone_units = {'[g]Red SGrp01'},

flag = 40107,

radius = 300,

zone_type = 'sphere',

toggle = true,

}

 

 

Your solution for Stop Condition flags longer than 2 digits is another function:

 

--- Stop Condition when a flag is true

if trigger.misc.getUserFlag(58104) == 1 then

return true

end

---

 

That kind of basic stuff in a smaller Mist file would be nice. Would a mission designer be able to add more functions to the smaller file?

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted

Stop condition flags are 6 digits with a max value of 100000. This was changed a while ago with 1.2.6 or 1.2.7, can't remember which. It was simply a minor gui fix :)

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

Posted

MIST ERROR

 

36878.791 INFO SCRIPTING: stack traceback:

[string "C:\Temp\DCS\/~mis00001731"]:477: in function <[string "C:\Temp\DCS\/~mis00001731"]:475>

[C]: in function 'getCategory'

[string "C:\Temp\DCS\/~mis00001731"]:4347: in function 'f'

[string "C:\Temp\DCS\/~mis00001731"]:505: in function <[string "C:\Temp\DCS\/~mis00001731"]:505>

[C]: in function 'xpcall'

[string "C:\Temp\DCS\/~mis00001731"]:505: in function 'do_scheduled_functions'

[string "C:\Temp\DCS\/~mis00001731"]:428: in function <[string "C:\Temp\DCS\/~mis00001731"]:403>

36878.791 INFO SCRIPTING: mist.scheduleFunction, error in scheduled function: [string "C:\Temp\DCS\/~mis00001731"]:4347: Object doesn't exist

 

Thousands of lines of errors like this in the log file...

Find the log file attached.

 

Result of the errors: LAG

And gamers complaining that the server does not work and the mission is unplayable.

 

I spend hours debugging mist like this... Probably i am your only user who is spawning units dynamically...

 

 

The error is in de code :

 

 
 local function checkSpawnedEvents()
 --env.info('check Spawned Events')
 local groupsToAdd = {}
 
 for index, gpData in pairs(addToDBs) do
  groupsToAdd[#groupsToAdd + 1] = gpData
  groupsToAdd[#groupsToAdd].mist = true -- ok now
  
  addToDBs[index] = nil
 end
 --env.info(#groupsToAdd)
 --env.info(#tempSpawnedUnits)
 for eventId, eventData in pairs(tempSpawnedUnits) do
  if eventData then
   [b][size=3][color=red]if eventData:getCategory() == 1 then -- normal groups
[/color][/size][/b]    local match = false
    if #groupsToAdd > 0 then -- if groups are expected

 

Pls check (if it ever will get checked).

 

Anyway, i've found now a way to get around these errors. I will simply not use these kind of mist scheduled functions anymore, because the added value is 0 for me.

I have another mechanism to spawn units now, and it works smooth, simple and easy. No tables required.

 

Sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Posted (edited)

I'm in the middle of re-factoring that code to put it in a co-routine, so trust me, it is getting looked at. While I may have been gone a while earlier this year, and I don't have as much time to work on this stuff as I used to, it is still important to me to make sure everything is working as it needs to be. My absence earlier this year, and a few users efforts to fix mist at their own initiative is why I put mist up on github.

 

 

Do those error messages occur right from the start or several hours into the mission?

 

 

EDIT:

Testing it I got the error messages to occur via spawning into a Belgian sling load Huey. Initially I thought it may have been an issue with spawning cargo, because it is something I haven't tested fully. I decided to try out a newer version of mist, and added the mist.getBRStringZone function so it will work. At least with spawning the sling load Huey, I no longer get error messages added to the log file. So maybe take a look at what is different between mist 3.4 or mist 3.5 development and add the differences into your modified mist 3.3 that you are running.

 

Just using the code snippet you posted earlier, there is a difference that might have fixed the issue. Let me know if it fixes it. :)

 

local function checkSpawnedEvents()
	--env.info('check Spawned Events')
	local groupsToAdd = {}
	
	for index, gpData in pairs(addToDBs) do
		groupsToAdd[#groupsToAdd + 1] = gpData
		groupsToAdd[#groupsToAdd].mist = true -- ok now
		
		addToDBs[index] = nil
	end
	--env.info(#groupsToAdd)
	--env.info(#tempSpawnedUnits)
	for eventId, eventData in pairs(tempSpawnedUnits) do
		if eventData [color="SeaGreen"]and eventData:isExist() [/color]then
			if eventData:getCategory() == 1 then -- normal groups
				local match = false
				if #groupsToAdd > 0 then -- if groups are expected

Edited by Grimes

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...