imported>Cdcooley |
imported>Qazaaq |
Line 1: |
Line 1: |
| [[Category:Scripting]]
| |
| [[Category:Papyrus]]
| |
| [[Category:Latent Functions]]
| |
| '''Member of:''' [[Message Script]] | | '''Member of:''' [[Message Script]] |
|
| |
|
Line 52: |
Line 49: |
| </source> | | </source> |
|
| |
|
| == Notes ==
| | {{Template:Message Text}} |
| To designate where to put the numbers in the message in the editor, the following format is used:
| |
| %[flags][width][.precision]f
| |
|
| |
|
| If you want the message to contain a % sign, then you must use a double % sign like so:
| | == See Also == |
| %%
| | *[[Message Script]] |
|
| |
|
| === Flags ===
| |
| Flags is one or more of the following characters:
| |
| {|border="1" cellpadding="5" cellspacing="0"
| |
| |-
| |
| ! style="background:#efefef;" | Character
| |
| ! style="background:#efefef;" | Meaning
| |
| ! style="background:#efefef;" | Default
| |
| |-
| |
| |<nowiki>-</nowiki>
| |
| |Left-align the number
| |
| |Right-align the number
| |
| |-
| |
| |<nowiki>+</nowiki>
| |
| |Prefix the number with a + or - sign
| |
| |Prefix only negative numbers with a - sign
| |
| |-
| |
| |<nowiki>0</nowiki>
| |
| |If width is prefixed with a 0, 0s are added until the minimum width is reached. If both 0 and – flags appear, the 0 is ignored.
| |
| |No padding is used
| |
| |-
| |
| |<nowiki><Space></nowiki>
| |
| |Prefix the value with a space if the output value is signed and positive. This flag is ignored if both the space and + flags appear.
| |
| |No space appears
| |
| |-
| |
| |<nowiki>#</nowiki>
| |
| |Forces the number to have a decimal point.
| |
| |Decimal point appears only if numbers follow it.
| |
| |}
| |
|
| |
|
| ===Width===
| | [[Category:Scripting]] |
| This is an optional number that specifies the minimum number of characters to output. This includes the sign character (+ or -) and the decimal point, if any.
| | [[Category:Papyrus]] |
| | | [[Category:Latent Functions]] |
| ===Precision===
| |
| This value specifies the number of digits after the decimal point. If a decimal point appears, there is always at least one digit before it. The value is rounded to the appropriate number of digits.
| |
| | |
| The default precision is 6. If precision is 0, or if the period appears without a number following it, no decimal point is printed.
| |
| | |
| ===Examples===
| |
| Values:
| |
| 5
| |
| 1.1
| |
| -0.523456745
| |
| | |
| "%f" results in:
| |
| 5.0
| |
| 1.1
| |
| -0.523457
| |
| | |
| "%.0f" results in:
| |
| 5
| |
| 1
| |
| -1
| |
| | |
| "%+05f" results in:
| |
| +0005
| |
| +01.1
| |
| -0.523457
| |
| | |
| "%10.2f" results in:
| |
| 5.00
| |
| 1.10
| |
| -0.52
| |
| | |
| == See Also ==
| |
| *[[Message Script]]
| |