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: 2464
Joined: 12 Oct 2007, 09:24

Area Mex

Post by Google_Frog »

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 50 times
cmd_area_mex.lua
(10.62 KiB) Downloaded 60 times
Last edited by Google_Frog on 27 Feb 2009, 05:28, edited 5 times in total.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Area Mex

Post by Forboding Angel »

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
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Area Mex

Post by Niobium »

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.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

Thanks. That was the problem.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Re: Area Mex

Post by ginekolog »

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
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer »

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.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Re: Area Mex

Post by 1v0ry_k1ng »

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

Re: Area Mex

Post by Niobium »

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
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Area Mex

Post by lurker »

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?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer »

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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer »

Thanks, the "I don't think car made it" has now propagated over to springinfo.info. Wanna fix that sometime this decade?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Area Mex

Post by lurker »

Fixed. Think of the ending remark now as incentive.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Mex

Post by CarRepairer »

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.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Mex

Post by Google_Frog »

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.
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Re: Area Mex

Post by ginekolog »

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.
Post Reply

Return to “Lua Scripts”