This simple widget executes default commands on right mouse button press. Makes it easier to target stuff with default commands.
It has been disabled for move commands to make it easier to draw customFormation move lines.
Guard commands can be disabled easily aswell if you want it to be easier to draw lines of move commands on top of friendly units.
Execute default command on right mouse button press
Moderator: Moderators
Execute default command on right mouse button press
- Attachments
-
- cmd_execute_default_command_on_mouse_press.lua
- (3.87 KiB) Downloaded 22 times
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Execute default command on right mouse button press
Can you explain this better?
Re: Execute default command on right mouse button press
A mouse button click consist of button press and button release. Default behaviour on mouse button click, for most commands, is that you get a single target command if you don't move the mouse between button press and button release and that you get an area command if you move the mouse between button press and button release.
The default commands, or "context-sensitive" commands, is the commands that you get when you have units selected and hover the mouse over a unit or feature. Then you can see the context-sensitive mouse cursor changing between different command cursors. If you have units with weapons selected and hover the mouse over an enemy, you will get an attack command for example.
This widget overrides the default behaviour for right mouse button click and gives the default command to your units directly on right mouse button press. This makes it easier to target a specific unit with a default command because it doesn't matter if you move the mouse between button press and button release. With the default mouse behavior, you will get an area command if you move the mouse and that area command could miss the intended target or target another unit first.
For further discussion, see topic: Targeting, precision and ambiguity when using the mouse.
While move commands could also be executed on mouse button press to target location, I personally find line move commands much more useful even if they are a bit slower to perform.
The default commands, or "context-sensitive" commands, is the commands that you get when you have units selected and hover the mouse over a unit or feature. Then you can see the context-sensitive mouse cursor changing between different command cursors. If you have units with weapons selected and hover the mouse over an enemy, you will get an attack command for example.
This widget overrides the default behaviour for right mouse button click and gives the default command to your units directly on right mouse button press. This makes it easier to target a specific unit with a default command because it doesn't matter if you move the mouse between button press and button release. With the default mouse behavior, you will get an area command if you move the mouse and that area command could miss the intended target or target another unit first.
For further discussion, see topic: Targeting, precision and ambiguity when using the mouse.
While move commands could also be executed on mouse button press to target location, I personally find line move commands much more useful even if they are a bit slower to perform.
Re: Execute default command on right mouse button press
Code: Select all
exceptions.CMD_MOVE = CMD.MOVE
...
function CheckCommand(number, commandList)
for _, command in pairs(commandList) do
if command == number then
return true
end
end
return false
end
Code: Select all
function CheckCommand(number, commandList)
return commandList[number] or false
end
Re: Execute default command on right mouse button press
True that. Yeah. I'm not thinking like its a Lua table.8611 wrote:You already know the index where something is, so can just check that instead of looping through whole table.