Wesnoth Lua Pack: Development Thread
Moderator: Forum Moderators
Re: Wesnoth Lua Pack: Development Thread
Without looking at the code, I can say if [scatter_units] is using get_locations, the fix (on 1.13.x only, however) would be to add an { include_borders = no } key to the WML table.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
Sorry, I do not have a test case available. (And I'm running this on 1.12.)
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Wesnoth Lua Pack: Development Thread
Thanks anyway, I'll work on a solution to fix it on 1.12.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
...come to think of it, it also might've been an off-map location (eg x=0). Still, even if that was it, it's reasonable to get WLP to put up a better error message, right?
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
So, is this still alive? It might be nice to have it as an includable resource pack in 1.14.
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Wesnoth Lua Pack: Development Thread
As soon as I manage to port it and all my other add-ons to 1.14. I just passed a few heavy months...
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: Wesnoth Lua Pack: Development Thread
Great idea, I wish I'd known about this earlier.
Well, in 1.14 the tooltip for unit names is broken (I should report it on Github), so this is a very basic function to decrease the fontsize if the unit name is too long (part of Better Names, now):
Of course you could get more inventive with this, filtering for how many upper case characters there are, since they take more space. The <span size='small'> font size could probably be slightly enlarged too.
Second thing you might find useful:
viewtopic.php?f=58&t=48233
EDIT: BTW, I know you guys use this approach for other elements, too. And sadly some translations extend those strings and then they get cut off, even though they might be more important than this one, for example the side number in Polish. I think this approach would work better.
Well, in 1.14 the tooltip for unit names is broken (I should report it on Github), so this is a very basic function to decrease the fontsize if the unit name is too long (part of Better Names, now):
Code: Select all
local old_unit_name = wesnoth.theme_items.unit_name
function wesnoth.theme_items.unit_name()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local t = old_unit_name()
if string.len(t[1][2]["text"]) > 21 then --14 characters +7 chars of formatting code
t[1][2]["text"] = "<span size='small'>"..t[1][2]["text"].."</span>"
end
return t
end
Second thing you might find useful:
viewtopic.php?f=58&t=48233
EDIT: BTW, I know you guys use this approach for other elements, too. And sadly some translations extend those strings and then they get cut off, even though they might be more important than this one, for example the side number in Polish. I think this approach would work better.
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Wesnoth Lua Pack: Development Thread
Just a quick message to let you know that I moved the development of the WLP from Wesnoth-UMC-Dev to GitHub. The new repo is here: https://github.com/Elvish-Hunter/Wesnoth_Lua_Pack.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
Nice! Maybe I'll open a PR later to update deprecated things.
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Wesnoth Lua Pack: Development Thread
After a lot of work (40 commits on GitHub!) I can finally announce that I just uploaded version 1.8.0 of the Wesnoth Lua Pack on the 1.14 add-ons server.
While there isn't any new WML tag, a lot of work has been done on the two main GUI debug tags. I also converted the documentation from HTML (I just don't have the time any more to keep up with web programming) to Markdown.
As always, don't forget to report any bug that you find; even better, you can open an issue on GitHub, or make a pull request if you want.
PS. While working on the WLP, I found out that there's another widget that I could've used, called [menu_button]. However, it seems like there's no way to set up a list of values in the dropdown menu, so menu buttons (aka comboboxes) are virtually unusable from Lua. Have I got it right?
While there isn't any new WML tag, a lot of work has been done on the two main GUI debug tags. I also converted the documentation from HTML (I just don't have the time any more to keep up with web programming) to Markdown.
As always, don't forget to report any bug that you find; even better, you can open an issue on GitHub, or make a pull request if you want.
PS. While working on the WLP, I found out that there's another widget that I could've used, called [menu_button]. However, it seems like there's no way to set up a list of values in the dropdown menu, so menu buttons (aka comboboxes) are virtually unusable from Lua. Have I got it right?
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
That's a very good question... I know it would be possible to use a regular button as a menu button in Lua (create a button whose callback opens a popup menu), but I don't remember how actual menu buttons specified their options. I think there might be a way but I'm not sure.
Re: Wesnoth Lua Pack: Development Thread
IIRC, it's just with [option] tags under [menu_button] if you want to set them up from the dialog config. The actual C++ implementation uses a vector of configs... not sure if that was ever exposed to Lua.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wesnoth Lua Pack: Development Thread
So if that's correct, it would mean you can use menu buttons from Lua but probably can't alter their list of options once the dialog is being shown (you can only alter them before it's shown by editing the config).
I guess that's yet another thing to add to the API at some point.
I guess that's yet another thing to add to the API at some point.
Re: Wesnoth Lua Pack: Development Thread
Hello Elvish_Hunter,Elvish_Hunter wrote: ↑August 9th, 2018, 10:25 am Just a quick message to let you know that I moved the development of the WLP from Wesnoth-UMC-Dev to GitHub. The new repo is here: https://github.com/Elvish-Hunter/Wesnoth_Lua_Pack.
You should update the first post of this thread with this new link, else people won't be able to jelp you with the WLP .
Also, the link to the docs (https://wiki.wesnoth.org/WLPDocs) given somewhere else is broken: you may add the new one to the first message as well.
And while you are at it, also place in the first message a direct link to download the pack, if there is any (I had to copy-paste individual lua files I wanted from the github dev repo, found no download ???).
EDIT: About downloading the pack: I just read this a few messages above, by Elvish_Hunter:
So, we can just get it there! Checked. Please, just say so in the first message of the thread...... I just uploaded version 1.8.0 of the Wesnoth Lua Pack on the 1.14 add-ons server.
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Wesnoth Lua Pack: Development Thread
Done.
There isn't really a new link to the documentation, because everything is documented with a few Markdown files inside the add-on.denispir wrote: ↑October 28th, 2019, 4:26 am Also, the link to the docs (https://wiki.wesnoth.org/WLPDocs) given somewhere else is broken: you may add the new one to the first message as well.
Done, and thank you for commenting!
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)