Give Order

Give Order

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

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Give Order

Post by smoth »

Code: Select all

Spring.GiveOrderToUnit

 ( number unitID,
   number cmdID,
   params = {number, etc...},
   options = {"alt", "ctrl", "shift", "right"} ) -> nil

Spring.GiveOrderToUnitMap

 ( unitMap = { [unitID] = dontCare, etc... },
   number cmdID,
   params = {number, etc...},
   options = {"alt", "ctrl", "shift", "right"} ) -> nil

Spring.GiveOrderToUnitArray

 ( unitArray = { [1] = unitID, etc... },
   number cmdID,
   params = {number, etc...},
   options = {"alt", "ctrl", "shift", "right"} ) -> nil

Spring.GiveOrderArrayToUnitMap

 ( unitMap = { [number unitID] = dontCare, etc... },
   orderArray = {
     { number cmdID,
       {number, etc...},     params
       {"alt", "ctrl", "shift", "right"}   options
     }, ..
   }
 ) -> nil

Spring.GiveOrderArrayToUnitArray

 ( unitArray = { [1] = number unitID, etc... },
   orderArray = {
     { number cmdID,
       {number, etc...},    params
       {"alt", "ctrl", "shift", "right"}   options
     }, ..
   }
 ) -> nil
This is bad because the key bindings may change and if you rely on set hotkeys that means your gadget will break if the user changes hotkeys.

so i am left asking why? is there a way to give a unit an order without having to use the hotkeys? Did I miss something?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Give Order

Post by Argh »

I could have sworn that the control-key params (ctrl, etc.) were generically provided by the engine, i.e., it isn't really mapped to ctrl, it's mapped to whatever the command is mapped to. Test re-binding them to something weird- if it breaks, I'd strongly support an engine change, because the only other way to fix it is to force the keybinds for your game.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Give Order

Post by smoth »

ah, options can be 0, thanks nemo.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Give Order

Post by Argh »

Yar, that too. I thought you meant you had to have the shift param, like in the copy-orders script I use.
Post Reply

Return to “Lua Scripts”