Jump to content
Sign in to follow this  
andylee054

How to get the groupid and unit id via script?

Recommended Posts

I tried a script like that:

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

_Call01 = _this select 0

hint format ["%1", _call01]

_Call02 = format ["%1", _call01]

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

And it will return the call sign like: "West Alpha Black:1"

Then I tried to verify the name like that:

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

_Txt1 == "West Alpha Black:1"

?(_Txt1 == _Call02): hint "OK"

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

But it is always failed to verify, and saw some error msg on top of the screen.

How can I do?

Or Can anyone tell us what is the format of the Call sign in OFP?

thanks.

Share this post


Link to post
Share on other sites

Hi,

you got the _Txt1 assignment wrong, it should be

_Txt1 = "West Alpha Black:1"

i.e. only one '='

Share this post


Link to post
Share on other sites

That's OK for one '=' or '=='.

It doesn't matter for what I got.

The result is all the same.

anything else?

Share this post


Link to post
Share on other sites

As you used format, _Call02 is nothing but a string, and if you choose _Txt1 to match it, it should, well, match tounge_o.gif.

Try to check the wording again, e.g. display

hint format["%1\n%2",_Call02,_Txt1]

BTW, why do you want to compare the Call sign strings?. I guess, you pass the unitname into the script. If you want to check if a unit takes a specific place in the group, you could also use the unit command,

?_Call01 == (units _Call01) select 0: Hint "Is Number One"

Share this post


Link to post
Share on other sites

Oh, I solved the problem.

the script should be like that:

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

_P1 = _this select 0

_P2 = "WEST Alpha Black:2"

~3

?(_P2 == format["%1", _P1] ): hint format ["%1 = %2", _P1, _P2] ; exit

hint format ["%1 <> %2", _P1, _P2]

exit

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

it works fine.

;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×