%[-][+][ ][#][0][width][.size][prefix]specifier
[-] Optional. Add the minus sign to make the value align to the left inside the width. The default alignment is to the right.
[+] Optional. If used with a specifier that works with signed numbers, the '+' sign will be put before positive numbers to show their positivity.
[ ] Optional. If used with a specifier that works with signed numbers, numbers outputted with no sign will have a space put before them.
[#] Optional. Octal numbers will be prefixed with a 0, and hex numbers will be prefixed with a 0x. When used with flex specifiers, a decimal point will always be outputted.
[0] Optional. When used, all of the width's digits to the left of the number will be ouputted as zeros instead of being left blank.
[width] Optional. This sets the minimum width for the concatenated value. All of the value's significant digits will be outputted though this may exceed the width.
[.size] Optional. For integer specifiers, this is the minimum size for the number. For flex specifiers (other than %g), this is the number of decimal digits to output (default of six). Size digits unused by the value will be outputted as zeros.
[prefix] Optional. This is a specifier prefix used to modify the output value type. These prefixes are of little use to Cog, because the concat verbs' parameters have set types. Refer to the chart below.
specifier This is the format specifier to use. The charts below show which specifiers are used by integers and flexes.
Specifier Prefixes | |||
---|---|---|---|
Prefix | Format | ||
l | Longint or double. | ||
L | Long double. | ||
h | Shortint. |
Integer Format Specifiers | |||
---|---|---|---|
Specifier | Format | ||
%c | ASCII character. | ||
%d | Signed decimal integer. | ||
%i | Signed decimal integer. | ||
%o | Unsigned octal integer. | ||
%u | Unsigned decimal integer. | ||
%x, %X | Unsigned hexadecimal integer. | ||
%% | '%' character. |
Flex Format Specifiers | |||
---|---|---|---|
Specifier | Format | ||
%e, %E | Signed decimal flex in scientific notation. | ||
%g, %G | Signed decimal flex in short form. | ||
%f | Signed decimal flex. |
Specifiers that are "unsigned" do not accept negative values. Using an unsigned specifier with a signed value will cause the engine to output meaningless numbers.
These format specifiers are from Visual C++, they are not part of Cog. Cog is able to use them because the concat verbs pass the string and argument to the VC++ engine.
In doing that, format specifiers lose some of the their functionality because Cog cannot pass more than
those two arguments. The above description of the syntax and use of the specifiers has been somewhat
simplified because the excluded information doesn't apply to Cog's use of the specifiers.
Concatenation
To concatenate is to link together. In Cog, concatenation refers to linking values together into a string that is printed with
jkStringOutput(). When you concatenate a value, JK adds it to the end of a stored string.
jkStringClear() clears the stored string for a new series of concatenations. Each computer has its
own concatenated string.
Here's an example of concat verbs in use:
jkStringClear(); jkStringConcatAsciiString("The number of players in this game is: "); jkStringConcatInt(GetNumPlayers()); jkStringOutput(-3, -1);Notice in that example that jkStringClear() is run before the concatenation. Even after the string has been outputted, it is still in memory. But because all concatenation code in cog clears the string before the concatenation, this will not cause problems.
The jkstrings.uni holds strings that will be used during normal gameplay in any level. Strings like "Using Bacta" and "Fists" are stored in this file. Cogstrings.uni is a level file that holds the strings that are to be used by an episode. "Locked!" and "This looks interesting!" come from the cogstrings of The Force Within.
In both of these files, strings are defined like this: "COG_x" 0 "string" - where x is the number of the string. It is this number that cog verbs use
to locate the string. If you give a verb the number to a string that does not exist, you'll see "COG_yourNum" print on the screen.
Destinations
Output Destinations | |||
---|---|---|---|
Destination | Player that receives the message: | ||
0, 1, 2, etc. | If there's a player with the thingref of this dest, the message is sent to him. Otherwise, it's local. | ||
-1 | Local player. | ||
-2 | Unknown. | ||
-3 | Everyone. |