Home   Help Search Login Register  

Author Topic: Format command  (Read 411 times)

0 Members and 1 Guest are viewing this topic.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Format command
« on: 23 Nov 2004, 00:55:24 »
I've looked in the comref, but i don't understand what the format command does or is used for... from what i have seen people say it sounds like a very useful command. Help?

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:Format command
« Reply #1 on: 23 Nov 2004, 01:20:21 »
All the Format command does is allow you to display variables as part of a string.  As an example, if yourgroup is a team of three:

Hint Format ["You have %1 effectives in your group, %2!",Count Units yourgroup,"Triggerhappy"]

would put up a hint saying:

You have 3 effectives in your group, Triggerhappy!

The first element (element 0) of the array is a string with placeholders for the variable values.  %1 and %2 are placeholders for the second (element 1) and third (element 2) elements in the array.

That's the gist - but the syntax is definitely not guaranteed this time of night.  Don't know what the maximum number of placeholders is, but it shouldn't be a problem most of the time.

There are cleverer uses where you use the result of the Format as a variable name itself but start simply.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Format command
« Reply #2 on: 23 Nov 2004, 02:10:19 »
Quite right.     You can use it with, for example, the titletext command as well as the hint command.    It's very useful in debugging because it allows you to see what value a variable has at any given moment.

Once you get more advanced - and particularly if you have previous knowledge of programming - you can do funky stuff like combining it with the call command.      However, don't worry, you don't have to understand all that to make good missions.     BIS made a couple of pretty decent campaigns with very little scripting at all, never mind all this advanced stuff.     Learn to walk before attempting the triple backwards somersault with seventeen twists and two and a half pikes.   Blindfolded.   While drinking a glass of water.
Plenty of reviewed ArmA missions for you to play

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Format command
« Reply #3 on: 23 Nov 2004, 02:19:48 »
2 1/2 pikes? don't know what that is but thanks both of you, especially for the unique analogy...