Jump to content

Recommended Posts

Posted

Hi,

Since there is n support anymore with the creator of mist, does anyone know how to suppress a line drawn with MIST ?

The command mist.marker.remove does not work 

Posted (edited)
10 hours ago, Flasher said:

Hi,

Since there is n support anymore with the creator of mist, does anyone know how to suppress a line drawn with MIST ?

The command mist.marker.remove does not work 

Here is an example miz and the code:

 

local _var = {}

-- Create a drawing 1
_var.id = mist.marker.getNextId()
_var.pos = mist.getGroupPoints('Ground-1')
_var.mType = 'freeform'

-- Add to a global variable or a table while you create the marker
shapeinfo1 = mist.marker.add(_var)

-- Create a drawing 2
_var.id = mist.marker.getNextId()
_var.pos = mist.getGroupPoints('Ground-2')
_var.mType = 'freeform'

-- Add to a global variable or a table while you create the marker
shapeinfo2 = mist.marker.add(_var)


-- Run this where you want to delete the drawing
mist.marker.remove(shapeinfo1)
mist.marker.remove(shapeinfo2)

 

From examples here:

https://wiki.hoggitworld.com/view/MIST_markerAdd

https://wiki.hoggitworld.com/view/MIST_markerRemove

 

You could also use markerGet to get the drawping info if you have a name, but have not tried this.
https://wiki.hoggitworld.com/view/MIST_markerGet

 

test-Mist-CreateDeleteDrawing-.miz

Edited by Kanelbolle
Posted

HI

I still have the problem because, I created a line in  the mission editor, that is following a road, I can get it visible with mist command, but mist.remove does not work, and I don"t how to draw my line using script instead of drawing editor ...

Posted (edited)
2 hours ago, Flasher said:

HI

I still have the problem because, I created a line in  the mission editor, that is following a road, I can get it visible with mist command, but mist.remove does not work, and I don"t how to draw my line using script instead of drawing editor ...

Yea, have been trying for some hours now to remove markers from ME but seam to be bugged...

 

But if you want to do it by code you can just set out Trigger zones in ME where the lines should go and make them like this:

-- Create Trigger Zones and get them by name here
local _tZone1 = trigger.misc.getZone("L1Start")
local _tZone2 = trigger.misc.getZone("L1End")

-- Save the marker id to a variable for later
_mId =mist.marker.getNextId()

-- Create the line
trigger.action.lineToAll(-1 , _mId , _tZone1.point , _tZone2.point , {1,0,0,1} , 1 , false)

-- Remove the line later
trigger.action.removeMark(_mId)

 

Edited by Kanelbolle
Posted (edited)
1 hour ago, Flasher said:

Thank you with your help I m now able to hide a line... But with multiple segments line, I can only hide the first segment WTF !

look in This test mission.

Philadelphia Experiment.miz 1.98 MB · 3 downloads

Can't seam to open your mission file. But do you have a unique id for all the markers ?

Example if you do this:

_mId1 =mist.marker.getNextId()
_mId2 =mist.marker.getNextId()

They will both get the same id. The getNextId() actively gets the existing id's and gets the next, so you have to create a drawing before calling it again....

 

You have to do it like this:

-- Create Trigger Zones and get them by name here
local _tZone1 = trigger.misc.getZone("L1Start")
local _tZone2 = trigger.misc.getZone("L1End")
local _tZone3 = trigger.misc.getZone("L2")
-- Save the marker id to a variable for later
_mId1 =mist.marker.getNextId()

-- Create the line
trigger.action.lineToAll(-1 , _mId1 , _tZone1.point , _tZone2.point , {1,0,0,1} , 1 , false)

-- Save the marker id to a variable for later
_mId2 =mist.marker.getNextId()

-- Create the line
trigger.action.lineToAll(-1 , _mId2 , _tZone2.point , _tZone3.point , {1,0,0,1} , 1 , false)

 

 

You could also just put the ID's manually:

-- Create Trigger Zones and get them by name here
local _tZone1 = trigger.misc.getZone("L1Start")
local _tZone2 = trigger.misc.getZone("L1End")
local _tZone3 = trigger.misc.getZone("L2")
-- Save the marker id to a variable for later
_mId1 = 90001

-- Create the line
trigger.action.lineToAll(-1 , _mId1 , _tZone1.point , _tZone2.point , {1,0,0,1} , 1 , false)

-- Save the marker id to a variable for later
_mId2 = 90002

-- Create the line
trigger.action.lineToAll(-1 , _mId2 , _tZone2.point , _tZone3.point , {1,0,0,1} , 1 , false)

But i would just do a integer variable that you count up every time.

_midCounter = 90000

_midCounter  = _midCounter + 1
_mId1 = _midCounter

_midCounter  = _midCounter + 1
_mId2 = _midCounter

 

Edited by Kanelbolle
Posted

OK if I understand well, you're creating each segment one after the other and deleting them the same way, so one line code for each segment

But when you're drawing a free line in ME, it could contain over 50 segments for exemple,  so we can't create 50 lines codes just o delete a simple drawing, any, shorter suggestion ?

Thanks for your help.

Posted
-- Create a drawing 1
_var.id = mist.marker.getNextId()
_var.pos = mist.getGroupPoints('Ground-1')
_var.mType = 'freeform'

I don't understand how you can get a triangle shape out of these 3 lines code ...

Posted (edited)
3 hours ago, Flasher said:
-- Create a drawing 1
_var.id = mist.marker.getNextId()
_var.pos = mist.getGroupPoints('Ground-1')
_var.mType = 'freeform'

I don't understand how you can get a triangle shape out of these 3 lines code ...

This is the getGroupPoints that gets this points from the waypoints of the group.
It only seam to make polygons, not lines.

 

Here is a quick and dirty example to make a drawing using a loop that gets a units route :

function makeLineFromUnitRoute(_unitName)


	local test = {}
	local posTbl = {} 
	local _last = nil
	test.pos = mist.getGroupPoints(_unitName)
	for k,v in pairs(test.pos) do
		 env.info(v)
		
		if (k == 1) then
			_last = test.pos[k]
		
			env.info("Adding First off all pos: " .. test.pos[k].x)

		elseif (k ~= _last) then
			env.info("Pos: " .. k)

			env.info("Adding new pos: " .. test.pos[k].x)

			posTbl =
			{
				[1] = _last,
				
				[2] = {
					["x"] = test.pos[k].x,
					["y"] = test.pos[k].y,
				},
				
			}
			
			local vd = {}
			vd.id = mist.marker.getNextId()
			vd.pos = posTbl
			vd.lineType = 1
			vd.mType = 'line'
			mist.marker.add(vd)
			
			env.info("Made Line from point " .. k .. posTbl[1].x  .. " to " .. posTbl[2].x)
			trigger.action.outText("Made Line to point " .. k , 10)
			_last = test.pos[k]
		end
		
		
		
		posTbl = {}

		
	end

end


makeLineFromUnitRoute('Ground-1')

 

Edited by Kanelbolle
Posted

OK this code works, thank you !!

Is it possible to get a line same way but following the road shape ?

 

And is it possible to have the in RED, and what os the code to remove this drawing ?

Thanks

Posted
1 hour ago, Flasher said:

OK this code works, thank you !!

Is it possible to get a line same way but following the road shape ?

 

And is it possible to have the in RED, and what os the code to remove this drawing ?

Thanks

Not that i know of, maybe look at all the available commands:
https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation

 

You have to keep track of the id's you crate if you want to delete them, as i showed you before, but you can put them all in a table instead of individual strings.

See here:

https://www.tutorialspoint.com/lua/lua_tables.htm

 

I would highly recommend you start taking a LUA tutorial if you are going to code for DCS 🙂

 

  • Recently Browsing   0 members

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