Jump to content
Sign in to follow this  
iceman77

TitleText in a loop

Recommended Posts

I was just curious if it's possible to use titletext in a loop without it "blinking"? Or maybe some sort of work around or other similar command? I prefer to use hint for other things, so I'd really like to use titletext instead. But it has a blinking effect because of the loop.

titleText [format["Containers Placed:%1 \n Mortars Placed:%2 ", _contCount,_mortCount], "PLAIN DOWN"];

Share this post


Link to post
Share on other sites

Yes, the titletext is in a loop, to show an object count. Everytime it loops around and runs the titletext, it makes a blinking effect. Unlike hint. Try it out.

init.sqf

_o=1;
while {(_o == 1)} do {titleText [format["Hello %1", player], "PLAIN DOWN"];sleep 1}

Share this post


Link to post
Share on other sites

Ok then try this

_o=1;while {(_o == 1)} do {titleText [format["Hello %1", player], "PLAIN DOWN",999999];}

That way the time is set to 999999 seconds so it wont blink so long as this isnt true for longer than 999999 seconds:cool:.

The default is usually 1 second which is why it was blinking.

~dcthehole

Edited by dcthehole
Removed sleep timer and explained

Share this post


Link to post
Share on other sites

Thanks, I'll give that a try

---------- Post added at 10:13 ---------- Previous post was at 10:01 ----------

if (isServer) then {titleText [format["Containers Placed:%1 \n Mortars Placed:%2 ", _contCount,_mortCount], "PLAIN DOWN",[color="#0000CD"]99999[/color]]};

Doesn't work. The message never shows up when I put a value.

Here's my script.

if (!isNil "preOpsDone") exitWith {};  

_h=1;
_contpos = getPos contTrig;
_mortpos = getPos mortTrig;

 waitUntil {!isNil "startOps"};

   if (isNil "preOpsDone") then {if ((isServer) && (isNil "hip")) then {[nil, nil, rHint, "Use the ural to transport the mortars and containers"] call RE} else {[nil, nil, rHint, "Use the helo to transport the mortars and containers"] call RE}};

sleep 10;


   while {(_h == 1)} do {


                         _contArray = nearestObjects [_contpos, ["Misc_cargo_cont_net1"], 25];
                         _contCount= "Misc_cargo_cont_net1" countType _contArray;
                         _mortArray = nearestObjects [_mortPos, ["M252_US_EP1"], 25];
                         _mortCount= "M252_US_EP1" countType _mortArray;

                         //hintSilent format ["<br/><t color='#f00000ff' size='1.5'>Containers Placed:</t><br/><t color='#f00000ff' size='1.5'>Mortars Placed:</t>%2", _contCount,_mortCount];
                         [color="#0000CD"]if (isServer) then {titleText [format["Containers Placed:%1 \n Mortars Placed:%2 ", _contCount,_mortCount], "PLAIN DOWN",99999]};[/color]
                         //_text = parseText format["<t color='#CC6600'>Containers Delivered:%1</t> <br/> <t color='#CC6600'>Mortars Delivered:%2</t>",_contCount,_mortCount];[nil,nil,rHINT,_text] call RE;

                         if ((count _mortArray == 1) && (isNil "mortDone")) then {if (isServer) then {mortDone=true;publicvariable "mortDone";[nil, nil, rTITLETEXT, "The mortars have been placed", "PLAIN", 0] call RE};deleteMarker "mortarM";deleteMarker "mortarM2"};
                         if ((count _contArray == 1) && (isNil "contDone")) then {if (isServer) then {contDone=true;publicvariable "contDone";[nil, nil, rTITLETEXT, "The containers have been placed", "PLAIN", 0] call RE};deleteMarker "containerM";deleteMarker "containerM2"};
                         if ((count _contArray == 1) && (count _mortArray == 1)) then {_h=0};

                         sleep 1;  

                        };

                         sleep 5;

                               if (_h == 0) exitWith {
                                                       phone setPos [getPos phone select 0, getPos phone select 1, 0];
                                                       sleep 1;
                                                       if (isServer) then {preOpsDone=true;publicVariable "preOpsDone";[nil, nil, rTITLETEXT, "All supplies are in place", "PLAIN", 0] call RE};
                                                       ["Task1","succeeded"] call SHK_Taskmaster_upd; 
                                                       sleep 1;
                                                       leader razor1 groupchat "Okay outpost1, we've setup the mortars and supply containers for the Americans.";
                                                       sleep 5;
                                                       if ((isNil "radarDead") && (isNil "uavHome")) then {com sidechat "Good work razor1, proceed with the primary objective"}; 
                                                       if ((!isNil "uavHome") && (isNil "radarDead")) then {com sidechat "It's about damn time. I bet you could have used some of that arty during the uav extraction"}; 
                                                       if ((!isNil "radarDead") && (isNil "uavHome")) then {com sidechat "It's about damn time. I bet you could have used some of that arty to neutralize that radar installation"}; 
                                                       if ((!isNil "radarDead") && (!isNil "uavHome")) then {com sidechat "It's about damn time."};
                                                       sleep 3;
                                                       if (isNil "hip") then {if (isServer) then {[nil, nil, rHint, "The primary objective is close enough, ground vehicles will be used for the mission.Use the ural to tow the UAV back to base"] call RE}} else {if (isServer) then {[nil, nil, rHint, "The primary objective is far away, air transport will be used for the mission.Use the MI-17 to attach the UAV and airlift it back to base"] call RE}}; 

                                                   }









Edited by Iceman77

Share this post


Link to post
Share on other sites

Just a note, the higher the value, the slower it is, since the value 99999 defines the speed at which it's appearing, the higher, the slower it is.

Did you try using titleText without any speed and just add a sleep of 0.5 or 1? NOPE, I never wrote that.

Just noticed you had a sleep at the end of your while loop.

//Edit:

It seems like having a value within titleText is irrelevant if you have a sleep value outside of that.

The sleep value overrides the titleText value, so for example having a titleText speed value of 6 will greatly slow down the appearance of titleText and automatically restart the process after 1 sec due to sleep.

So it seems like editing the sleep value seems like the only option, atleast as far as I can see.

Edited by tryteyker

Share this post


Link to post
Share on other sites

Yes, I understand what you mean about the time. I do remember a command awhile back that was kind of like fadeout which might work, but the only problem is I dont remember it.

And, Iceman I will further review this script for you.

**EDIT**: The command is "titleFadeOut".

_o=1;
while {(_o == 1)} do {titleText [format["Hello %1", player], "PLAIN DOWN"]; titleFadeOut 999999}

Edited by dcthehole
Added the command

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×