Aghhh! Sorry to burden with yet another question.
The autotargeting of the custom functions is giving me some issues. Is there a way to turn off auto-targeting temporarily? I found this in the threads:
|
Source code
|
1
2
|
--Select Next Enemy
if (tDead) then TargetUnit("") return end--[[ if mainClass == 'RANGER' and (not party) then --To keep scouts from pulling mobs without meaning to. if (not LockedOn) or (not enemy) then TargetNearestEnemy() return end elseif mainClass ~= 'RANGER' then --Let all other classes auto target. if (not LockedOn) or (not enemy) then TargetNearestEnemy() return end end--]] end
|
You'll likely end up with comment problems when everything is on one line as shown.
Also, you may have a extra
end statement at the end of that, though it may just have been extra from a cut/paste.
Commenting the code out like that means that if the target is seen as dead, then it will clear your current target.
What I want to do is use my own targeting macro, which skips pets in siege. Would the above approach work so I can do my own targeting?
Unless there is some other targeting code at the start of the function or elsewhere, this should be fine. Be aware that there are posts in this thread for targeting non-pets as well as only players, so you could use that as well.
Also, do I understand correctly that surrounding the above script in --[[ x ]]-- will disable and that ---[[ x ]]--- will enable?
You are mostly correct.
Technically Lua block comments start start with
--[[ and end with
]]. You can also put any number of equal signs between the double brackets and Lua will look for a matching closing set. For example,
--[===[ is closed with
]===].
The triple dash trick to disable the block comment works because Lua's single line comment is the double dash. Adding the extra dash to --[[ mean that Lua sees this as a line comment instead of the block comment which effectively disables the block comment. But this means that the close block comment is now alone and will cause an error, so putting a double dash
in front of it will ensure that it works in either case. Note that we don't need to put the triple dash for the close block comment.
Example of a block comment active
|
Source code
|
1
2
3
|
--[[
some stuff here
--]]
|
Example of de-activated block comment
|
Source code
|
1
2
3
|
---[[
some stuff here
--]]
|
Thanks as usual for the very kind help. I'm learning, but it's a serious curve!
It can be, but the more you learn, the easier it gets.