Jump to content

MOOSE - Mission Object Oriented Scripting Framework


Recommended Posts

I will post here a MOOSE code fragment based on the Menu method. This works to create a SIMPLE F10 Other menu item on a schedule, and delete it after use.

 

 

F18_Grp = GROUP:FindByName( " Player" )

Target_Zone = ZONE:New( "Target" )
EnfieldReply = "Colt 1, Enfield 1. Roger On our way."

HelpMsg = " Enfield 3, Colt 1. Request Assistance"
EnfieldResponse = "Colt 1, Enfield 1. Roger, on our way."

 function EnfieldMsg ()     -- Enfield response timer function
   MESSAGE:New( EnfieldResponse, 15, nil ):ToAll()
 end

--  These function commands are executed on F10 item invoke. 
 function ReqHelp()
    MESSAGE:New( HelpMsg, 15, nil ):ToAll()
    trigger.action.setUserFlag( '10', 1 )
    timer.scheduleFunction( EnfieldMsg, {}, timer.getTime() + 15 )  -- Delays Enfield response 15 sec.
    BanditsHot:Remove( 10, nil )   -- Removes the F10 menu item
  end     

MenuScheduler = SCHEDULER:New( nil,   -- F10 menu item scheduler
 function()

   if F18_Grp:IsPartlyInZone( Target_Zone ) then
       BanditsHot = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Bandits hot. Request Help", nil, ReqHelp )
       MenuScheduler:Stop()
    end

 end, {}, 10, 15 )

Link to comment
Share on other sites

So I just got into MOOSE a little bit and set up a simple GCI test mission modded a little from the example mission "AID-013 - AI_A2A - Intercept Test".

 

Now when/if friendly CAP reaches the airbase where RED GCI spawns, they will engage them on the ground. Now I got 2 damaged and idle (pilots standing outside aircraft) red GCI aircraft blocking the taxiway.

 

Is there a built in function to handle these situations, like "if standing still and not taking off for xx seconds then despawn"?

 

EDIT: I found the CLEANUP_AIRBASE class but I don't want to disable blue AI engaging anything around the airbase. I just want to remove spawned AI aircraft that has not moved for a certain amount of time since spawn.


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Hi,

Starting to get into this - some fantastic community work and support. I am very interested in the RANGE concept and have read and watched the videos. Is the mission in the video available anywhere to examine/use??

 

 

Thanks

Scott

Link to comment
Share on other sites

So I just got into MOOSE a little bit and set up a simple GCI test mission modded a little from the example mission "AID-013 - AI_A2A - Intercept Test".

 

Now when/if friendly CAP reaches the airbase where RED GCI spawns, they will engage them on the ground. Now I got 2 damaged and idle (pilots standing outside aircraft) red GCI aircraft blocking the taxiway.

 

Is there a built in function to handle these situations, like "if standing still and not taking off for xx seconds then despawn"?

 

EDIT: I found the CLEANUP_AIRBASE class but I don't want to disable blue AI engaging anything around the airbase. I just want to remove spawned AI aircraft that has not moved for a certain amount of time since spawn.

 

 

 

Can you share your script ? Would help me out.

 

Thanks.

 

 

Sent from my iPhone using Tapatalk

Oculus CV1, Odyssey, Pimax 5k+ (i5 8400, 24gb ddr4 3000mhz, 1080Ti OC )

 

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Instead of this -

local AH64 = RAT:New("RAT_AH64")

AH64:SetCoalition("sameonly")

AH64:Spawn()

 

 

Would this be advisable -

 

local AH64 = RAT:New("RAT_AH64"):SetCoalition("sameonly")

AH64:Spawn()

 

or even

 

local AH64 = RAT:New("RAT_AH64")

AH64:Spawn():SetCoalition("sameonly")

 

End goal - Trying to tighten my code up. This, above, isn't big, regardless of the three chosen, but, when using the 1st one (which is how my script is), and I have a LOT of aircraft, I see a LOT of wasted space, just in the :SetCoalition() section (needless to say every other section).

 

As I learn things, I like to spell them out, step by step, but once I start getting them down, I like to make it smaller and smaller, executing only exactly what's needed.

 

And I posted this here instead of in the RAT area because it's more a LUA/MOOSE question than it is a RAT question, I was just using that as my sampe

B. "Swany" Swanberg

Gigabyte Designare, Intel i9 9900KF (3.6, OC'd to 5.0)

32GB Patriot Viper Steel (black, non-RGB)

OS installed on a Samsung Evo 970 1TB SSD

DCS installed on a Samsun Evo 860 1TB SSD

EVGA 2080Ti 11GB

EVGA Supernova 720p 750w PS

3 Dell S2716DG monitors in Surround mode (7680x1440)

Oculus Rift S VR

Thrustmaster Warthog Throttle and Stick

Thrusmaster Rudder Pedals

assorted button boxes/Arduino boards

All drivers always kept up to date (30 days old, max)

Link to comment
Share on other sites

Can moose be used Persian Gulf?

 

Since AIRBASE has .Caucasus .NTTR and .Normandy I tried using the line

 

A2ADispatcher:SetSquadron( "HDR", AIRBASE:FindByName('Havadarya'), { "RED GCI MIG-23" } )

 

but MOOSE throws error "attempt to concatenate local 'AirbaseName' (a table value)" in the DCS.log

 

Help!

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Can moose be used Persian Gulf?

 

Since AIRBASE has .Caucasus .NTTR and .Normandy I tried using the line

 

A2ADispatcher:SetSquadron( "HDR", AIRBASE:FindByName('Havadarya'), { "RED GCI MIG-23" } )

 

but MOOSE throws error "attempt to concatenate local 'AirbaseName' (a table value)" in the DCS.log

 

Help!

Needs to be integrated in Moose, I guess.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

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

Swany, IMO, the coding style is kind of subjective; it will depend on how do you like it most. The first example takes more lines to write, but is easier to follow if you want to debug or analyse the code. The third one is more compact, takes less lines; in a more complex code, this style will require less CPU and/or memory, but, if you get an error, it will be more difficult to read it and follow the logic.

 

Take this code I used in a mission as an example

ZonaEstaticos01 = ZONE:New("ZonaEstaticos01")
PointVecZ01 = ZonaEstaticos01:GetPointVec2()
PosX1 = PointVecZ01:GetX()
PosY1 = PointVecZ01:GetY()

 

I could make it smaller and use less variables, like this

PosX1 = ZONE:New("ZonaEstaticos01")PointVecZ01:GetPointVec2():GetX()
PosY1 = ZONE:New("ZonaEstaticos01")PointVecZ01:GetPointVec2():GetY()

 

As you can see, I reduced the code from 4 lines to 2, and 4 variables to 2, so it has a better performance and less use of memory, but is harder to understand and debug in case of problems


Edited by ECV56_Polten
correcting a typo

Intel i5-7600K @3,80 (4,9 OC) + Corsair Vengeance 16GB DDR4@3200 XMP 2.0 + Cooler Master Hyper 212 LED + Asus MAXIMUS IX HERO + Thermaltake Chaser A31 Snow Edition

Geforce RTX 2060 6GB

SSD Samsung 850 EVO 500GB + HDD WDC WD500 500GB

Saitek X-52 Pro & Thrustmaster T.Flight Rudder Pedals & TrackIR 5 & Kingston HyperX Alloy FPS

Oh, yeah, also the Sony PlayStation 4 :happy:

Link to comment
Share on other sites

Instead of this -

local AH64 = RAT:New("RAT_AH64")
AH64:SetCoalition("sameonly")
AH64:Spawn()

Would this be advisable -

local AH64 = RAT:New("RAT_AH64"):SetCoalition("sameonly")
AH64:Spawn()

Advisable... maybe. Depends on how you can read your code better :) Is it possible - no, not yet!

In the next version of RAT it will be :) In other MOOSE routines you can already do it. Depends if the self object of the class is returned by that function or not.

or even

local AH64 = RAT:New("RAT_AH64")
AH64:Spawn():SetCoalition("sameonly")

A big, red NO ;)

All API functions which define parameters need to come before the Spawn() call. Otherwise things can - they must not, but can - go terribly wrong.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Ok, I didn't think so on the last one ;) and I didn't realize it wasn't available in RAT yet. I made the assumption that because it was within MOOSE it could already do that.

 

My RAT file is huge with little one line code and was just hoping to tighten it up, kind of define everything in one shot/on one line ;)

 

Once again appreciate the help (and the RAT!)

B. "Swany" Swanberg

Gigabyte Designare, Intel i9 9900KF (3.6, OC'd to 5.0)

32GB Patriot Viper Steel (black, non-RGB)

OS installed on a Samsung Evo 970 1TB SSD

DCS installed on a Samsun Evo 860 1TB SSD

EVGA 2080Ti 11GB

EVGA Supernova 720p 750w PS

3 Dell S2716DG monitors in Surround mode (7680x1440)

Oculus Rift S VR

Thrustmaster Warthog Throttle and Stick

Thrusmaster Rudder Pedals

assorted button boxes/Arduino boards

All drivers always kept up to date (30 days old, max)

Link to comment
Share on other sites

Just use “airbasename” where airbasename is the exact name of the airbase on the f10 map screen.

 

 

Sent from my iPhone using Tapatalk

 

Thats what I'm doing isn't it?

 

A2ADispatcher:SetSquadron( "HDR", AIRBASE:FindByName('[b]Havadarya[/b]'), { "RED GCI MIG-23" } )

 

Edit: Nevermind, I just got what you meant. Changed it to this works:

 

A2ADispatcher:SetSquadron( "HDR", 'Havadarya', { "RED GCI MIG-23" } )


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

MOOSE - Mission Object Oriented Scripting Framework

 

Thats what I'm doing isn't it?

 

 

 

A2ADispatcher:SetSquadron( "HDR", AIRBASE:FindByName('[b]Havadarya[/b]'), { "RED GCI MIG-23" } )

 

 

 

A2ADispatcher:SetSquadron(“HDR”,”Havadarya”, and the rest

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

A2ADispatcher:SetSquadron(“HDR”,”Havadarya”, and the rest

 

 

Sent from my iPhone using Tapatalk

 

Yeah, I got it (see edit) but thanks!

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

As you can see, I reduced the code from 4 lines to 2, and 4 variables to 2, so it has a better performance and less use of memory, but is harder to understand and debug in case of problems

 

 

Which is kind of what I was after, but I see your point. Your first example I read once and got it, your second I had to re-read it because I thought it was wrong but see where it's right, and also see your point ;)

 

Pick your battles is what it boils down to ;) Appreciate the advice!

B. "Swany" Swanberg

Gigabyte Designare, Intel i9 9900KF (3.6, OC'd to 5.0)

32GB Patriot Viper Steel (black, non-RGB)

OS installed on a Samsung Evo 970 1TB SSD

DCS installed on a Samsun Evo 860 1TB SSD

EVGA 2080Ti 11GB

EVGA Supernova 720p 750w PS

3 Dell S2716DG monitors in Surround mode (7680x1440)

Oculus Rift S VR

Thrustmaster Warthog Throttle and Stick

Thrusmaster Rudder Pedals

assorted button boxes/Arduino boards

All drivers always kept up to date (30 days old, max)

Link to comment
Share on other sites

Can anyone shed some light over what "A2ADispatcher:SetIntercept( number )" does?

 

I'd like to have a certain interval where GCI would spawn.

As it is "by default", the GCI logic "replenishes" up to the overhead value right away when an active GCI is shot down, if the GCI target is still detected.

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Your first example I read once and got it, your second I had to re-read it because I thought it was wrong

 

Well, as a matter of fact, it is wrong, I fogot a ":" between ("ZonaEstaticos01") and PointVecZ01, the correct one wold be

 

PosX1 = ZONE:New("ZonaEstaticos01"):PointVecZ01:GetPointVec2():GetX()
PosY1 = ZONE:New("ZonaEstaticos01"):PointVecZ01:GetPointVec2():GetY()


Edited by ECV56_Polten
Typo

Intel i5-7600K @3,80 (4,9 OC) + Corsair Vengeance 16GB DDR4@3200 XMP 2.0 + Cooler Master Hyper 212 LED + Asus MAXIMUS IX HERO + Thermaltake Chaser A31 Snow Edition

Geforce RTX 2060 6GB

SSD Samsung 850 EVO 500GB + HDD WDC WD500 500GB

Saitek X-52 Pro & Thrustmaster T.Flight Rudder Pedals & TrackIR 5 & Kingston HyperX Alloy FPS

Oh, yeah, also the Sony PlayStation 4 :happy:

Link to comment
Share on other sites

Can anyone shed some light over what "A2ADispatcher:SetIntercept( number )" does?

 

I'd like to have a certain interval where GCI would spawn.

As it is "by default", the GCI logic "replenishes" up to the overhead value right away when an active GCI is shot down, if the GCI target is still detected.

 

 

 

I’m pretty sure that’s the number in seconds the a2a dispatcher uses to determine where the detected target will be based on its speed and direction. It then decides which airfield to launch the gci intercept from based on that projected location.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

I’m pretty sure that’s the number in seconds the a2a dispatcher uses to determine where the detected target will be based on its speed and direction. It then decides which airfield to launch the gci intercept from based on that projected location.

 

 

Sent from my iPhone using Tapatalk

 

Ahah! Thanks! You don't have knowledge about the "spawn delay" I'm asking about? :)

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Hi all,

I am trying to setup Eclipse but damm it is testing my skills allready. I think I finally got it where the map 'Moose Development' is noted as a source. When I press ok I got five errors about 'Build Modules' with the following java error: An internal error occurred during: "Build Modules".

java.lang.ArrayIndexOutOfBoundsException

 

SOS...SOS...Iceberg

Link to comment
Share on other sites

Hi all,

I am trying to setup Eclipse but damm it is testing my skills allready. I think I finally got it where the map 'Moose Development' is noted as a source. When I press ok I got five errors about 'Build Modules' with the following java error: An internal error occurred during: "Build Modules".

java.lang.ArrayIndexOutOfBoundsException

 

SOS...SOS...Iceberg

 

 

Same problem I have. Help appreciated.

My Rig: AMD Ryzen 9 3950X | 64GB DDR4-3200 Ram | NVIDIA GeForce RTX 2080 Ti | Thrustmaster Hotas Warthog | MFG Crosswind rudder pedals | HP Reverb

Link to comment
Share on other sites

Fixed in Dev, it's due to the changes in DCS with finding parking spots. DCS added a method to obtain a free parking spot and we updated dev branch to use it. It's mainly been written by FunkyFranky who authored the RAT module and had a lot of problems here.

 

 

In the dev branch the aircraft will still take off airborne if they dont have a valid parking spot (eg you get a C130 to try take off from parking at a small airbase, or other more obvious problems liek them being full) But this avoids the issue with Spawn happening on runways that DCS introduced in 2.4 or 5.

 

 

Please help :)

 

I try to use simple intercept script:

 

So far red planes spawn if Blue side plane is seen in ewr radar. This works.

 

But no mater what i do i cant get those alert intercept planes to start from ramp in airbase, they always spawn air.

 

Can someone show me custom script for this.

 

All i need is ground alert intercept : when Blue plane is spotted in ewr radar > spawn red fighter ramp hot > takeoff and intercept and return base after that.

 

Thanks

 

 

Im bit lost

 

 

I load moose first. Here is my gai file that i load after moose:

 

A2ADispatcher:SetSquadronTakeoffFromParkingHot( "SQUADRON Red" ) > this wont work. Planes wont spawn land or air, if i delete this planes spawn air.

GCICAP_Red = AI_A2A_GCICAP:New( "EWR Red", "SQUADRON Red" ) > this part works fine.

 

 

Yes, its simple but i try to learn and make it simple as possible.

 

 

Help please :)

 

Sent from my iPhone using Tapatalk

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Unless you guys are wanting to immediately update and sync from the Dev branch and contribute to coding at your desktop using Github desktop, then setting up LDT has very little gains for all the effort. Just download moose, get notepad and write something. Too many people hung up on this and it's killing new uptake. This was designed this way as a dev environment so more people could contribute to the codebase, but there's only a handful of people that actually do that.

 

Hi all,

I am trying to setup Eclipse but damm it is testing my skills allready. I think I finally got it where the map 'Moose Development' is noted as a source. When I press ok I got five errors about 'Build Modules' with the following java error: An internal error occurred during: "Build Modules".

java.lang.ArrayIndexOutOfBoundsException

 

SOS...SOS...Iceberg

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Hi all,

I am trying to setup Eclipse but damm it is testing my skills allready. I think I finally got it where the map 'Moose Development' is noted as a source. When I press ok I got five errors about 'Build Modules' with the following java error: An internal error occurred during: "Build Modules".

java.lang.ArrayIndexOutOfBoundsException

SOS...SOS...Iceberg

Could be an incompatibility between the Java version and the LDT version. Which Java and LDT versions do you use?

I have Java 8 Update 131 and LDT 1.4.1. You might want to try LDT 1.4.2RC2 for newer Java. Just an idea...

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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