Area Mex

Area Mex

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

Moderator: Moderators

Post Reply
Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Area Mex

Post by Google_Frog » 07 Feb 2009, 05:35

Area Mex with Button
Area Mex without Button
Warning, only springfiles mirror provides correct version.

A widget I've been wanting to make for a while. I got around to it after recently playing a 3 way FFA on Conquer Isle and noticing that 50% of the map was uncapped just because of how much clicking it would take to make all those mexes.

This widget gives all selected mex constructors orders to create mexes in the defined circle. It's has basic path optimization that should find the best path most of the time and other times it's not far off.

The mex button needs ca_layout.lua to appear properly or it might appear in a strange place or not appear at all. The command can be bound with uikeys.txt though regardless of having ca_layout.lua with the command 'areamex' eg. 'bind ctrl+w areamex'.

It uses the mex detection code from easymetal by carrepairer.

v1.6 Added multiple mexes per constructor (underwater mexes).
v2.1 Merged with NTG file handling.

Attachments in case spring files fails.
Attachments
cmd_area_mex_no_button.lua
(10.65 KiB) Downloaded 45 times
cmd_area_mex.lua
(10.62 KiB) Downloaded 53 times
Last edited by Google_Frog on 27 Feb 2009, 05:28, edited 5 times in total.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14606
Joined: 17 Nov 2005, 02:43

Re: Area Mex

Post by Forboding Angel » 07 Feb 2009, 05:50

oi yes, this is a wonderful thing to have. Is there any way that someone could figure out what all is needed to make the button display correctly? Surely just for a button a particular layout wouldn't be needed O_O
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 07 Feb 2009, 06:33

CALayout doesn't do much. It adds lua commands into the command menu in the right order. Just extract it from ca.sdz, I'll probably get around to adding the relevant bit of CALayout to area mex if I'm not too lazy though.
0 x

User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Area Mex

Post by Niobium » 07 Feb 2009, 07:15

To fix your shift-required problem all you need to do is add 'return true' at the very end of the CommandNotify function.

Basically returning true tells spring that you've taken care of the CMD_AREA_MEX order and spring itself doesn't need to do anything. If you don't return true, spring continues and issues the CMD_AREA_MEX order to the unit. If shift was held, the command gets added to end of queue and the mex queue remains. If shift isn't held down, the new command overwrites previous queue (As happens with any order without shift held), but because CMD_AREA_MEX doesn't do anything by itself, the unit just stands there.

I'm 95% sure that will fix your problem and that my understanding of CommandNotify is correct.
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 07 Feb 2009, 07:23

Thanks. That was the problem.
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 07 Feb 2009, 09:31

Updated v1.2
Units which can't make mexes no longer show the command when selected.

Edit: Editing my uploads on JJ doesn't seem to be working.
0 x

User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Re: Area Mex

Post by ginekolog » 07 Feb 2009, 12:09

this widget wil be good but it has some troubles:

1. It keeps saying
[ 375] /give all
[ 678] /give 20 coraca
[ 680] Giving 20 coraca to team 0
[ 724] GetLuaCmdDescList() non "actions" table: pos
[ 724] GetLuaCmdDescList() non "actions" table: params
[ 1313] GetLuaCmdDescList() non "actions" table: pos
[ 1313] GetLuaCmdDescList() non "actions" table: params


2. With many units it gives big lag spikes every ~10 sec.

3. I suggest u to add also T2 cons units for ba, i added:
mexIds[UnitDefNames['armmoho'].id] = UnitDefNames['armmoho'].id
mexIds[UnitDefNames['cormoho'].id] = UnitDefNames['cormoho'].id
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 07 Feb 2009, 14:22

ginekolog wrote:this widget wil be good but it has some troubles:

1. It keeps saying
[ 375] /give all
[ 678] /give 20 coraca
[ 680] Giving 20 coraca to team 0
[ 724] GetLuaCmdDescList() non "actions" table: pos
[ 724] GetLuaCmdDescList() non "actions" table: params
[ 1313] GetLuaCmdDescList() non "actions" table: pos
[ 1313] GetLuaCmdDescList() non "actions" table: params


2. With many units it gives big lag spikes every ~10 sec.

3. I suggest u to add also T2 cons units for ba, i added:
mexIds[UnitDefNames['armmoho'].id] = UnitDefNames['armmoho'].id
mexIds[UnitDefNames['cormoho'].id] = UnitDefNames['cormoho'].id
I think the non "actions" are because you don't have calayout which is a widget that supports adding buttons to the interface with lua.

With the lag spikes I tried giving all then telling 20 aircons to make mexes all over tablua and I didn't get anything more than normal lag. Though if I had all the units selected the game froze for a second or two. The time between you giving the command and seeing the commands appear will be your ping just like every other command.
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer » 09 Feb 2009, 01:19

Google_Frog wrote:It uses the mex detection code from easymetal by carrepairer but I don't think car made it so thanks to whoever made the mex detection code.
I made that entire gadget from start to finish, so you're welcome.
0 x

User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Re: Area Mex

Post by 1v0ry_k1ng » 09 Feb 2009, 15:14

:-) :-) :-) :-)
0 x

User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Area Mex

Post by Niobium » 10 Feb 2009, 06:37

Sounds like a great widget, however when I have it enabled my fps will occasionally fall to 1 for no apparent reason, even with as little as 3 units on the entire map, and thats without ever issuing an area mex command :l

Maybe it's just a conflict with my particular setup, but it only ever happens with your widget enabled. So I don't know. Tested with CA as well as BA with ca layout
0 x

User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Area Mex

Post by lurker » 10 Feb 2009, 13:49

If he took car's code, then why is the lockup-escape clause not kicking in on metal maps, and spring freezing? Did car remove it or is it not trying hard enough?
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 11 Feb 2009, 07:16

Sorry about that car. When looking through the code I saw the mex spots were called flags instead of mexes so assumed it came from one of those mods that use flags.
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer » 11 Feb 2009, 17:31

lurker wrote:If he took car's code, then why is the lockup-escape clause not kicking in on metal maps, and spring freezing? Did car remove it or is it not trying hard enough?
I don't even remember if I added such an escape or not, I'll have to check.
Google_Frog wrote:Sorry about that car. When looking through the code I saw the mex spots were called flags instead of mexes so assumed it came from one of those mods that use flags.
Well yeah perhaps s44 was in my mind when I was naming the "spots" since they use metal spots as "flags" to capture. But I didn't even bother looking at their code since I preferred to make my own - which I assume would be obvious when looking at it. s44 was part the inspiration though.
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer » 15 Feb 2009, 17:39

Thanks, the "I don't think car made it" has now propagated over to springinfo.info. Wanna fix that sometime this decade?
0 x

User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Area Mex

Post by lurker » 16 Feb 2009, 02:28

Fixed. Think of the ending remark now as incentive.
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 16 Feb 2009, 06:34

Update: The command is now a circle not a square. Download from the JJ mirror because darkstars seems to take a while to update.

Car, I've edited the first post so people don't get confused and I'll look into some anti freeze for metal maps.
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer » 16 Feb 2009, 08:39

I think the reason I never took the time to care is because I made it for a mod option so it would only be used for the right maps. Now that it's a widget it's a different story.
0 x

Google_Frog
Moderator
Posts: 2441
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog » 26 Feb 2009, 11:45

I think the way I was placing the button using CAlayout was causing the lag spikes for some people. The button no longer shows up but I don't mind because I have a hotkey for it, idk if people want a button-free version though.
0 x

User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Re: Area Mex

Post by ginekolog » 26 Feb 2009, 13:07

Google_Frog wrote:I think the way I was placing the button using CAlayout was causing the lag spikes for some people. The button no longer shows up but I don't mind because I have a hotkey for it, idk if people want a button-free version though.
It caused big lagspikes for me so i stoped using it. Would love button free working vers .. i have hotkey ctrl+r ;)

ty.
0 x

Post Reply

Return to “Lua Scripts”