Widgety Widget's

Widgety Widget's

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

Moderator: Moderators

Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Widgety Widget's

Post by Tim-the-maniac »

Idle cons widget
Control idle con with icons at bottom of screen, see DL link for more info

DL: http://spring.unknown-files.net/file/22 ... Idle_Cons/
the code for displaying the icons was nicked from trepans selection icons widget

InsertCommands widget
Allows insertion of commands to the front of the command queue see link for more info

DL: http://spring.unknown-files.net/file/22 ... tCommands/

Drag'n'DropCommands widget (still testing)
Click and drag any command (using middle mouse button) in the command queue to reposition it

DL: http://everybodylovesraymond.unknown-fi ... gNdrop.lua
Last edited by Tim-the-maniac on 27 Jan 2007, 21:49, edited 2 times in total.
User avatar
iamacup
Posts: 987
Joined: 26 Jun 2006, 20:43

Post by iamacup »

its hardly my fault that ray is a spastic :P

this is what unknown files is for :P lulz not rays little home grown idiot-vill (for want of a better word)
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Why doesn't left click center on the unit like ctrl+b does?
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

well I found it most useful that way as I can be microing troops wherever and build things at my factories without having to leave the place of most carnage
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Mod of this widget swapping left and middle mouse button functionality. Now left selects+centers while middle only centers. Apparently Ray doesn't know about the repeat feature for factories! :P
User avatar
RogerN
Posts: 238
Joined: 24 Jul 2006, 23:29

Post by RogerN »

Very nice - I'll have to enable lua for now on.
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

Some more widgets up there ^^
Wanna test em a bit before uploading to UF so testers would be appreciated :)
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Post by Acidd_UK »

They're all awesome dude! One minor niggle, I tried dragging and dropping cmds with my commander and whenever i was dragging a wind plant, the commander got a wait order, causing him to stop building his current task...
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

Post by SeanHeron »

That sounds quite useful ! Thumbs up :) (still have to test).
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: Widgety Widget's

Post by LordMatt »

Tim-the-maniac wrote: InsertCommands widget (still testing)
Allows insertion of commands to the front of the command queue using alt, similar to the way it works in factories

DL: http://everybodylovesraymond.unknown-fi ... ertcmd.lua
You lose the ability to make boxes of units with this command, something like ctrl+alt would be better IMO. Use

Code: Select all

if not (options.alt and options.ctrl) then
Tim-the-maniac wrote: Drag'n'DropCommands widget (still testing)
Click and drag any command in the command queue to reposition it

DL: http://everybodylovesraymond.unknown-fi ... gNdrop.lua

It would be nice if you could get building outline boxes drawn when you were moving buildings around so you could see the placement better. Also all on screen widgets disappear when you are moving commands.

I get the error:

Code: Select all

error = 1, Call_DrawScreenItems, LuaUI\Widgets\dragNdrop.lua:99: attempt to index field `?' (a nil value)
After having dragged several commands multiple times, though it still works okay. The queues disappear if they are dragged on top of something that is already made. I also get that error if I drag a move command onto a rock, which results in a solar getting selected for placement.

Additionally got this error:

Code: Select all

error = 1, Call_MouseRelease, LuaUI\Widgets\dragNdrop.lua:208: attempt to index global `coOrds' (a number value)
After moving a patrol command on a rock. Which left the com stuck waiting.[/code]

When moving guard commands between units it worked but gave this error:

Code: Select all

error = 1, Call_DrawScreenItems, Incorrect arguments to WorldToScreenCoords(x,y,z)
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

Thanks for the input Matt!
You lose the ability to make boxes of units with this command, something like ctrl+alt would be better IMO
Yeah I was gonna fix that before making the other one, probly gonna use your solution
It would be nice if you could get building outline boxes drawn when you were moving buildings around so you could see the placement better.
Maybe its possible to draw the actual building at the new location but I dont know.
Additionally got this error:
error = 1, Call_MouseRelease, LuaUI\Widgets\dragNdrop.lua:208: attempt to index global `coOrds' (a number value)
This is when you move the command onto something it shouldnt be over, I just need to do some checks on the postion of the mouse on release.
error = 1, Call_DrawScreenItems, LuaUI\Widgets\dragNdrop.lua:99: attempt to index field `?' (a nil value)
This one is fixed I think.
When moving guard commands between units it worked but gave this error:
error = 1, Call_DrawScreenItems, Incorrect arguments to WorldToScreenCoords(x,y,z)
Dunno about this one, I'll take a look later.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

MOAR BUGZ!
Currently your drag and drop widget makes dequeuing buildings impossible, so I have had to disable it for games. It throws the

Code: Select all

error = 1, Call_DrawScreenItems, LuaUI\Widgets\dragNdrop.lua:99: attempt to index field `?' (a nil value)
Error when you try to dequeue. Also I get a lot of this

Code: Select all

BBREAKING
Trepan didn't like ctrl+alt much either as it has some use already for mobile units.
// ALT+CTRL: Group Locked command (maintain relative positions)
He helped me write another way of doing it

Code: Select all

local a,c,m,s = Spring.GetModKeyState()
if ((not a) and (not c) and (not s) and m) then
To make meta only be the way to activate it, but as it turned out that didn't work very well either (but he had gone to sleep already). So at the moment I've kept it at ctrl+alt.
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

Updated (thanks to mat for his help)
Middle mouse is now used to drag commands and meta key is used for inserting commands. To set the meta key put "fakemeta <keycode>" anywhere in uikeys.txt, I have "fakemeta 0x020" which sets it to spacebar.
Also I think I killed all the bugs (mat is trying his hardest to break it now).
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Post by ZellSF »

Drag'n'DropCommands would be great for modifying patrols, if it didn't break them.

And is the wait command while dragging really needed?
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

ZellSF wrote:Drag'n'DropCommands would be great for modifying patrols, if it didn't break them.
It doesn't.
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Post by ZellSF »

LordMatt wrote:
ZellSF wrote:Drag'n'DropCommands would be great for modifying patrols, if it didn't break them.
It doesn't.
Yes it does.

You must've accidentally set repeat on if you think it doesn't.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

http://xta.wolfgame.org/unit_metal_maker.lua

I improved trepan's metal maker script, it now shuts off metal makers if your metal is >90% (and turns back on at <70%), to reduce metal leakage.

My first attempt at lua so dont beat me if it sucks :(
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

ZellSF wrote: Yes it does.

You must've accidentally set repeat on if you think it doesn't.
No. You must not have the latest version, have something wrong with your luaUI install, not be doing it right, etc...
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

ZellSF wrote:Drag'n'DropCommands would be great for modifying patrols, if it didn't break them.

And is the wait command while dragging really needed?
Well I made them wait as it solves the nasty problem of a unit completing a command while you were dragging another, I couldn't think of another solution.
By breaking the patrols do you mean they dont work at all or that they just do wierd stuff?
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Post by ZellSF »

LordMatt wrote:
ZellSF wrote: Yes it does.

You must've accidentally set repeat on if you think it doesn't.
No. You must not have the latest version, have something wrong with your luaUI install, not be doing it right, etc...
No, I have the latest version, my LuaUI install works, and I'm dragging them just like I'm dragging any other order.

Tim-the-maniac: if I drag the current target (which is shown with an attack cursor) it keeps the patrol and adds an extra point, if I drag any of the other patrol points, the current target disappears after the unit has gotten to it,
Post Reply

Return to “Lua Scripts”