Grimes Posted September 4, 2013 Share Posted September 4, 2013 The ED wiki is still locked down due to spam, so I have uploaded the scripting engine documentation to the hoggit wiki. I'll also be working toward reformatting the documentation to be a little bit easier to use. But its going to take a long time to complete MIST and SSE documentation, not to mention learning how to best format stuff using wiki. The changelog for 1.2.6 scripting engine is as follows. atmosphere singleton was added Unit.getCallsign() function was added Airbase.getDescByName() function was added Airbase.getCallsign() function was added Controller.getDetectedTargets() and Controller.knowTarget() functions were added Controller.isTargetVisible() was modified Spot class was added Group.getSize() now returns current size Group.getInitialSize() function was added Full documentation can be found here: http://wiki.hoggit.us/view/Simulator_Scripting_Engine_Documentation Things of note: As you can see getSize is now a "getCurrentSize" type of function. getInitialSize has been added and functions the way getSize worked up to 1.2.4. atmosphere functions have been added to simply get the wind and turbulence values at a vec3 point. Spot class allows you to spawn in a laser to illuminate a target with an IR pointer or for laser guided weapons. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting 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 More sharing options...
FlightControl Posted September 5, 2013 Share Posted September 5, 2013 Thanks Grimes for the update. The getSize and getInitialSize will come in handy :-) [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE] Link to comment Share on other sites More sharing options...
Flagrum Posted September 5, 2013 Share Posted September 5, 2013 (edited) noob question: how do I access a singleton (i.e. "atmosphere") from within the Export.lua? I am trying to generate a log file with the current wind conditions during the flight. But when I try to access the properties of "atmosphere", DCS.log tells me: 58: attempt to index global 'atmosphere' (a nil value) Edited September 5, 2013 by Flagrum Link to comment Share on other sites More sharing options...
shagrat Posted September 5, 2013 Share Posted September 5, 2013 Spot class allows you to spawn in a laser to illuminate a target with an IR pointer or for laser guided weapons.. Cooooool!!! This will make Special Ops much easier! No more hope the guy has LOS etc.:D Shagrat - Flying Sims since 1984 - Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore) Link to comment Share on other sites More sharing options...
SNAFU Posted September 11, 2013 Share Posted September 11, 2013 Thanks for the heads up. [sIGPIC][/sIGPIC] Unsere Facebook-Seite Link to comment Share on other sites More sharing options...
tobaschi Posted September 11, 2013 Share Posted September 11, 2013 one question, is it possible to access read/write external datasources(textfile/dbformats) during runtime? Link to comment Share on other sites More sharing options...
Ranger79 Posted September 14, 2013 Share Posted September 14, 2013 Can somone post an example of how to use the spot class? I have tried for awhile and cannot get it working. [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Gaanalma Posted September 14, 2013 Share Posted September 14, 2013 THX!! ;) [sIGPIC][/sIGPIC] www.36stormovirtuale.net Link to comment Share on other sites More sharing options...
Святой Posted September 14, 2013 Share Posted September 14, 2013 That was the last my changes in SSE. Link to comment Share on other sites More sharing options...
Joyride Posted October 7, 2013 Share Posted October 7, 2013 Can somone post an example of how to use the spot class? I have tried for awhile and cannot get it working. Finally got around to messing with this. With a little help from BAntDit, here's a simple working example (in spoiler) for generating an IR pointer and laser: function SparkleLase(OriginGroupName, TargetGroupName, LCode) local OriginGroup, TargetGroup = Group.getByName(OriginGroupName), Group.getByName(TargetGroupName) local OriginUnits, TargetUnits = OriginGroup:getUnits(), TargetGroup:getUnits() local TargetVec3 = TargetUnits[1]:getPoint() local TargetAdjVec3 = {x = TargetVec3.x, y = TargetVec3.y + 2, z = TargetVec3.z} Spot.createInfraRed(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3) Spot.createLaser(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3, LCode) end SparkleLase('Group1', 'Group2', 1444) Note that I raised the beam 2m off ground at the generating object and at the target point. If you use defaults, the beam is on the ground. Link to comment Share on other sites More sharing options...
Ranger79 Posted November 18, 2013 Share Posted November 18, 2013 Finally got around to messing with this. With a little help from BAntDit, here's a simple working example (in spoiler) for generating an IR pointer and laser: function SparkleLase(OriginGroupName, TargetGroupName, LCode) local OriginGroup, TargetGroup = Group.getByName(OriginGroupName), Group.getByName(TargetGroupName) local OriginUnits, TargetUnits = OriginGroup:getUnits(), TargetGroup:getUnits() local TargetVec3 = TargetUnits[1]:getPoint() local TargetAdjVec3 = {x = TargetVec3.x, y = TargetVec3.y + 2, z = TargetVec3.z} Spot.createInfraRed(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3) Spot.createLaser(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3, LCode) end SparkleLase('Group1', 'Group2', 1444) Note that I raised the beam 2m off ground at the generating object and at the target point. If you use defaults, the beam is on the ground. Thanks JoyRide! [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Ranger79 Posted November 18, 2013 Share Posted November 18, 2013 Finally got around to messing with this. With a little help from BAntDit, here's a simple working example (in spoiler) for generating an IR pointer and laser: function SparkleLase(OriginGroupName, TargetGroupName, LCode) local OriginGroup, TargetGroup = Group.getByName(OriginGroupName), Group.getByName(TargetGroupName) local OriginUnits, TargetUnits = OriginGroup:getUnits(), TargetGroup:getUnits() local TargetVec3 = TargetUnits[1]:getPoint() local TargetAdjVec3 = {x = TargetVec3.x, y = TargetVec3.y + 2, z = TargetVec3.z} Spot.createInfraRed(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3) Spot.createLaser(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3, LCode) end SparkleLase('Group1', 'Group2', 1444) Note that I raised the beam 2m off ground at the generating object and at the target point. If you use defaults, the beam is on the ground. Joyride, Is there a way to make the laser/ir follow a target when it moves? [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
number3 Posted November 18, 2013 Share Posted November 18, 2013 Joyride, Is there a way to make the laser/ir follow a target when it moves? Looks like you would use the mist.scheduleFunction to call SparkleLase at a set interval to get the new location of the unit. Though you may have some problems in situations where the ground elevation gets in the way and the laser points to the ground. I imagine you'll have to modify the SparkleLase method to check if the unit is within the line of site (land.isVisible), if false then cut off the laser. 314-я смешанная авиационная дивизия 314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119 Link to comment Share on other sites More sharing options...
Ranger79 Posted November 18, 2013 Share Posted November 18, 2013 Looks like you would use the mist.scheduleFunction to call SparkleLase at a set interval to get the new location of the unit. Though you may have some problems in situations where the ground elevation gets in the way and the laser points to the ground. I imagine you'll have to modify the SparkleLase method to check if the unit is within the line of site (land.isVisible), if false then cut off the laser. Last question could you use a flag false or unit alive command to turn off the script? Thanks for the above answer, I am new to .lua, but love its capabilities. [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
number3 Posted November 18, 2013 Share Posted November 18, 2013 Last question could you use a flag false or unit alive command to turn off the script? Thanks for the above answer, I am new to .lua, but love its capabilities. What do you mean by turn off the script? If you mean to stop the MIST scheduled function, at the beginning of your function you can check the status of a flag number function trigger.misc.getUserFlag(string userFlagName) function trigger.action.setUserFlag(string userFlagName, boolean or number userFlagValue) Remember when setting a flag to put the flag name in quotes. And if you no longer require the MIST scheduled function use: http://wiki.hoggit.us/view/RemoveFunction 314-я смешанная авиационная дивизия 314th Mixed Aviation Division: The "Fighting Lemmings"- Forums: http://314thsquadron.enjin.com/ - ED Forum Group: http://forums.eagle.ru/group.php?groupid=119 Link to comment Share on other sites More sharing options...
Joyride Posted November 18, 2013 Share Posted November 18, 2013 Ranger, this (below) updates it once every tenth of a second and follows a target. As number3 pointed out, you'd need to add a LOS check to avoid terrain potentially getting in the way. Haven't had time to get there yet, but would be pretty easy to roll incorporate using MIST. function SparkleLase(OriginGroupName, TargetGroupName, LCode) local OriginGroup, TargetGroup = Group.getByName(OriginGroupName), Group.getByName(TargetGroupName) local OriginUnits, TargetUnits = OriginGroup:getUnits(), TargetGroup:getUnits() local spots = {} local TargetVec3 = TargetUnits[1]:getPoint() local TargetAdjVec3 = {x = TargetVec3.x, y = TargetVec3.y + 2, z = TargetVec3.z} local status, result = pcall(function () spots['Sparkle'] = Spot.createInfraRed(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3) spots['Laser'] = Spot.createLaser(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3, LCode) return spots end) if not status then env.error('ERROR: ' .. assert(result), false) else if result.Sparkle then local Sparkle = result.Sparkle function KillSparkle() Spot.destroy(Sparkle) end function UpdateSparkleLase() KillSparkle() KillLase() SparkleLase(OriginGroupName, TargetGroupName, LCode) end timer.scheduleFunction(UpdateSparkleLase, nil, timer.getTime() + 0.1) end if result.Laser then local Laser = result.Laser function KillLase() Spot.destroy(Laser) end end end end Link to comment Share on other sites More sharing options...
Ranger79 Posted November 18, 2013 Share Posted November 18, 2013 Awesome, I have alot to learn, thanks again! [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Ranger79 Posted November 19, 2013 Share Posted November 19, 2013 (edited) Got it working, had a brain fart lol, thanks again! Edited November 19, 2013 by Ranger79 [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Ranger79 Posted November 27, 2013 Share Posted November 27, 2013 IR and Laser turn off after about 60 seconds, anyway to fix that? [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Grimes Posted November 27, 2013 Author Share Posted November 27, 2013 Reschedule the function to draw a new laser. As far as I understand the game doesn't have an issue with constantly redrawing the laser to follow moving targets. I'm honestly not entirely sure if removing itself after 60 seconds is on purpose or a bug. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting 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 More sharing options...
Ranger79 Posted November 28, 2013 Share Posted November 28, 2013 Reschedule the function to draw a new laser. As far as I understand the game doesn't have an issue with constantly redrawing the laser to follow moving targets. I'm honestly not entirely sure if removing itself after 60 seconds is on purpose or a bug. Tried, worked if only one target is used, but if you set a trigger to laze another target (after first is destroyed) the laser turns off after about 130-150 seconds. [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Ranger79 Posted December 2, 2013 Share Posted December 2, 2013 (edited) Got her working, added a schedule function to the script, works pretty good: function SparkleLase(OriginGroupName, TargetGroupName, LCode) local OriginGroup, TargetGroup = Group.getByName(OriginGroupName), Group.getByName(TargetGroupName) local OriginUnits, TargetUnits = OriginGroup:getUnits(), TargetGroup:getUnits() local spots = {} local TargetVec3 = TargetUnits[1]:getPoint() local TargetAdjVec3 = {x = TargetVec3.x, y = TargetVec3.y + 2, z = TargetVec3.z} local status, result = pcall(function () spots['Sparkle'] = Spot.createInfraRed(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3) spots['Laser'] = Spot.createLaser(OriginUnits[1], {x = 0, y = 2, z = 0}, TargetAdjVec3, LCode) return spots end) if not status then env.error('ERROR: ' .. assert(result), false) else if result.Sparkle then local Sparkle = result.Sparkle function KillSparkle() Spot.destroy(Sparkle) end function UpdateSparkleLase() KillSparkle() KillLase() SparkleLase(OriginGroupName, TargetGroupName, LCode) end mist.scheduleFunction(UpdateSparkleLase, {'Group1', 'DET_HELO', 1444}, timer.getTime() + 0.5, 36000) end if result.Laser then local Laser = result.Laser function KillLase() Spot.destroy(Laser) end end end end Called with: SparkleLase('Group1', 'DET_HELO', 1444) The weird thing is I can add another DO SCRIPT (example below), which activates once GROUP DEAD (DET_HELO group) and the IR/Laser will switch to the tar1 target, works great! It even switches to different targets in a group until all targets are down, pretty neat! SparkleLase('Group1', 'tar1', 1444) Proof of Concept Video: Edited December 2, 2013 by Ranger79 [sIGPIC][/sIGPIC] Ranger79 OEF/OIF Veteran YouTube Channel Twitch Channel Mods, Missions, & Tutorials: Operation Piercing Fury Campaign Ranger79's Object Pack ISIS CrisIS Campaign Mission Editing Video Series Link to comment Share on other sites More sharing options...
Recommended Posts