Difference between revisions of "hint"

From Bohemia Interactive Community
Jump to navigation Jump to search
(if it doesnt work no point bringing it up)
 
(45 intermediate revisions by 24 users not shown)
Line 1: Line 1:
back to [[Scripting_Reference#H|COMREF]]
+
{{Command|Comments=
 +
____________________________________________________________________________________________
  
<h2 style="color:#000066"> '''hint ''text'''''</h2>
+
| ofp |Game name=
  
 +
|1.00|Game version=
  
'''Operand types:'''
+
|eff= local |Effects in MP=
 +
____________________________________________________________________________________________
  
'''text:''' [[String]]
+
| Outputs a hint message to the right of the screen (left of the screen in {{ofp}}) with a sound (except in {{arma}}). Use [[hintSilent]] for soundless hint. To split message in multiple lines either use [[Structured Text]] or <tt>\n</tt> (in lower case).|DESCRIPTION=
 +
____________________________________________________________________________________________
  
'''Type of returned value:'''
+
| [[hint]] message |SYNTAX=
  
[[Nothing]]
+
|p1=  message: [[String]] or [[Structured Text]] - the message to display. |PARAMETER1=
  
'''Description:'''
+
| [[Nothing]] |RETURNVALUE=
 +
____________________________________________________________________________________________
 +
 
 +
|x1= <code>{{codecomment|// outputs the following:
 +
// Press W to move forward.
 +
// Press S to move backwards.}}
 +
[[hint]] "Press W to move forward.\nPress S to move backwards."</code> |EXAMPLE1=
  
Show '''hint''' text.
+
|x2= <code>[[hint]] [[format]] ["Hello, %1!", [[name]] [[player]]];</code> |Example2=
  
Text can contain several lines.
+
|x3= <code>[[hint]] [[str]] [[count]] [[allPlayers]];
 +
[[sleep]] 10;
 +
[[hintSilent]] ""; {{codecomment|// hides the previous hint display}}</code> |Example3=
  
An '''\n''' is used to indicate a new line.
+
|x4= <code>[[hint]] [[parseText]] "<t size='2.0'>Large text</t>";{{codecomment|// Displays text twice as large as the default one}}</code>|Example4=
 +
____________________________________________________________________________________________
  
 +
|pr= {{GVI|ofp|1.00}} {{GVI|arma|1.00}} {{GVI|arma2|1.00}} Hint messages that exceed the screen may lead to crashes.<br>
 +
{{GVI|arma3|1.00}} The game would not crash but suffer FPS drop / temporary freezing. |Problem=
  
'''Examples:'''
+
| [[hintC]], [[hintCadet]], [[hintSilent]], [[diag_log]] |SEEALSO=
 +
}}
  
'''hint''' "Press W to move forward"
+
<h3 style="display:none">Notes</h3>
 +
<dl class="command_description">
  
'''hint''' "Press W to move forward. '''\n'''Press S to move backwards. '''\n'''Use the mouse to turn right or left."
+
<dd class="notedate">Posted on October 20, 2014 - 19:27 (UTC)</dd>
 +
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
 +
<dd class="note">
 +
Be careful when using hints to visualize the effects of commands using the Debug Console. Hint can accept an undefined variable and neither the error nor the hint is shown, the command simply fails. Also notice how the hint command should be {{Inline code|[[hint]] [[str]] _i;}}:
 +
<code>[[for]] "_i" [[from]] 0 [[to]] 50 [[do]] {
 +
[[hint]] _i;
 +
};</code>
 +
'''tested in A3 1.32.127785'''<br>
 +
<br>
 +
In a script, an "undefined variable" error will be shown as expected.
 +
</dd>
 +
 
 +
<dd class="notedate">Posted on October 21, 2014 - 23:07 (UTC)</dd>
 +
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
 +
<dd class="note">
 +
Contrary to previous games, Arma 3 will happily display hints that far exceed screen space.<br>
 +
However, as hints get longer, FPS suffers tremendously.<br>
 +
'''tested in Debug Console, A3 1.32.127785 with the following:'''
 +
<code>[[hint]] [[str]] (([[nearestObjects]] <nowiki>[</nowiki>[[player]], ["BUILDING"],  100]) - <nowiki>[</nowiki>[[player]]]); [] [[spawn]] { [[sleep]] 5; [[systemChat]] [[str]] [[diag_fps]]; };
 +
[[sleep]] 10;
 +
[[hint]] [[str]] (([[nearestObjects]] <nowiki>[</nowiki>[[player]], ["BUILDING"], 1000]) - <nowiki>[</nowiki>[[player]]]); [] [[spawn]] { [[sleep]] 5; [[systemChat]] [[str]] [[diag_fps]]; };</code>
 +
Results were: '''59.7015''' and '''5.17297''', respectively. Drawing a hint even longer than this, such as [[nearestObjects]] with a radius of 10,000 or 100,000 reduces your FPS so much Arma 3 '''appears''' to crash, though it doesn't.<br>
 +
<br>
 +
Unrelated: Hints will stay on screen for 30 seconds, then fade away over the course of 5 seconds. '''Tested with: A3 1.32.127785'''
 +
</dd>
 +
 
 +
<dd class="notedate">Posted on February 17, 2015 - 23:14 (UTC)</dd>
 +
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
 +
<dd class="note">
 +
An open dialog will pause the 30-second hint fade timer.
 +
'''(A3 1.38.128937)'''
 +
</dd>
 +
 
 +
<dd class="notedate">Posted on March 25, 2017 - 20:47 (UTC)</dd>
 +
<dt class="note">[[User:Feint|Feint]]</dt>
 +
<dd class="note">
 +
The [[hint]] sound is audible only when you have the music volume turned up above 0 in the audio settings.
 +
Otherwise, it seems to act the same as [[hintSilent]].<br>
 +
<br>
 +
This is important because if you are running a [[hint]] that fires at 30 fps or more, the [[hint]] will slow down machines that have the music volume turned up but won't slow down machines that have the music volume turned off.<br>
 +
<br>
 +
Best practice is to use [[hint]] for an alert to the player and use [[hintSilent]] for a makeshift display of data to the player that is updated fairly often.
 +
</dd>
 +
</dl>
 +
 
 +
<h3 style="display:none">Bottom Section</h3>
 +
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
 +
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]]

Latest revision as of 16:36, 6 August 2019

Introduced with Operation Flashpoint version1.00
  Effects of this scripting command are not broadcasted over the network and remain local to the client the command is executed on

Click on the images for descriptions

Introduced in

Game:
Operation Flashpoint
Version:
1.00

Description

Description:
Outputs a hint message to the right of the screen (left of the screen in Operation Flashpoint) with a sound (except in Armed Assault). Use hintSilent for soundless hint. To split message in multiple lines either use Structured Text or \n (in lower case).

Syntax

Syntax:
hint message
Parameters:
message: String or Structured Text - the message to display.
Return Value:
Nothing

Examples

Example 1:
// outputs the following: // Press W to move forward. // Press S to move backwards. hint "Press W to move forward.\nPress S to move backwards."
Example 2:
hint format ["Hello, %1!", name player];
Example 3:
hint str count allPlayers; sleep 10; hintSilent ""; // hides the previous hint display
Example 4:
hint parseText "<t size='2.0'>Large text</t>";// Displays text twice as large as the default one

Additional Information

Multiplayer:
-
Problems:
Introduced with Operation Flashpoint version1.00
Introduced with Armed Assault version1.00
Introduced with Arma 2 version1.00
Hint messages that exceed the screen may lead to crashes.
Introduced with Arma 3 version1.00
The game would not crash but suffer FPS drop / temporary freezing.
See also:
hintChintCadethintSilentdiag_log

Notes

Only post proven facts here. Report bugs on the feedback tracker. Use the talk page or the forums for discussions.
Add New Note | How To

Notes

Posted on October 20, 2014 - 19:27 (UTC)
DreadedEntity
Be careful when using hints to visualize the effects of commands using the Debug Console. Hint can accept an undefined variable and neither the error nor the hint is shown, the command simply fails. Also notice how the hint command should be hint str _i;: for "_i" from 0 to 50 do { hint _i; }; tested in A3 1.32.127785

In a script, an "undefined variable" error will be shown as expected.
Posted on October 21, 2014 - 23:07 (UTC)
DreadedEntity
Contrary to previous games, Arma 3 will happily display hints that far exceed screen space.
However, as hints get longer, FPS suffers tremendously.
tested in Debug Console, A3 1.32.127785 with the following: hint str ((nearestObjects [player, ["BUILDING"], 100]) - [player]); [] spawn { sleep 5; systemChat str diag_fps; }; sleep 10; hint str ((nearestObjects [player, ["BUILDING"], 1000]) - [player]); [] spawn { sleep 5; systemChat str diag_fps; }; Results were: 59.7015 and 5.17297, respectively. Drawing a hint even longer than this, such as nearestObjects with a radius of 10,000 or 100,000 reduces your FPS so much Arma 3 appears to crash, though it doesn't.

Unrelated: Hints will stay on screen for 30 seconds, then fade away over the course of 5 seconds. Tested with: A3 1.32.127785
Posted on February 17, 2015 - 23:14 (UTC)
DreadedEntity
An open dialog will pause the 30-second hint fade timer. (A3 1.38.128937)
Posted on March 25, 2017 - 20:47 (UTC)
Feint
The hint sound is audible only when you have the music volume turned up above 0 in the audio settings. Otherwise, it seems to act the same as hintSilent.

This is important because if you are running a hint that fires at 30 fps or more, the hint will slow down machines that have the music volume turned up but won't slow down machines that have the music volume turned off.

Best practice is to use hint for an alert to the player and use hintSilent for a makeshift display of data to the player that is updated fairly often.

Bottom Section