PDA

View Full Version : Nested Ifs?



wolpak
04-12-2009, 06:37 PM
Any way to do a nested if?

Ie...

<If MouseIsOverWindowRect 486 855 42 42>
<If ActiveWinIs WoW1>
<DoHotKey HotKey F4>

Maxion
04-12-2009, 06:41 PM
That would be getting into bannable areas.

wolpak
04-12-2009, 06:47 PM
Actually, it is doable and I was writing my script wrong. No need for nested Ifs, I forgot an argument...

Freddie
04-12-2009, 06:56 PM
That would be getting into bannable areas.
What do see there that's bannable? Are you imagining that the script causes mouse clicks at those coordinates? That's not what it does. Those coordinates are for input to HotkeyNet, not output from HotkeyNet. The script means, "When I move the mouse cursor with my hand to the on-screen button at that location, and press the mouse button with my finger..."


Any way to do a nested if?
Unfortunately, no, not in this version of the program. That's the main reason why I'm writing a new interpreter with a new script language. I've been working on it this weekend. In the meantime there are work arounds as you obviously discovered. :)

wolpak
04-12-2009, 06:59 PM
That would be getting into bannable areas.
What do see there that's bannable? Are you imagining that the script causes mouse clicks at those coordinates? That's not what it does. Those coordinates are for input, not output. The script means, "When I move the mouse cursor with my hand to the on-screen button at that location, and press the mouse button with my finger..."


Any way to do a nested if?
Unfortunately, no, not in this version of the program. That's the main reason why I'm writing a new interpreter with a new script language. I've been working on it this weekend. In the meantime there are work arounds as you obviously discovered. :)

Yeah, fortunately it asks for window argument which is exactly what I need. Now, no matter who the main window is, I can click on any portrait and switch to them, or click on any health bar and heal them. Sa-weet.

alcattle
04-12-2009, 11:27 PM
sounds like some nice scripts, like to share? :whistling:

wolpak
04-13-2009, 02:14 PM
I had been, nobody really responded much, so I thought that I was either recreating the wheel or nobody cared. Here is the heal script creation I posted a few days ago...

[HotKeyNet] FT2CH (Focusless, Targetless, 2 Click Heal) ('http://www.dual-boxing.com/forums/index.php?page=Thread&threadID=20953')

Basically, toggle acts like a variable for all of the hot keys. That can be very useful for creating dynamic scripts that are manipulated during gameplay. I hate keyboards, so I make a bunch of actionar icons to click. That got me to creating an imaginary box around my healthbar and then clicking a mouse button while my mouse was over the location. I have side buttons that I use for healing so I don't screw up with the left click target or right click options menu that occurs when you click on a portrait.

Almost anything that can be done on a keyboard can be done with a mouse thanks to DoHotKey (though I tried passing a HotKey to KHN directly and that didn't work).

Freddie
04-13-2009, 08:42 PM
I had been, nobody really responded much, so I thought that I was either recreating the wheel or nobody cared. Here is the heal script creation I posted a few days ago...
I think that's because the number of HotkeyNet users is relatively small. I know it's frustrating to post and receive no replies, but I hope you'll keep doing it because it encourages people to try HotkeyNet. The number of users is growing and eventually I think there will be replies.

wolpak
04-14-2009, 01:16 AM
Will I get a cut for people using your software when you start to make us pay for it? At least, I should get it free ;)

I think I found a way using HKN to get around the Party# issue for healing macros. Will be a complicated script, but I figure once it is posted, people can cut and paste it. Guess I will have to wait til tomorrow evening to test it out.

wolpak
04-14-2009, 01:22 AM
Oh, and for those who care, here are a few snippets of my code that hasn't been posted by someone else:

This code is actually only useful for the current team you are working on and will benefit from me figuring out what I was talking about in my previous post. The WindowRect locations are your unit frames and your HotKeys are choosing that player (f1 = player1). So, clicking on that unit frame then sends HotKey F4 which then moves that screen to my main and sets focus to him.


<If MouseIsOverWindowRect WoW1 486 855 42 42>
<DoHotKey HotKey F4>

<Else If MouseIsOverWindowRect WoW1 484 943 42 42>
<DoHotKey HotKey F5>

<Else If MouseIsOverWindowRect WoW1 1033 855 42 42>
<DoHotKey HotKey F2>

<Else If MouseIsOverWindowRect WoW1 1033 947 42 42>
<DoHotKey HotKey F3>

<Else If MouseIsOverWindowRect WoW2 486 855 42 42>
<DoHotKey HotKey F4>

<Else If MouseIsOverWindowRect WoW2 484 943 42 42>
<DoHotKey HotKey F1>

<Else If MouseIsOverWindowRect WoW2 1033 855 42 42>
<DoHotKey HotKey F5>

<Else If MouseIsOverWindowRect WoW2 1033 947 42 42>
<DoHotKey HotKey F3>


<Hotkey CTRL ALT Divide>
<Toggle>
<If MouseIsOverWindow WoW1>
<SendLabel w2>
<KeyDown Q>
<SendLabel w3>
<KeyDown Q>
<SendLabel w4>
<KeyDown E>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW2>
<SendLabel w1>
<KeyDown Q>
<SendLabel w3>
<KeyDown Q>
<SendLabel w4>
<KeyDown E>
<SendLabel w5>
<KeyDown E>
<If MouseIsOverWindow WoW3>
<SendLabel w1>
<KeyDown Q>
<SendLabel w2>
<KeyDown Q>
<SendLabel w4>
<KeyDown E>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW4>
<SendLabel w1>
<KeyDown Q>
<SendLabel w2>
<KeyDown Q>
<SendLabel w3>
<KeyDown E>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW5>
<SendLabel w1>
<KeyDown Q>
<SendLabel w2>
<KeyDown Q>
<SendLabel w3>
<KeyDown E>
<SendLabel w4>
<KeyDown E>

<Toggle>
<If MouseIsOverWindow WoW1>
<SendLabel w3>
<KeyDown Q>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW2>
<SendLabel w3>
<KeyDown Q>
<SendLabel w4>
<KeyDown E>
<If MouseIsOverWindow WoW3>
<SendLabel w2>
<KeyDown Q>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW4>
<SendLabel w2>
<KeyDown Q>
<SendLabel w5>
<KeyDown E>
<Else If MouseIsOverWindow WoW5>
<SendLabel w2>
<KeyDown Q>
<SendLabel w4>
<KeyDown E>



<HotkeyUp CTRL ALT Divide>
<Toggle>
<If MouseIsOverWindow WoW1>
<SendLabel w2>
<KeyUp Q>
<SendLabel w3>
<KeyUp Q>
<SendLabel w4>
<KeyUp E>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW2>
<SendLabel w1>
<KeyUp Q>
<SendLabel w3>
<KeyUp Q>
<SendLabel w4>
<KeyUp E>
<SendLabel w5>
<KeyUp E>
<If MouseIsOverWindow WoW3>
<SendLabel w1>
<KeyUp Q>
<SendLabel w2>
<KeyUp Q>
<SendLabel w4>
<KeyUp E>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW4>
<SendLabel w1>
<KeyUp Q>
<SendLabel w2>
<KeyUp Q>
<SendLabel w3>
<KeyUp E>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW5>
<SendLabel w1>
<KeyUp Q>
<SendLabel w2>
<KeyUp Q>
<SendLabel w3>
<KeyUp E>
<SendLabel w4>
<KeyUp E>

<Toggle>
<If MouseIsOverWindow WoW1>
<SendLabel w3>
<KeyUp Q>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW2>
<SendLabel w3>
<KeyUp Q>
<SendLabel w4>
<KeyUp E>
<If MouseIsOverWindow WoW3>
<SendLabel w2>
<KeyUp Q>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW4>
<SendLabel w2>
<KeyUp Q>
<SendLabel w5>
<KeyUp E>
<Else If MouseIsOverWindow WoW5>
<SendLabel w2>
<KeyUp Q>
<SendLabel w4>
<KeyUp E>


This is my movement code. Moves 2 toons out and then 4 toons out putting them in a straight line. Looks cool and is an eye grabber when people are watching. That's really it for now.

wolpak
04-14-2009, 11:24 AM
Any way to do a nested if?
Unfortunately, no, not in this version of the program. That's the main reason why I'm writing a new interpreter with a new script language. I've been working on it this weekend. In the meantime there are work arounds as you obviously discovered. :)[/quote]

Actually, you are wrong, kinda. While Freddie is smart, HotKeyNet is stupid. Literally, and fairly easy to trick. Just tested this out and it works.


<Label NP local sendwinm NP>

<Hotkey f2>
<setVar test test>

<Hotkey f1>
<If test is test>
<sendlabel NP>
<DoHotkey hotkey f3>

<HotKey F3>
<If ActiveWinIs NP>
<sendlabel NP>
<Key F1>

NP is Notepad and F1 opens up the help box.

So, hitting F1 after I load the script does nothing. Hitting F1 after hitting F2 does nothing. Hitting F1 while NP is the active screen opens up notepad. So, to nest if you have to create a new hotkey. Not a big deal if you then use modifiers since you are just sending that hotkey to hotkeynet.

What does this mean? Well, it allows me to get around Toggle and use setvar and hopefully it will allow me to target any unit frame and know exactly who it is to heal or whatever based on party position. Of course, it will be fairly complciated code, but I think I like setting stuff up more than actually playing the game.