Config Parser – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search

Works/Doesn't

There are some cases that show somewhat confusing behavior, so until we can find the general rule behind it, perhaps we should start collecting what works/doesn't work back here:

WORKS DOESN'T WORK Comment
__EXEC(_txt = str 1000) __EXEC(_txt = str 1000+1) addition after str command
displayName = $STR_SHORT_GENERAL displayName = __EVAL(localize "STR_SHORT_GENERAL") can't use commands in property assignments in an addon's config file?


Examples

I don't think this article should use examples like this one:

__EXEC (_str = format["daytime: %1",dayTime])

The article should focus mainly on assigning and incrementing of number variables, as well as string manipulation / concatenation. These are the main uses for the config parser.

I think using the "daytime" example just confuses the issue, and will make people think about the config parser incorrectly. It is only run once, either when packing the pbo, or when loading the pbo / mission. Commands that refer to the game environment (like "daytime") make no sense in this situation. Same goes for the example using (_this select 0), since you can't really pass parameters in the parser.

Also, an example of using a do/while "loop" within an __EXEC statement would be nice, as this is a way to do conditional operations without using parenthesis. --General Barron 22:40, 4 November 2008 (CET)

I've used some more generic variables now, but as far as _this in configs is concerned, you can use it. It's not used to pass parameters, but to refer to a control itself, for example. (I've added a note to the this page.) --Kronzky 20:21, 10 November 2008 (CET)