Jump to content

Troubles with select loop


Recommended Posts

Hi, I got this little snippet of code from a friend, and he's having trouble trying to loop it properly. Without further adieu, here it is.

#include <Array.au3>
While 1
    $data = WinGetText("eaa")
    $split = StringSplit($data,"Clone Action: ",1)
;~  _ArrayDisplay($split, "$avArray as a 2D array")
    $splited = StringLeft($split[$split[0]],8)
    Select
        Case $splited = "dodges l"
            ToolTip("LEFT",0,0)
        Case $splited = "dodges r"
            ToolTip("RIGHTT",0,0)
        Case $splited = "no movem"
            ToolTip("NO MOVEMENT",0,0)
        Case Else 
            ToolTip("I DONT SEE ANYTHING",0,0)
    EndSelect
    Sleep(100)
WEnd

Now, this functions fine and well, tells you which direction it is going, but when a Send proc is added to it, it gets jumbled. It will continously send the same key, even if the direction changes. (It goes from right to say, left, it will still send right, causing the training to stop in game)

I've tried adding a sleep before the select fork. Is thre something I'm missing with this? Anyone to point me in the right direction would be great, thanks!

Edited by DanHibiki
Link to comment
Share on other sites

Tried that, it ended the script entirely. This is a continuous thing, so for it to end after one detect would be somewhat fruitless (Unless I had another script restarting that script, but that seems a little hectic and not the right way) Should I use a certain level of exitloop?

Link to comment
Share on other sites

Thats the thing, this isn't exactly my script. This was given to me by a friend. I told him I would try to dabble and see if I could make it work, but I'm not exactly familiar with the language.

There are no hotkeys, but I looked at some examples on here of various things and noticed them.

This is the entire script. Is a hotkey to read the only thing I'm missing?

Link to comment
Share on other sites

Thats the thing, this isn't exactly my script. This was given to me by a friend. I told him I would try to dabble and see if I could make it work, but I'm not exactly familiar with the language.

Well that was just plain stupid. Surely the person who wrote the script in the first place knows more and could understand the help we give?
Link to comment
Share on other sites

It will continously send the same key, even if the direction changes.

2 Questions.

1.) How does the script 'continously' send the same key if there's no Send() Function even in it?

2.) And most important of all..how are you supposed to 'dabble' with it and get it to work if you don't even have the full script?

Link to comment
Share on other sites

Excuse me, I didn't include the send functions that I added. I removed them because they kept continously sending the key after a change of input should have occured. Here is what it is, in full, at current time.

#include <Array.au3>
While 1
    $data = WinGetText("eaa")
    $split = StringSplit($data,"Clone Action: ",1)
;~  _ArrayDisplay($split, "$avArray as a 2D array")
    $splited = StringLeft($split[$split[0]],8)
    sleep(50)
    Select
        Case $splited = "dodges l"
            ToolTip("LEFT",0,0)
            send("u")
        Case $splited = "dodges r"
            ToolTip("RIGHTT",0,0)
            send("o")
        Case $splited = "no movem"
            ToolTip("NO MOVEMENT",0,0)
            Send("i")
        Case Else 
            ToolTip("I DONT SEE ANYTHING",0,0)
    EndSelect
    Sleep(100)
WEnd

I only said it was a snippet because of its size. I don't know wether its the full outline of the script, or merely a part of it, but the function that is junking up is right in this area definately. Obviously stopping the script would be added later via hotkeys, but the problem I'm having right now is with the actual input itself. I figured taking it one step at a time would be good.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...