scroll_to_unit behaviour seems to have changed

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
User avatar
Spannerbag
Posts: 493
Joined: December 18th, 2016, 6:14 pm
Location: Yes

scroll_to_unit behaviour seems to have changed

Post by Spannerbag »

Hi,

I'm developing a campaign and notice that [scroll_to_unit] seems to have started to behave differently.

Prior to 1.14.4 [scroll_to_unit] accepted a [filter] and worked fine.

Now it either does nothing apparently or scrolls to a seemingly random place on screen.

I have seen this behaviour on 1.14.4 and 1.14.5. I'm using a Windows 7 PC.

Code: Select all

#
# scroll_to_unit stopped working as coded below as from 1.14.4 afaik
#
 [store_unit]			# Transfer Jackery's troops to Morn
   variable=AEI_Jackery_army
   [filter]
     side=2
   [/filter]
 [/store_unit]
 {FOREACH AEI_Jackery_army i}
   [set_variable]
     name=AEI_Jackery_army[$i].side
     value=1
   [/set_variable]
   [unstore_unit]
     variable=AEI_Jackery_army[$i]
     find_vacant=no
   [/unstore_unit]
   [scroll_to_unit]
     [filter]
       id=$AEI_Jackery_army[$i].id
     [/filter]
   [/scroll_to_unit]
   [floating_text]
     x,y=$AEI_Jackery_army[$i].x,$AEI_Jackery_army[$i].y
     text= _ "<span color='blue'>Side 1</span>"
   [/floating_text]
   [delay]
     time=500
   [/delay]
  {NEXT i}
  [clear_variable]
    name=AEI_Jackery_army
  [/clear_variable]
Granted, I could do the above with a simple [modify_unit] and will do so if necessary, but I think it's more fun for the player if things are visual.
I make quite heavy use of scroll_to_unit and I'd rather not redesign if possible.
And yes, I know {FOREACH} is deprecated :)

I've upgraded to 1.14.5 but am still seeing this issue.

In the above code, scroll_to_unit scrolls to a different place entirely (I suspect side 1 leader).
Can't verify if floating text still works as it's off-screen.

Before I start fiddling around I just thought I'd ask if this is a known issue?

Many thanks in advance for your help and advice!
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 493
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: scroll_to_unit behaviour seems to have changed *fix found*

Post by Spannerbag »

Hi all,

I noticed that [scroll_to] documentation says
StandardLocationFilter, do not use a [filter_location] sub-tag.
So I deleted the filters and voila! It worked as before :D

Might be worth updating https://wiki.wesnoth.org/InterfaceActio ... to_unit.5D to match wording in https://wiki.wesnoth.org/InterfaceActio ... roll_to.5D ?
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply