Page 1 of 1

discriminatingly banned by decimator

Posted: 14 Nov 2006, 20:09
by MrNubyagi
discriminatingly banned by decimator

Posted: 14 Nov 2006, 21:37
by PRO_rANDY
To my knowledge, this cannot be done

Posted: 14 Nov 2006, 22:14
by trepan
I just wrote a SaveQueue() / LoadQueue() command set that might
help with this kind of situation. It saves the command queue for any
selected units when SaveQueue() is called, and appends the saved
queue when LoadQueue() is called.

Could also do command queue rebuilds to allow shifting specific
commands within the queue. I've already done some similar for
changing the build order counts in factory queues.

These types of queue routines can be expensive with respect to the
amount of network bandwidth they use. It all depends on how long
the queues are :-)

Posted: 15 Nov 2006, 04:43
by MrNubyagi
discriminatingly banned by decimator

Posted: 15 Nov 2006, 05:14
by trepan
It will affect network traffic, the commands are routed
through the network before being processed locally.

As for when you can see it ... here it is. This version
isn't setup for factory command queues yet, but it won't
take much to finish it off (I'm currently tweaking the
GetCommandQueue() / GetFactoryQueue() calls)

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  Save Queue interface
--

function SelectedString()
  local s = ""
  uidTable = Spring.GetSelectedUnits("raw")
  uidTable.n = nil  --  or use ipairs
  for k,v in pairs(uidTable) do
    s = s .. ' +' .. v
  end
  return s
end


savedQueue = {}

function SaveQueue()
  local uTable = Spring.GetSelectedUnits("raw")
  uTable.n = nil
  for x,uid in pairs(uTable) do
    local facQueue = Spring.GetFactoryQueue(uid);
    if (facQueue ~= nil) then
      savedQueue[uid] = facQueue
    else
      savedQueue[uid] = Spring.GetCommandQueue(uid)
    end
  end  
end    
       

function LoadQueue()
  local reselect = false
  local selstr = SelectedString()
  local uTable = Spring.GetSelectedUnits("raw")
  uTable.n = nil
  for x,uid in pairs(uTable) do
    local queue = savedQueue[uid]
    if (queue ~= nil) then
      for k,v in ipairs(queue) do  --  in order
        if (not v.options.internal) then
          local opts = {}
          table.insert(opts, "shift") -- appending
          if (v.options.alt)   then table.insert(opts, "alt")   end
          if (v.options.ctrl)  then table.insert(opts, "ctrl")  end
          if (v.options.right) then table.insert(opts, "right") end
          Spring.SendCommands({ "selectunits clear +" .. uid }) 
          Spring.GiveOrder( v.id, v.params, opts )
          reselect = true
        end
      end  
    end    
  end  
  if (reselect) then
    Spring.SendCommands({"selectunits clear" .. selstr})
  end
end

Posted: 15 Nov 2006, 09:54
by MrNubyagi
discriminatingly banned by decimator

Posted: 15 Nov 2006, 11:54
by trepan
It's lua stuff

"wait queued" will place the wait command at
the end of the queue, instead of executing it
immediately (the same is true for "selfd queued").

Posted: 15 Nov 2006, 16:42
by LOrDo
An insert unit into que command would be quite cool.

Posted: 15 Nov 2006, 21:16
by MrNubyagi
discriminatingly banned by decimator

Posted: 16 Nov 2006, 12:42
by Hunter0000
I thought holding alt already did this?

Though if I remember correctlty it immediantly switchs so you'd have to issue the order between the 3rd and 4th windmill, but I thought we already had this.

Posted: 17 Nov 2006, 05:55
by MrNubyagi
discriminatingly banned by decimator

Posted: 17 Nov 2006, 22:27
by MrNubyagi
discriminatingly banned by decimator

Posted: 23 Nov 2006, 05:49
by MrNubyagi
discriminatingly banned by decimator

Posted: 23 Nov 2006, 06:05
by trepan
That link should work again (the IP changed).

Posted: 23 Nov 2006, 06:33
by MrNubyagi
discriminatingly banned by decimator

Posted: 23 Nov 2006, 08:01
by trepan
bind Ctrl+Shift+w select AllMap+_Waiting+_ClearSelection_SelectAll