Home   Help Search Login Register  

Author Topic: format ["%1 .....  (Read 1492 times)

0 Members and 1 Guest are viewing this topic.

Offline rhysduk

  • Former Staff
  • ****
format ["%1 .....
« on: 03 Jan 2004, 19:18:11 »
As the titel suggests .. this topic is about the format function thaht can be used to make various messages and used in parts of titletext thing's

But how the hell does it work ? I dont understand the ComRef on this... gooblety gook to me  ???

I was wondering if someone coujld perhaps enlighten me ?

Regards Rhys
« Last Edit: 03 Jan 2004, 19:18:43 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:format ["%1 .....
« Reply #1 on: 03 Jan 2004, 19:33:06 »
Putting the command thus:

format ["%1 - %2 - %3", "OFPEC", "is", "Great"]

would result in the message:

OFPEC - is - Great

Putting it this way:

format ["%3 - %2 - %1", "OFPEC", "is", "Great"]

would result in the message:

Great - is - OFPEC

Hope you get the idea.


Planck
« Last Edit: 03 Jan 2004, 19:37:17 by Planck »
I know a little about a lot, and a lot about a little.

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:format ["%1 .....
« Reply #2 on: 03 Jan 2004, 19:36:20 »
well, ya can use it if, say you have this empty tank but dunno (yet) whom is going to getin as... say, gunner or alike. Then (if we wanted a *HINT*when gunner is inside) ya use the format phrase which basically tell the game engine to investigate and use the NAME (identity) of whomever gets in as gunner.


script example:

(script is executed in tanks INIT field) :     [this] exec "TankScroll.sqs"

=============================================

_tank = _this select 0
_g = (gunner _tank)
@ _g in _tank
Hint format ["%1, Get out\nthe tank is burning!!",name _g]

=============================================



som'n like that anyho'  ::)  :-* (VERY close to what planck said)  *cough*

allthough 'twas the "name _g" part that tells
the engine to go looking for the gunner's name  ::) ;D




« Last Edit: 03 Jan 2004, 19:43:50 by Tomb »

Offline rhysduk

  • Former Staff
  • ****
Re:format ["%1 .....
« Reply #3 on: 03 Jan 2004, 20:21:47 »
I get the idea that plank is referring to no porblem :thumbsup:

But not you TOMB sorry  :-[

I understand what the NAME function does... so name _player would byt he name that we individually use for Campaigns and what not...

but what i really want to understadn is how they can be used globbally.. to get anythign ....

I dont know if you understand....

Rhys

EDIT:- also how would you use this in a titeltext htingy mugjig ??? its complicated  :P

EDIT AGAIN !! :- i just noticed somethign i ued the format naem method to get a name of a soldier and it came back with Booby Burning.. now this is a name that i have not assigned to tihs soldier... looks like the game assigns names to them for default... so if i was to want a custom name to come up.. would i have to use SetIdentity ???

Rhys
« Last Edit: 03 Jan 2004, 20:31:26 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:format ["%1 .....
« Reply #4 on: 03 Jan 2004, 20:40:20 »
1. titletext [format, ["Yoooooooooo m8s! Look who's back? Missed me man? Not? Screw you! Ho and here's the example: %1", "PLAIN DOWN"], "Yoooo"]

something like that

2. You have to define that in the description.ext file, cant recall how.

:beat: *Gets Shot* :beat:
« Last Edit: 03 Jan 2004, 20:41:23 by The real Armstrong »

Offline rhysduk

  • Former Staff
  • ****
Re:format ["%1 .....
« Reply #5 on: 03 Jan 2004, 20:44:27 »
Ah right - define int he .ext file .. oh shit  :'(

So why is htis not working

Code: [Select]
titletext format ["Sir, we have a problem, %1 appears to be dead.","Plain Down",name _target]
?? ?? ?? ?? I dont understand why  ....

Rhys

PS - welcome back Sir Armsty :cheers:
« Last Edit: 03 Jan 2004, 20:45:53 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:format ["%1 .....
« Reply #6 on: 03 Jan 2004, 20:50:37 »
Thx for the welcome, drinks on u. :P

Change it to:

titletext [format ["Sir, we have a problem, %1 appears to be dead.","Plain Down"],name _target]

Now Im going to have cake :)

:beat: *Gets Fat* :beat:
« Last Edit: 03 Jan 2004, 20:51:05 by The real Armstrong »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:format ["%1 .....
« Reply #7 on: 03 Jan 2004, 20:57:15 »
Hmmm......or maybe:

titletext [format ["Sir, we have a problem, %1 appears to be dead.", name _target],"Plain Down"]

Hope thats right.


Planck
« Last Edit: 03 Jan 2004, 20:58:01 by Planck »
I know a little about a lot, and a lot about a little.

deaddog

  • Guest
Re:format ["%1 .....
« Reply #8 on: 03 Jan 2004, 21:00:09 »
It's very simple.  One of the main uses of format is to display variables:

_a=100
hint format ["The value of _a is :%1",_a]

will produce:  The value of _a is :100

%1 is the first thing in the list (in this case _a)
%2 would be the second, and so on.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:format ["%1 .....
« Reply #9 on: 03 Jan 2004, 21:10:19 »
Hmmm......or maybe:

titletext [format ["Sir, we have a problem, %1 appears to be dead.", name _target],"Plain Down"]

Hope thats right.


Planck

Uh yea, I thinks thats right. Im a bit rusty :P

Offline rhysduk

  • Former Staff
  • ****
Re:format ["%1 .....
« Reply #10 on: 03 Jan 2004, 21:59:38 »
take a look at this please guys here its a script of mine which envlovles all of this ....
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:format ["%1 .....
« Reply #11 on: 03 Jan 2004, 22:06:25 »
sneak-advertising? ;)

:beat: *Gets Shot* :beat:

Offline rhysduk

  • Former Staff
  • ****
Re:format ["%1 .....
« Reply #12 on: 03 Jan 2004, 22:23:18 »
No Sir !! Its just that the both f them are linked :d
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)