chromium Posted July 20, 2020 Posted July 20, 2020 Hi everyone, I'm looking for a way to create kneeboard size .jpg image (or .pdf) starting from a lua text string. Is there a way to do so w/o having to install any software or addition? Thanks! Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
dcs76 Posted June 15, 2021 Posted June 15, 2021 (edited) Create lua file inside kneeboard folder. Call it 1.lua and it will show up as first kneeboard page. Now you can write lua stuff to output your text on the kneeboard page: dofile(LockOn_Options.common_script_path.."elements_defs.lua") local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 0, 0, 0, 255 }) local txt = CreateElement "ceStringPoly" txt.value = "My text" txt.material = FONT txt.init_pos = { h_center, v_center } txt.alignment = "CenterCenter" txt.stringdefs = { 0.005, 0.0013, 0, 0 } txt.use_mipfilter = true txt.h_clip_relation = h_clip_relations.COMPARE txt.level = DEFAULT_LEVEL Add(txt) Define h_center and v_center with the position you want the text to appear on the kneeboard page. Edited June 15, 2021 by dcs76
dcs76 Posted June 16, 2021 Posted June 16, 2021 Yes, sure. Like this: local imageMaterial = MakeMaterial(path, { 255, 255, 255, 255 }) local back = CreateElement "ceTexPoly" back.name = create_guid_string() back.material = imageMaterial back.init_pos = { x - 1, GetAspect() - y } back.vertices = { { 0, 0 }, { width, 0 }, { width, -height }, { 0, -height } } back.indices = { 0, 1, 2; 0, 2, 3 } back.tex_coords = texture_box(0, 0, 1, 1) back.h_clip_relation = h_clip_relations.COMPARE back.level = DEFAULT_LEVEL Add(back) This basically defines two triangles building a rectangle. The texture(material) of that rectangle is the picture loaded from "path". You need to define x, y, width and height to define where the rectangle/image should be drawn inside of the kneeboard page.
sunski34 Posted June 17, 2021 Posted June 17, 2021 very cool thanks, so path is one path in computer like "D:\...\image.png" ? Another question, is it possible to link that lua file with one mission script lua file to put some dynamic variables depending of the mission and insert new pages during the mission ?
sunski34 Posted June 20, 2021 Posted June 20, 2021 (edited) Hi, I tried the single message text, add 1.lua file in F18 KNEEBOARD. I see a new page but empty, no background no text ! I remplaced txt.init_pos = { h_center, v_center } with txt.init_pos = { 0, 0} et set local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 0, 0, 0, 255 }) with local FONT = MakeFont({ used_DXUnicodeFontData = "font_dejavu_lgc_sans_condensed_17" }, { 255,255,255, 255 }) And no change ! Help ! Edited June 20, 2021 by sunski34
Recommended Posts