zodd 14 Posted December 25, 2013 Gday all, I am displaying something using cutRSC (toggle-able HUD style) however I have a problem: I need it to remain displayed until it is toggled off - In the display variable in the hpp file I tried putting -1 in the hope that would be indefinite but alas I was wrong! I have a 0.1 second loop updating aspects including switching the display as required so my current workaround has the duration of each set to 0.1. The issue with this is sometimes it flickers (Assuming because technically the image is displaying for 0.1 seconds then turning off, then turning on again in the same frame?) It doesnt flicker all the time, only every now and then... 1. Is there a workaround to stop the flickering? 2. Is there a way to have it display indefinitely until another option is selected or it is toggled off? (Apart from setting the duration to 999999999 or something?) Cheers! Share this post Link to post Share on other sites
tryteyker 28 Posted December 25, 2013 Can you post the dialogs.hpp file please? Share this post Link to post Share on other sites
dr_strangepete 6 Posted December 25, 2013 try waitUntil, it executes it's loop once a frame. that might help the overlap you're getting using a short duration sleep Share this post Link to post Share on other sites
zodd 14 Posted December 26, 2013 dialog extract: class Slide1 { idd = -1; movingEnable = true; onLoad = ""; controlsBackground[] = {}; objects[] = {}; controls[] = {"sOne"}; fadeout=0; fadein=0; duration = 0.1; class sOne { idc = -1; type = 0; style = 48; colorText[] = {1, 1, 1,1}; colorBackground[] = {0, 0, 0, 0}; font = "puristaMedium"; sizeEx = 0.023; moving = true; x = safezoneX+0.05; y = safezoneY+0.25; w = 0.07; h = 0.4; text = "Images\Slide1.paa"; }; }; Script calling it: while {_caller getVariable ["ZOD_DISPLAY", false]} do { _oldPosition = _newPosition; _newPosition = position _caller; _distanceTravelledThisLoop = _oldPosition distance _newPosition; _distanceTravelled = _distanceTravelled + _distanceTravelledThisLoop; if (_distanceTravelled > (_caller getVariable ["ZOD_DISTANCE", 100])) then { _distanceTravelled = _distanceTravelled - (_caller getVariable ["ZOD_BEAD_DISTANCE", 100]); [_caller] execVM "next.sqf"; }; _beadToShow = format ["%1%2", ZOD_FILE_PREFIX, (_caller getVariable ["ZOD_CURRENT_IMAGE", 1])]; 7 cutRsc [_beadToShow,"PLAIN", 0, false]; sleep 0.1; }; Share this post Link to post Share on other sites
iceman77 19 Posted December 26, 2013 (edited) You need to create the resource before the loop. To have the resource stay on the screen I always use duration = 1e+1000; If you ever need to hide the resource while the script is running you could always make it transparent. Regards, Iceman77 ---------- Post added at 00:54 ---------- Previous post was at 00:23 ---------- Also, you could use a "onKeyDown" eventhandler to toggle the UI on & off. Edited December 26, 2013 by Iceman77 Share this post Link to post Share on other sites
zodd 14 Posted December 28, 2013 (edited) Iceman - just realised what you mean by creating the resource - once it has been loaded once, there is no flickering! What is the best way to do that? cycle once through all resources then clear it by displaying default until it is needed? edit: Managed to make it work by including this in the init: _layer = player getVariable ["ZOD_NAV_PACE_COUNTER_LAYER", 7]; for [{_imageNumber = 1}, {_imageNumber < 61}, {_imageNumber = _imageNumber+1}] do { _beadToShow = format ["%1%2", ZOD_NAV_PACE_COUNTER_FILE_PREFIX, (_imageNumber)]; _layer cutRsc [_beadToShow,"PLAIN", 0, false]; sleep 0.005; }; _layer cutRsc ["Default","PLAIN", 0, false]; Pretty hacky I think and the downside is it displays the images as the player loads... other workarounds? Edited December 28, 2013 by Zodd Share this post Link to post Share on other sites