random_placement num_items WFL

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

random_placement num_items WFL

Post by vghetto »

Hi,

random_placement's num_items is deprecated and I get a warning saying use WFL instead.

I included the parentheses and it still giving me the deprecation warning.

Code: Select all

num_items="(size * ({N} / 100))"
num_items="$(size * ({N} / 100))" does not work.

Anyone know how I'm supposed to use WFL here?

I tried looking up examples in the campaigns and macros folders.
In terrain-utils.cfg it is the same as I have here. In HttT scenario 12 it is still using the old form (might need updating).

Thanks

Edit: I tried throwing in ceil. num_items="ceil(size * ({N} / 100))" gave an error message. num_items="$(ceil(size * ({N} / 100)))" didn't work.
User avatar
Celtic_Minstrel
Developer
Posts: 2194
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: random_placement num_items WFL

Post by Celtic_Minstrel »

It looks like there's a bug with the way the engine detects that you're using the deprecated form of num_items. Your first version is correct. We'll fix the bug, but in the meantime you can silence the deprecation warning by putting a space between the quote and parentheses, like so:

Code: Select all

num_items=" (size * ({N} / 100)) "
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: random_placement num_items WFL

Post by vghetto »

Celtic_Minstrel wrote: December 20th, 2020, 8:23 pm It looks like there's a bug with the way the engine detects that you're using the deprecated form of num_items. Your first version is correct. We'll fix the bug, but in the meantime you can silence the deprecation warning by putting a space between the quote and parentheses, like so:

Code: Select all

num_items=" (size * ({N} / 100)) "
Unfortunately this is now broken in 1.15.9

Edit: wesnoth.eval_formula() is returning 0
Post Reply