format: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
back to [[Scripting_Reference#F|COMREF]]
<h2 style="color:#000066">'''format ''format'''''</h2>
<h2 style="color:#000066">'''format ''format'''''</h2>


'''Operand types:'''
'''Operand types:'''


format: [[Array]]
'''format:''' [[Array]]


'''Type of returned value:'''
'''Type of returned value:'''
Line 12: Line 15:


First argument of array is the format string.
First argument of array is the format string.
Format string may contain references to following arguments in form %1, %2, etc.
 
Each %x is replaced by corresponding argument.
Format string may contain references to following arguments in form '''%1''', '''%2''', etc.
%x may appear in the format string in any order.
 
Each '''%x''' is replaced by the corresponding argument.
 
'''%x''' may appear in the format string in any order.
 


'''Examples:'''
'''Examples:'''


'''format''' ["%1 - %2 - %1", 1, "text"]
'''format''' ["'''%1''' - '''%2''' - '''%1'''", 1, "text"] ...... Result is "1 - text - 1"
 
Result is "1 - text - 1"


hint '''format''' ["%1", loon1 distance Tank1]
[[hint]] '''format''' ["'''%1'''", loon1 [[distance]] Tank1]


titletext ['''format''' ["Good morning, Captain %1.", name player], "plain", 1]
[[titletext]] ['''format''' ["Good morning, Captain '''%1'''.", [[name]] [[player]]], "plain", 1]

Revision as of 11:43, 16 April 2006

back to COMREF

format format


Operand types:

format: Array

Type of returned value:

String

Description:

First argument of array is the format string.

Format string may contain references to following arguments in form %1, %2, etc.

Each %x is replaced by the corresponding argument.

%x may appear in the format string in any order.


Examples:

format ["%1 - %2 - %1", 1, "text"] ...... Result is "1 - text - 1"

hint format ["%1", loon1 distance Tank1]

titletext [format ["Good morning, Captain %1.", name player], "plain", 1]