Config Parser – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " (\=+)([a-zA-Z0-9][^ ]+[a-zA-Z0-9])(\=+) " to " $1 $2 $3 ")
 
(One intermediate revision by one other user not shown)
Line 18: Line 18:
|}
|}


----
 
= Examples =


I don't think this article should use examples like this one:
I don't think this article should use examples like this one:
Line 28: Line 29:
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.
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.
--[[User:General Barron|General Barron]] 22:40, 4 November 2008 (CET)
--[[User:General Barron|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.) --[[User:Kronzky|Kronzky]] 20:21, 10 November 2008 (CET)

Latest revision as of 15:54, 17 November 2021

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)