Lua Widget: UnitGroups (Total War style icons?) - Page 2

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

Post by tinnut »

The version currently on Unknown-Files shows group 0 after group 9, just like on the keyboard :-)

Here is the link:
http://spring.unknown-files.net/file/2329/UnitGroups/
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

ChangeLog wrote:- Added "group <int> [ "set" | "add" | "selectadd" | "selectclear" | "selecttoggle" ]"
action as an alternative to the group[0|9] commands (note that the key modifiers can
be setup differently from the default)
Also there's a call in for sending keystrokes to the game somewhere in api.txt, if you wanted to do it that way.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

You can't send keystrokes via LuaUI, but you can send console commands.
The first group buttons implementation used a different method to draw the
buttons in LuaUI:

http://trepan.homelinux.net/spring-diff ... lpanel.lua

http://trepan.bzflag.bz/spring/groupicons.jpg
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Oo
-- CALL-INS
--
-- Call-ins are functions that the lua code can provide that will
-- be called from the Spring executable when appropriate. All of
-- the call-ins are optional.

KeyPress()
KeyRelease()
What are these for then?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

LordMatt wrote:Oo
that will be called from the Spring executable
What are these for then?
note the "from" :roll: :P

You'd need call-outs to send keypresses to Spring..
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Hmm I thought it was the other way around for some reason. I blame trepan. :P
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

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

Post by tinnut »

New version is up on Unknown-Files:
http://spring.unknown-files.net/file/23 ... Groups_v5/
Features:
-The widget can be placed on the right side of the screen, or the bottom (right or bottom button)
-It can be made to shrink or collapse to only show groups that have units in them, thus using less screen space (shrink button)
-It can be made to show all groups, including empty ones (always button)
-It can also be slid along the edge that it sits on via a bar at the top/end of the list.
-Click on a groups icon and it selects that group
-Double click and it selects it and then centers on the group
-Right click and it makes the selected units that group, replacing any units that may have already been in that group (as suggested by LordMatt)
-Middle click and it adds the selected units to the group along with the original members of the group (as suggested by LordMatt)

Fixes:
-The colours now match those of the IceXuicks widgets by MelTraX
-The widget remembers its position along the bottom or the screen and the right when you've slid it along
-The model of the unit no longer tries to take up the entire icon
Thanks for the help trepan and LordMatt :-)

I ended up going with putting "@+C" and "@+C+S" in my SendCommands() calls, which is how trepan's script did it.

Cheers.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Niice I will test this later.

Edit: The widget works great! See yourPMs. ;)
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

tinnut
The "group" command is preferred to the '@@' format
(which was created before the "group" command). The
'@@' string prefix control mode will probably disappear
sometime in the future.
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

Thanks trepan :-)
I'll have it changed for the next version I upload.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

it keeps crashing in this version, can you maek work?
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Post by ginekolog »

it does not work for me anymore in 075... too bad, its a good widget
Lefty
Posts: 27
Joined: 26 Jun 2007, 22:00

wont work

Post by Lefty »

this widget uses headers not available in 0.75 (probably spring.h.lua and opengl.h.lua)

Code: Select all

Include() could not load 'LuaUI/Headers/spring.h.lua'
[KnoX]ElementalGizmo
XTA Developer
Posts: 266
Joined: 24 Aug 2006, 01:33

Post by [KnoX]ElementalGizmo »

PLEASE SOME1 FIX THIS PLEEEEEEEASE!
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Post by very_bad_soldier »

[KnoX]ElementalGizmo wrote:PLEASE SOME1 FIX THIS PLEEEEEEEASE!
AFAIK you just need those header files and place them in the Headers directory. I think they are included in the 0.74b3 spring release. Otherwise you can find them in this package: http://spring.unknown-files.net/file/33 ... A_Pack_v5/

EDIT:
If I remember right the error message will disappear but the widget doesnt work anyway.
Last edited by very_bad_soldier on 03 Aug 2007, 00:28, edited 1 time in total.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

try this...

you know, that the function search & replace is present in almost very text editor in the world?
tinnut
Posts: 67
Joined: 09 Sep 2006, 08:17

Post by tinnut »

Hi guys, sorry for not replying earlier, but I've been on holidays :)

Thanks for fixing it Brain Damage. I'd made some (very minor) changes to the current version before the update to Spring so I'll merge the two scripts.

I have to admit however, that since writing this widget I've found that I don't use it all that much myself :P
Post Reply

Return to “Lua Scripts”