Lua Widget: UnitGroups (Total War style icons?)

Lua Widget: UnitGroups (Total War style icons?)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Lua Widget: UnitGroups (Total War style icons?)

Post by tinnut »

Hi Guys,

I've written a Lua Widget that may or may not prove to be useful. It's at unknown-files and I can't post a URL due to the anti-spam software on these forums, but you can find it by going to unknown-files then:

Moderator: http://spring.unknown-files.net/file/22 ... oup_icons/
There is an image at the above page.

As I am lazy I am just going to copy and paste what I wrote there:
This widget adds a icon for each unit group (1-9). Single click on an icon to select that group, double click to select that group and move the camera to the group.

It also displays the total health of all units in the group and will flash red when any unit in the group suffers damage. It has a couple of minor bugs, but they don't effect it's use.

It's my first Lau script so the code is most likely going to look pretty crude :)
It's install as per normal: copy into the spring\LuaIU\Widgets folder and be sure to enable LuaUI via the settings.exe program.

The script uses functions from scripts by Ray, Trepan and MelTrax in order to do a lot of the drawing, so a lot of thanks needs to go to them.

As this is my first post to this forum, I'd like to add that Spring is just fantastic (I was a bit OTA fan, but this is better :-) ) and has killed my desire for the commercial games that I currently have. (Such as Medieval II Total War.)

Cheers.
User avatar
Machiosabre
Posts: 1474
Joined: 25 Dec 2005, 22:56

Post by Machiosabre »

this is awesome :o
you left out the best group though, group 0 :-)

edit: it does seem to conflict with the idlecon widget :cry:
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

you left out the best group though, group 0 Smile
Yeah, too lazy I'm afraid :-) I didn't want it in if it came before Group 1 (ie: I want it after Group 9 just like it is on the keyboard.) Hopefully the next version will fix that.
edit: it does seem to conflict with the idlecon widget Crying or Very sad
Yeah, I'm not too happy it does this as I quite like idlecon. Not quite sure what the best approach for fixing this is just at the moment, but I'll have a think about it. Any suggestions?
User avatar
Masse
Damned Developer
Posts: 979
Joined: 15 Sep 2004, 18:56

Post by Masse »

all these lua widgets looks niceee i cant wait till lua is fixed in linux
User avatar
Machiosabre
Posts: 1474
Joined: 25 Dec 2005, 22:56

Post by Machiosabre »

I guess you could move it to a bar on the right side of the screen or something, or just make the slots only appear for groups that are in use so it'd conflict less often.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Masse:

LuaUI was developed on a linux box (but the dev never bothers
to use the package install routine). All you need to do is copy the
contents of the LuaUI/ directory into your read/write directory.

Something like this (I haven't checked the paths):

Code: Select all

cp -r /usr/share/games/spring/LuaUI ~/.spring/
P.S. The next version will work out of the box.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

The right edge is available for groups. Best to start in the middle and only display the ones you need, like idle cons starts in the middle of the bottom of the screen. That's because in bottom right are player info (which takes up a bit of screen when there are a lot) and top right is your resources and ally resources (which also can take up more space). If you don't know how to get stuff over to the right side, you could always ask trepan for hints. :wink: Also feel free to stop by #lcc in the spring lobby, most of the widget developers idle there when they're around. :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Image

For those who dont click the link.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

There were some issues with s3o models being inverted and the selection display, trepan told me to turn off the culling.

gl.Culling(false) instead of gl.Culling(GL_FRONT)
User avatar
Masse
Damned Developer
Posts: 979
Joined: 15 Sep 2004, 18:56

Post by Masse »

trepan wrote:Masse:

LuaUI was developed on a linux box (but the dev never bothers
to use the package install routine). All you need to do is copy the
contents of the LuaUI/ directory into your read/write directory.

Something like this (I haven't checked the paths):

Code: Select all

cp -r /usr/share/games/spring/LuaUI ~/.spring/
P.S. The next version will work out of the box.
oh thanks ^^ ill try this out :)

nice it work... thanks again love you <3
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Could you modify this lua widget to look like the IceXuick GUI design?

Image
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

Machiosabre wrote:I guess you could move it to a bar on the right side of the screen or something, or just make the slots only appear for groups that are in use so it'd conflict less often.
LordMatt wrote:The right edge is available for groups.
I'll try to make it configurable to go on the right side or the bottom and perhaps defaulting to the right. If I can work it out, I'll put a small tabbar on it so it can be dragged around and/or a little button to switch where it's located.
LordMatt wrote:Also feel free to stop by #lcc in the spring lobby, most of the widget developers idle there when they're around.
Thanks, that would be quite helpful.
rattle wrote:There were some issues with s3o models being inverted and the selection display, trepan told me to turn off the culling.

gl.Culling(false) instead of gl.Culling(GL_FRONT)
Thanks rattle :-)
AF wrote:Could you modify this lua widget to look like the IceXuick GUI design?
I'll give it a go, but I was really waiting for MelTraX's complete implementation. :-)

At the moment I've gotten a little distracted writing a basic window system so that I can abstract it a little.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I spoke with meltrax in the lobby and he seems to disagree with abstraction. I'd prefer to write a panel class with basic collapsing exiting minimizing etc support to build code ontop of.

The changes to make your widget fit into that design are easy and I've made the majority of the changes myself on my home PC. I'll upload my version tonight.

Also someone said something about s3o models being inverted?

Also it overlaps with the tooltip part, it would be nice if there was a way to move it to the side or further along from the bottom centre.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

I really like the current version. Thanks.
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Post by MelTraX »

AF wrote:I spoke with meltrax in the lobby and he seems to disagree with abstraction. I'd prefer to write a panel class with basic collapsing exiting minimizing etc support to build code ontop of.
I don't disagree with abstraction.. I just don't like the little collapse and close buttons on all GUI components.. I think that should be handled by the tweak mode.. And if I understood trepan correctly, he's already working on a wrapper that will make resizing and moving easier to implement.. I'm currently waiting for that wrapper to start on that..
tinnut wrote:I'll give it a go, but I was really waiting for MelTraX's complete implementation. Smile
I was planning to integrate the group icons, the idle cons, the current selection and maybe the commander like the bottom display of Ices design.. I thought about letting those icons pop out and show all the unit type icons in that "group".. That way the idle cons wouldn't use that much space. On the other hand idle cons should be accessable quickly.. We will see if it will work.

In the meantime it would be cool if you keep me posted about what you're doing (all of you who build GUI widgets).. We don't have to do the same work twice and if you (tinnut or AF) have already adapted the groups widget to IceXuicks GUI, it would be cool if you could send it to me.. :D
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

I've put up an updated version onto unknown-files. I dropped my abstraction script and instead modified the existing one so that it can go either on the right side, or on the bottom. It can now also be told to only show unitgroups that contain units, and its position can be slid along.

I've fixed up a couple of bugs, and introduced a couple more, but I believe it at least works.

My apologies MelTraX if my updating this has conflicted with any work you may have already started.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Looks very nice. I will post any bugs I find while playing with this widget. I have the following feature requests (dunno how possible they are):
*Right click on an empty group adds selected units to a group
*Middle click on a filled group adds the selected units to the group without replacing the ones currently there.
*A cosmetic request: The white background doesn't go with the grey found in much of the GUI (for me, the MeltraX widgets). It would be nice if they all were in a similar style.
*Save the position of the groups window on exit, so you don't have to move it each time.
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Post by MelTraX »

I doesn't conflict with my work yet.. I'm currently working on my abstraction layer.. This will probably take some days since I don't know much about Lua yet.

I wouldn't change the design atm because the visual stuff will have to be redone anyway once my framework is kinda finished..

Oh and btw: Cool work.. :-)
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

Thanks for the feedback guys.
LordMatt wrote:*Right click on an empty group adds selected units to a group
*Middle click on a filled group adds the selected units to the group without replacing the ones currently there.
I like these ideas. I've had a look and I've not been able to work out if there is a way add units to a group in the Luaui environment. Does anyone know if and how this could be done?
LordMatt wrote:*A cosmetic request: The white background doesn't go with the grey found in much of the GUI (for me, the MeltraX widgets). It would be nice if they all were in a similar style.
Oops. I actually have this in the code, but I mistakenly left a call to gl.Blending() that messed it's appearance up. I've fixed it for the next release.
LordMatt wrote:*Save the position of the groups window on exit, so you don't have to move it each time.
The code for this was in there as well, but I'd overwritten it when testing and forgot to put it back before releasing.:oops:
MelTraX wrote:I doesn't conflict with my work yet..
I'm glad it doesn't conflict with your work so far :-)
MelTraX wrote:I'm currently working on my abstraction layer.. This will probably take some days since I don't know much about Lua yet.
Sounds good :-) I find Lua quite interesting. It seems an excellent choice for this kind of work, but it's taking me a while to get used to some of its nuances.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

What about group 0?
Post Reply

Return to “Lua Scripts”