Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 1792

WML Workshop • Re: WFL formula error FIXED

$
0
0
This is weird. Both of the following should work exactly the same:

Code:

[set_variable]name=extra_fog_xformula="$this_item.x + $fog_range + 2"[/set_variable][set_variable]name=extra_fog_xvalue = "$($this_item.x + $fog_range + 2)"[/set_variable]
There's no actual advantage to using the first form in this scenario (at least in theory, its main advantage would be when the variable is a container variable, though I seem to recall it not working at all for that case). But in principal there is no significant difference in what's happening between the two cases:
  1. First, substitute in the $fog_range variable. If the variable is not defined, that means deleting it to produce $this_item.x + + 2.
  2. Next, substitute in $this_item.x. If $this_item is not defined, that means deleting it to produce + + 2.
  3. Finally, evaluating the formula, which will give an error if it discovers invalid syntax.
And this is most definitely wrong, so I hope you didn't omit those quotes:

Code:

[set_variable]name=extra_fog_xvalue = $($this_item.x + $fog_range + 2)[/set_variable]
Here the + means WML concatenation, so if it's working when you do it like that, that probably means that both $this_item and fog_range are undefined and the resulting value is always 2.

Statistics: Posted by Celtic_Minstrel — Yesterday, 1:25 pm



Viewing all articles
Browse latest Browse all 1792

Trending Articles