Keep Getting a script error when running MIST script - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 08-14-2020, 07:01 AM   #1
RTS354
Junior Member
 
Join Date: May 2020
Posts: 23
Default Keep Getting a script error when running MIST script

I’m trying to get a MIST script running that can detect if map objects within a zone are destroyed. The script is a function call to:

mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1}

Note that the trigger zone I created is named "bridge1" and I'm using FLAG 1.

I know how to program in LUA, but I’m having issues with how the scripting works in the DCS mission editor. I’m assuming that if a FLAG is zero, it is considered FALSE. I am also assuming that FLAG (1) must be turned on and assigned a value of 0 before calling the “mist.flagFunc.mapobjs_dead_zones” function.

According to the MIST documentation this function sets FLAG (1) to TRUE if a map object the zone is destroyed. Here is the MIST documentation for this function:

Examples:

mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 51 } --[[Once run, this function will set flag 51 is set true if/when a map object has died/dies within the zone named "bridge1".]]

BUT I get the following error message when starting the mission:
[String"Mist.flagFunctin.mapobjs_dead{zones = {'bridge1'}, flag = 1}"]: attempt to index global mist' (A nil value)

Here are the triggers in the order they are to be executed:

Trigger1: Mission Start
Condition1: Time More(1)
Actions1: Do SCRIPT FILE (mist_4_3_74.lua)

Trigger2: ONCE (Create Bridge Zone Flags, NO EVENT)
Condition2: (NONE)
Actions2: FLAG ON(1) and then SET FLAG VALUE(1,0)

Trigger3: ONCE (Check Bridges, ON EVENT)
Condition3: FLAG IS FALSE (1)
Actions3: DO SCRIPT( mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1})

Trigger4: ONCE(Are Bridges Destroyed, NO EVENT)
Condition4: FLAG IS TRUE (1)
Actions4: MESSAGE TO COALITION (BLue, All Bridges are Destroyed, 30, false,0)

So what am I missing?
RTS354 is offline   Reply With Quote
Old 08-14-2020, 08:05 AM   #2
HC_Official
Member
 
Join Date: Nov 2018
Posts: 803
Default

is the MIST file loading correctly ? check dcs.log maybe ?
__________________
Click here for tutorials for using Virpil Hardware and Software


Click here for Virpil Flight equipment dimensions and pictures
.
HC_Official is offline   Reply With Quote
Old 08-14-2020, 12:18 PM   #3
pmiceli
Member
 
pmiceli's Avatar
 
Join Date: May 2016
Posts: 435
Default

Mission start does not require a condition. You can remove the time more(1)

Once does require a condition.

No need to turn on flag 1 and then turn it back off.



Here is what you need to do

Trigger1: Mission Start
Condition1: None
Actions1: Do SCRIPT FILE (mist_4_3_74.lua)

Trigger2: ONCE
Condition1: Time More(1)
Actions1: Do SCRIPT (mist.flagFunc.mapobjs_dead_zones{ zones = {'bridge1'}, flag = 1, }

Trigger3: ONCE(Are Bridges Destroyed, NO EVENT)
Condition3: FLAG IS TRUE (1)
Actions3: MESSAGE TO COALITION (BLue, All Bridges are Destroyed, 30, false,0)

This is assuming you have a trigger zone named 'bridge1' in the mission.
__________________
475th Fighter Group Discord https://discord.gg/xkKsApD

Last edited by pmiceli; 08-14-2020 at 12:32 PM.
pmiceli is offline   Reply With Quote
Old 08-14-2020, 06:50 PM   #4
RTS354
Junior Member
 
Join Date: May 2020
Posts: 23
Default

Pmiceli, thanks for the info. The script works perfectly now. Since I had to create the "bridge1" zone, I assumed I had to create the flag1 variable. I'm still confused to where the flag1 variable is created. I thought that the "flag = 1" partof the function was to pass the flag that I created, in this case, flag1 to the function call, and then the function call would flip it to true if a map object was destroyed in the "bridge1" zone.


Thanks again.
RTS354 is offline   Reply With Quote
Old 08-16-2020, 03:45 PM   #5
pmiceli
Member
 
pmiceli's Avatar
 
Join Date: May 2016
Posts: 435
Default

Quote:
Originally Posted by RTS354 View Post
Pmiceli, thanks for the info. The script works perfectly now. Since I had to create the "bridge1" zone, I assumed I had to create the flag1 variable. I'm still confused to where the flag1 variable is created. I thought that the "flag = 1" partof the function was to pass the flag that I created, in this case, flag1 to the function call, and then the function call would flip it to true if a map object was destroyed in the "bridge1" zone.


Thanks again.
You don't need to initialize any flags. They are assumed to be "Off" (Value = 0) until you assign another value.

However, in a complex mission, sometimes it is helpful to assign value of 0 to a flag to keep things straight.
__________________
475th Fighter Group Discord https://discord.gg/xkKsApD
pmiceli is offline   Reply With Quote
Old 08-18-2020, 05:31 AM   #6
RTS354
Junior Member
 
Join Date: May 2020
Posts: 23
Default

Thanks you all for the information.
RTS354 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:39 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.