1.7 syintax change?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: Azhrei, dorpond, trevor, giliath, jay, Mr.Ice

Post Reply
Garfnob
Kobold
Posts: 6
Joined: Sun Aug 27, 2017 8:12 pm

1.7 syintax change?

Post by Garfnob »

trying to right a IF ELSE statement

all i find stats it should read
IF(condition, true action, false action)
this does not work at all even if i leave the false off

i am able to get it to work with an just a true with an alternate syntax i found
IF(condition):true action
but can not have a false this way

any help would be appreciated.

User avatar
aliasmask
Deity
Posts: 8578
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: 1.7 syintax change?

Post by aliasmask »

It would help if you provide your code you have for context. The usually way to do an [if:] statement is this

Code: Select all

[H, if(condition): "true"; "false"]
<!-- or -->
[H, if(condition), code: {
   [H: "true"]
};{
   [H: "false"]
}]
The code block is usually for multiple statements. You can leave of the false statement in the first example, but in the second example you should put an empty code block like };{}] at the end.

User avatar
wolph42
Deity
Posts: 9703
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: 1.7 syintax change?

Post by wolph42 »

i think you're referring to the Wiki: if() (function) while AM here gives an example of the [if:] (option). And indeed the 'function' version requires both true and false to work, the option does not although as AM says in case of code blocks do declare the false option but leave it empty

Post Reply

Return to “Macros”