Flasher Posted February 1, 2024 Posted February 1, 2024 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
Kanelbolle Posted February 1, 2024 Posted February 1, 2024 (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 February 1, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Flasher Posted February 2, 2024 Author Posted February 2, 2024 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 ...
Kanelbolle Posted February 2, 2024 Posted February 2, 2024 (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 February 2, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Flasher Posted February 3, 2024 Author Posted February 3, 2024 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
Kanelbolle Posted February 3, 2024 Posted February 3, 2024 (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 February 3, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Flasher Posted February 3, 2024 Author Posted February 3, 2024 OK I made it again,, hope you could open it, see where the problem is TEST DRAW.miz
Kanelbolle Posted February 3, 2024 Posted February 3, 2024 Ah.. your still trying to use the markers in the ME with code. As i said already, it seam to be bugged.. Just do it with code as i showed before.. See attached mission test-DrawingLines-.miz WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Flasher Posted February 4, 2024 Author Posted February 4, 2024 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.
Flasher Posted February 4, 2024 Author Posted February 4, 2024 -- 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 ...
Kanelbolle Posted February 4, 2024 Posted February 4, 2024 (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 February 4, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Flasher Posted February 4, 2024 Author Posted February 4, 2024 OK this code works, thank you !! Is it possible to get a line same way but following the road shape ?
Flasher Posted February 4, 2024 Author Posted February 4, 2024 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
Kanelbolle Posted February 4, 2024 Posted February 4, 2024 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 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted February 4, 2024 Posted February 4, 2024 To do Color you just use the color variable for the command: https://wiki.hoggitworld.com/view/MIST_markerAdd Example: vd.color = {1,1,1,1} WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Recommended Posts