PDA

View Full Version : [Intermediate-Expert] Right Click Deny (Short)



Ignorance
01-13-2010, 08:44 PM
This guide is for those interested in how Right Click Deny works. It does not teach you how to make Right Click Deny and as such is not part of my tutorial series. It does explain everything I did in Right Click Deny, though, so someone who has made several intermediate level UI Mods could remake it with just this information.

Triggers
You should know by now that triggers only occur some of the time. In the case of AltInfo2Name, as well as all other alt info name triggers, they only go off when the unit is being hovered over. We are never told when this stops happening, but because the trigger goes off constantly when the unit is being hovered over, we can find out.
Whenever the trigger for name occurs, we set a boolean to 1.

Clickable Panel
Because clicking the ground would defeat the purpose of this mod, we need to make a background at the very start of game.interface as a clickable surface. This way, it's behind all of the interface stuff but in front of the game itself. The panel is huge, covering the entire screen. It's easy to test it by setting its color to anything other than invisible.

Actions
You can take actions onclick. You can take them anywhere, in response to anything. There's something different between right click and commander secondary and that is that commander secondary will click the screen, not the clickable panel. Because this is true, we can simply put an OrderAttack action before a CommanderPrimary action and have it activate on right click. This is the same thing that happens when you right click an enemy. The only difference is how this process is brought about.

SetNoClick
noclick="" determines whether or not a panel is clickable. As such, we can use it to activate our panel on right click (or left click, if we so choose) but also must make CommanderPrimary occur whenever left is clicked. We should also switch these whenever someone wants to play left-handed.

Disable with OnFrame
To be honest, I have no idea how this part works. I set it so that it would disable it every frame, but the actual order in which things occur obviously puts onframe after rightclick and before alt info name. If this weren't the case, I could have simply used an int and then when it was the same two frames in a row, I would reset it. There are times we get lucky, though.

ToolTargetingEntity
There are obviously times when we don't want to right click on units and deny them: when we're targetting spells and when we're shift-clicking. ToolTargetingEntity goes off whenever you are actively targeting and ability. Obviously, I set this to not go off when this happens. Otherwise, it becomes impossible to cast any ranged spell. There's also the issue of shift-clicking. GetModifier1() represents whether or not shift is being held, or more specifically, whenever the modifier usually attributed to shift is being held. I would rather be able to have some way to follow units around, and shift clicking them allows me to do that. I assign it to shift-click because shift-click denying is usually not very productive and is still possible if you press 'a'.

Alt Info Name Exceptions
You only want to be able to deny a few certain kinds of creeps. Therefore, because we're already watching something that tells us their names, we only set the boolean for this mod true when we can see the names. It is important to never set it false because the only time a blank entry is given is when you're hovering over something, which isn't a time you should be canceling this, but also isn't a time you should activate it because you don't know the name and it could be kongor's token or a rune. Thus, we make this only activate when the alt info name matches that of a creep.

That's it. Right Click Deny is not a complex mod. It just requires a fair bit of knowledge and a good understanding of programming logic.