[Twinsen][0.17.3] player.get_active_quick_bar_page is strange

This subforum contains all the issues which we already resolved.
MightyMooquack
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Apr 24, 2017 1:33 am
Contact:

[Twinsen][0.17.3] player.get_active_quick_bar_page is strange

Post by MightyMooquack »

At a minimum, this function seems under-documented, but it may be that some of its behavior constitutes a bug.

The function is given the index of a "screen page," and the documentation doesn't give a clear explanation of what this means. It appears to correspond to the (1-indexed) quick bar row that is visible on the screen. I would think, therefore, that the only meaningful values would be 1 or 2, but the function will happily accept larger values; the meaning of such values is unclear.

The function returns the 0-indexed quick bar page number, so that page 1 is 0, page 2 is 1, and so on up to page 0 being 9. This is confusing and seems inconsistent with the usual way in which Lua works; however, it is convenient when used in combination with player.get_quick_bar_slot, because you can compute an index with page * 10 + slot. Is this behavior intentional? Should the documentation spell this out explicitly?

Along the same lines, the documentation does not explain that player.get_quick_bar_slot and player.set_quick_bar_slot operate on indexes in the range 1 through 100. This is simple enough to determine through basic testing, but it seems like the sort of thing that should be spelled out explicitly.
Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by Risce »

I came here to post a bug about this as well.

It seems that `get_active_quick_bar_page` returns a 0-index based page number (where 0 -> the bar that says "1") but that `set_active_quick_bar_page` doesn't accept 0 as a valid argument!

Also, multiple `set_active_quick_bar_page` calls in a mod function seems to be broken. The bars don't actually update.
l1ng0
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Jul 07, 2018 11:51 am
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by l1ng0 »

Personally I couldn't get any obvious reaction to the set... calls, when using them in the console. No updates at all.

Also, as noted, set requires a 1-based argument, but get returns 0-based. (just confirming same behaviour)

I had a mod I was working on for .16 that I'd like to now finish for .17, that would rely on this working, so it will be great when this works!

Dev team is doing an awesome job!
Sunnova
Fast Inserter
Fast Inserter
Posts: 169
Joined: Mon May 16, 2016 12:10 pm
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by Sunnova »

I got the display update working by doing

player.game_view_settings.show_quickbar = false

making my changes, then doing

player.game_view_settings.show_quickbar = true

Working just fine doing the above, using it my quick bar swap mod
Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by Risce »

I tried that and it was inconsistent.
Sunnova
Fast Inserter
Fast Inserter
Posts: 169
Joined: Mon May 16, 2016 12:10 pm
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by Sunnova »

Strange indeed, I've not had any problems at all.

Risce wrote: Sun Mar 10, 2019 2:39 pm I tried that and it was inconsistent.
Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: [0.17.3] player.get_active_quick_bar_page is strange

Post by Risce »

Here's my mod. I have been testing with increment and decrement shortcuts. Only the first bar ever changes.

https://github.com/DerrickRice/factorio ... -quickbars
Twinsen
Factorio Staff
Factorio Staff
Posts: 1348
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen][0.17.3] player.get_active_quick_bar_page is strange

Post by Twinsen »

I changed get_active_quick_bar_page to return 1-based index so it should be consistent with the rest.
Also updated the documentation a bit.
Also fixed the quickbar not updating after set_active_quick_bar_page

Index can go beyond the visible number of bars on the screen(up to 10) to account for the interface config setting change. Unfortunately there's no way to easily find out the number of active quickbars on the screen through lua.

Changes are in Version: 0.17.12. Marking this as resolved.
Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: [Twinsen][0.17.3] player.get_active_quick_bar_page is strange

Post by Risce »

<3
Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: [Twinsen][0.17.3] player.get_active_quick_bar_page is strange

Post by Risce »

@Twinsen, this is not resolved. Quickbars 2, 3, and 4 do not update on screen.

https://imgur.com/qAbB8Yi
Twinsen
Factorio Staff
Factorio Staff
Posts: 1348
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen][0.17.3] player.get_active_quick_bar_page is strange

Post by Twinsen »

Risce wrote: Thu Mar 14, 2019 9:13 pm @Twinsen, this is not resolved. Quickbars 2, 3, and 4 do not update on screen.

https://imgur.com/qAbB8Yi
Oops, fixed again properly in Version: 0.17.13
Post Reply

Return to “Resolved Problems and Bugs”