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

Lua Labs • Re: Another basic lua query

$
0
0
Thanks ever so much for your reply, really really helpful.
...It looks like you have it right in terms of syntax, except for one error: you're missing a comma in there. Though I'm not sure if that filter is composed correctly.
Assuming I correctly deciphered the original code logic:

Code:

    -- The tusker moves as close to enemy as possible    -- Closeness to tusklets is secondary criterion    local adj_tusklets = wesnoth.units.find_on_map {        side = wesnoth.current.side,        type = cfg.tusklet_type,        { "filter_adjacent", { id = target.id } }    }
I think :fingers_crossed: this results in this filter (plugging in actual values):

Code:

  side = 3  type = Icemonax  [filter_adjacent]    id=target.id  [/filter_adjacent]
The structure I'm trying to build is (assuming I'm right so far) is as above but with type replaced by a full filter:

Code:

  side = 3  type = Icemonax  [filter_wml]    [variables]      wmai=1    [/variables]  [/filter_wml]  [filter_adjacent]    id=target.id  [/filter_adjacent]
My attempt (with added comma :) ):

Code:

  local adj_followers = wesnoth.units.find_on_map {                                    side = wesnoth.current.side,                                    { "and", filter_follower }, { "and", "filter_adjacent", { id = target.id } }                                    }


or, embed filter_adjacent?:

Code:

  local adj_followers = wesnoth.units.find_on_map {                                    side = wesnoth.current.side,                                    { "and", filter_follower, { "and", "filter_adjacent", { id = target.id }} }                                    }


Hope this makes sense.

Thanks again for your patience!

Cheers!
-- Spannerbag

Statistics: Posted by Spannerbag — Yesterday, 3:17 pm



Viewing all articles
Browse latest Browse all 2277

Latest Images

Trending Articles



Latest Images