Jump to content

Recommended Posts

Posted

All i want to do is display the flag's in a message box.. Chrashes whenever i run it..

 

do

local x = trigger.misc.getUserFlag('3')

local y = trigger.misc.getUserFlag('4')

trigger.action.outText(x .. ' Score is now:

Red : ' .. y .. '

Blue : ' .. x .. '' , 20)

end

Posted

Okay i figured out it was cuz i had those line things.. this works:

do

local x = trigger.misc.getUserFlag('3')

local y = trigger.misc.getUserFlag('4')

trigger.action.outText(x .. ' Score is now: Red : ' .. y .. ' Blue : ' .. x .. '' , 20)

end

But i want it to go to the next line.. how?

Posted

OP, sorry I would like to ask which LUA version is DCS using.

 

 

Sent from my iPhone using Tapatalk

AWAITING ED NEW DAMAGE MODEL IMPLEMENTATION FOR WW2 BIRDS

 

Fat T is above, thin T is below. Long T is faster, Short T is slower. Open triangle is AWACS, closed triangle is your own sensors. Double dash is friendly, Single dash is enemy. Circle is friendly. Strobe is jammer. Strobe to dash is under 35 km. HDD is 7 times range key. Radar to 160 km, IRST to 10 km. Stay low, but never slow.

Posted
Using "\n" to stand for a newline:

 

trigger.action.outText(x .. ' Score is now:\nRed : ' .. y .. '\nBlue : ' .. x .. '' , 20)

 

Thank you!!

Posted

The way I do this is in the attached file towards the bottom.

Displaying Flag Values With Text Messages

Use a Do Script Action (does not require Mist) -
local msg = {}
msg[#msg + 1]='Blue All Points Flag 10000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('10000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Vehicles In Zone Points Flag 20000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('20000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Aircraft Points Flag 50000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('50000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Heli Points Flag 60000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('60000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Vehicle Points Flag 70000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('70000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Blue Ship Points Flag 80000 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('80000')
msg[#msg + 1]='. \n'
msg[#msg + 1]='\n'
msg[#msg + 1]='Press Pause to freeze the action. \n'
trigger.action.outText(table.concat(msg), 6)

 

WC

WC's mist examples.txt

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted

A bit fancier... this repeating message informs the players of their progress.

 

local msg = {}
msg[#msg + 1]='\n'
msg[#msg + 1]='Welcome to the Back Of The Hand mission!'
msg[#msg + 1]='\n'
msg[#msg + 1]='---'
msg[#msg + 1]='\n'

-- Blue Objectives
if trigger.misc.getUserFlag(30101) == 0 and trigger.misc.getUserFlag(30301) == 0 then 
msg[#msg + 1]='Blue objectives are to close the Roki Tunnel and destroy the Red Rocket Factory.'
msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(30101) == 1 and trigger.misc.getUserFlag(30301) == 0 then 
msg[#msg + 1]='The remaining Blue objective is the Red Rocket Factory.'
msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(30101) == 0 and trigger.misc.getUserFlag(30301) == 1 then 
msg[#msg + 1]='The Roki Tunnel remains open.  The remaining Blue objective is to close either the east or west entrance.'
msg[#msg + 1]='\n'
end

-- Roki tunnel closed 
if trigger.misc.getUserFlag(30101) == 1 then 
msg[#msg + 1]='The Roki Tunnel is closed.  Blue aircraft bombed the entrance.  No more Red forces will be coming down that highway.'
msg[#msg + 1]='\n'
msg[#msg + 1]='Closing the tunnel is a Blue mission objective.  Good work!'
msg[#msg + 1]='\n'
-- Roki tunnel damaged
-- east & west
elseif trigger.misc.getUserFlag(30116) == 1 and trigger.misc.getUserFlag(30136) == 1 then 
msg[#msg + 1]='Both entrances to the Roki Tunnel have been hit with bombs.  Blue aircraft must complete the destruction of the Roki Tunnel by closing one of the entrances.'
msg[#msg + 1]='\n'
-- east
elseif trigger.misc.getUserFlag(30116) == 1 then 
msg[#msg + 1]='The eastern Roki Tunnel is damaged.  Blue aircraft must complete the destruction of Roki Tunnel east.'
msg[#msg + 1]='\n'
-- west
elseif trigger.misc.getUserFlag(30136) == 1 then 
msg[#msg + 1]='The western Roki Tunnel is damaged.  Seal off the Roki Tunnel west!'
msg[#msg + 1]='\n'
end

-- Red rocket factory dead 
if trigger.misc.getUserFlag(30301) == 1 then 
msg[#msg + 1]='The Red Rocket Factory at Tskhinvali was destroyed by Blue.'
msg[#msg + 1]='\n'
msg[#msg + 1]='Good job Blue!  This is a mission objective.'
msg[#msg + 1]='\n'
-- Red rocket factory damaged
elseif trigger.misc.getUserFlag(30306) == 1 then 
msg[#msg + 1]='The Red Rocket Factory at Tskhinvali is damaged.  The factory is a mission objective.'
msg[#msg + 1]='\n'
end

msg[#msg + 1]='---'
msg[#msg + 1]='\n'

-- Red Win
-- Blue Aircraft Assembly Plant Dead 
if trigger.misc.getUserFlag(70201) == 1 then 
msg[#msg + 1]='The Blue Aircraft Assembly Plant at Soganlug Airbase was destroyed.'
msg[#msg + 1]='\n'
msg[#msg + 1]='Red forces accomplished their objective.  It is a sad day for the Blue Liberation Front.'
msg[#msg + 1]='\n'
-- Blue Aircraft Assembly Plant Damaged
elseif trigger.misc.getUserFlag(70206) == 1 then 
msg[#msg + 1]='Red objective: the Blue Aircraft Assembly Plant at Soganlug Airbase is damaged.'
msg[#msg + 1]='\n'
msg[#msg + 1]='Blue: Find the Smerch artillery west of Igoeti.  Save the aircraft assembly plant!'
msg[#msg + 1]='\n'
else
msg[#msg + 1]='The Red mission objective is to destroy the Aircraft Assembly Plant near Tbilisi Airport.'
msg[#msg + 1]='\n'
end

msg[#msg + 1]='---'
msg[#msg + 1]='\n'

-- civilian train
if trigger.misc.getUserFlag(70301) == 1 and trigger.misc.getUserFlag(30116) == 0 and trigger.misc.getUserFlag(30136) == 0 and trigger.misc.getUserFlag(30306) == 0 then 
msg[#msg + 1]='A civilian train was attacked near Gori by Red rocket forces.  Thirteen dead and dozens injured!'
msg[#msg + 1]='\n'
msg[#msg + 1]='A Blue Liberation Front spokesman promised retaliation for this "massacre of innocent civilians", and said Blue forces will attack the Red rocket factory at Tskhinvali.'
msg[#msg + 1]='\n'
msg[#msg + 1]='---'
msg[#msg + 1]='\n'
end

-- Gori outpost destroyed
if trigger.misc.getUserFlag(75301) == 1 and trigger.misc.getUserFlag(30116) == 0 and trigger.misc.getUserFlag(30136) == 0 and trigger.misc.getUserFlag(30306) == 0 then 
msg[#msg + 1]='The Blue outpost at Gori was destroyed.'
msg[#msg + 1]='\n'
msg[#msg + 1]='Watch for Red armor and artillery to move through Gori, towards the Blue aircraft plant at Soganlug.'
msg[#msg + 1]='\n'
msg[#msg + 1]='---'
msg[#msg + 1]='\n'
end

-- civilian aircraft
if trigger.misc.getUserFlag(31001) == 0 then -- BUK must be alive
if trigger.misc.getUserFlag(51001) == 1 then 
	msg[#msg + 1]='A civilian aircraft has crashed!  Witnesses describe seeing a missile plume just minutes before.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='The RDR denies any involvement in the downing of this aircraft.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='---'
	msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(51001) == 2 then 
	msg[#msg + 1]='Two civilian aircraft were destroyed!'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='The Blue Liberation Front reports that two of its regional civilian jets have crashed.  A missile attack has not been ruled out.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='---'
	msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(51001) == 3 then 
	msg[#msg + 1]='Three civilian aircraft are now reported to have crashed!'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='A crises has developed as Red forces are being blamed for the massacre of innocent civilian lives.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='---'
	msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(51001) == 4 then 
	msg[#msg + 1]='Four civilian aircraft were destroyed!  A lone Red BUK launcher is responsible.  Search south of Tskhinvali.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='Blue Liberation Front spokesmen have vowed to strike back against the RDR, saying that the Red rocket factory and the Roki tunnel are now primary objectives in the fighting.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='---'
	msg[#msg + 1]='\n'
elseif trigger.misc.getUserFlag(51001) == 5 then 
	msg[#msg + 1]='Five civilian aircraft have been destroyed!  This is outrageous.  Find that BUK launcher and kill it.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='The Red Democratic Republic continues to deny involvement in the destruction of civilian aricraft.  However, in a terse statement, the RDR says it will target the Blue aircraft assembly plant at Soganlug Airbase.'
	msg[#msg + 1]='\n'
	msg[#msg + 1]='---'
	msg[#msg + 1]='\n'
end
end

msg[#msg + 1]='I hope that you have enjoyed this Back Of The Hand mission - Wrecking Crew. \n'
trigger.action.outText(table.concat(msg), 20)

 

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted
Ian;2850999']DCS is using Lua 5.1 (the current version is 5.3), so refer to the 5.1-specific manual here:

 

https://www.lua.org/manual/5.1/

 

 

 

Thanks

 

 

Sent from my iPhone using Tapatalk

AWAITING ED NEW DAMAGE MODEL IMPLEMENTATION FOR WW2 BIRDS

 

Fat T is above, thin T is below. Long T is faster, Short T is slower. Open triangle is AWACS, closed triangle is your own sensors. Double dash is friendly, Single dash is enemy. Circle is friendly. Strobe is jammer. Strobe to dash is under 35 km. HDD is 7 times range key. Radar to 160 km, IRST to 10 km. Stay low, but never slow.

  • Recently Browsing   0 members

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