Jump to content

Recommended Posts

Posted

can someone help me out with some lua code to print a flag value? All i need is code to print a score like "RED 3: BLUE 4" if flag 1=3 and flag 2=4 as an example.

ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 

"This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL

Posted (edited)
local redFlagValue = trigger.misc.getUserFlag("1")
local blueFlagValue = trigger.misc.getUserFlag("2")
local msg = string.format("RED: %i BLUE: %i", redFlagValue, blueFlagValue)
trigger.action.outText(msg, 10)

This will display the message for ten seconds to all players.

Edited by Chump
  • Like 2
Posted

Top notch man thanks!

ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 

"This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL

  • 4 years later...
Posted

Any idea if this still works.  I tried something similar and got an error.  Haven't' a clue if I made the error, or if things have changed.

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Posted
18 hours ago, AKA_Clutter said:

Any idea if this still works.  I tried something similar and got an error.  Haven't' a clue if I made the error, or if things have changed.

Sentence is correct.

You can also write it like this :

Spoiler

local redFlagValue = trigger.misc.getUserFlag("1")
local blueFlagValue = trigger.misc.getUserFlag("2")
trigger.action.outText('RED : ' .. redFlagValue .. ' BLUE : ' .. blueFlagValue, 10)

 

  • Recently Browsing   0 members

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