a == b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
back to [[Scripting_Reference#.23|COMREF]]
back to [[Scripting_Reference#.23|COMREF]]


<h2 style="color:#000066">''' ''valuea''==''valueb'' '''</h2>
<h2 style="color:#000066">''' ''valuea'' == ''valueb'' '''</h2>
 


'''Operand types:'''
'''Operand types:'''
Line 19: Line 20:


'''Example:'''
'''Example:'''
[[[[
? (player]] '''==''' ([[leader]] [[group]] player]])):[[hint]] "You are the leader of your group."


? (player == (leader group player)):hint "You are the leader of your group."
? ([[name]] [[player]] '''==''' "Billy"):[[hint]] "Hello Billy, how are you?"
 
? (name player == "Billy"):hint "Hello Billy, how are you?"




'''Comments:'''
'''Comments:'''


== does not work with the types [[Boolean]] and [[Array]].
== Does not work with the types [[Boolean]] and [[Array]].


i.e. the arguments:
i.e. the arguments:


? MyBoolean == [] : Hint "This is a test."
? MyBoolean '''==''' [] : [[Hint]] "This is a test."


and
and


? MyArray == [] : Hint "This is a test."
? MyArray [[==]] [] : [[Hint]] "This is a test."


...will cause errors.
...will cause errors.


Instead of the first line use:<br>
Instead of the first line use:<br>
? MyBoolean : Hint "This is a test."
? MyBoolean : [[Hint]] "This is a test."


The workaround for the second line is:<br>
The workaround for the second line is:<br>
? (Count MyArray) == 0 : Hint "This is a test."
? ([[count]] MyArray) '''==''' 0 : [[Hint]] "This is a test."

Revision as of 19:48, 15 April 2006

back to COMREF

valuea == valueb


Operand types:

valuea: Number, Group, Side, String or Object

valueb: Number, Group, Side, String or Object

Type of returned value:

Boolean

Description:

check if valuea is equal to valueb


Example: [[[[ ? (player]] == (leader group player]])):hint "You are the leader of your group."

? (name player == "Billy"):hint "Hello Billy, how are you?"


Comments:

== Does not work with the types Boolean and Array.

i.e. the arguments:

? MyBoolean == [] : Hint "This is a test."

and

? MyArray == [] : Hint "This is a test."

...will cause errors.

Instead of the first line use:
? MyBoolean : Hint "This is a test."

The workaround for the second line is:
? (count MyArray) == 0 : Hint "This is a test."