para Posted January 10, 2005 Share Posted January 10, 2005 I am trying to finish up a bot for the game Diablo 2. This bot will do many many differant things. I want to run it from a computer in a differant room, and control it remotly from the computer I am on. The bot will do the commands I tell it from reading text on the screen. So if I say !join ppq q That would tell it to click on "JOIN" and type in ppq and hit tab then type q for the password. It would then hit enter. I used Do WinWait("WindowName", "!join ppq q") Until WinExists("adsad") Then it would do the following. The problem I run into is that it will continue to do the command join and type in the username and password non stop. Because its on the screen... My other problem is having more then 1 command to wait for. If anyone can help, my question is... How can I make autoit wait for a certain text to come on the screen from a list of say 20 differant options or so, then do the command from the list of available options to do, and only do it once, then wait for a new line to appear, then do that command, from the list of 20 or so. Thanks alot! I can provide more script if needed. -Para Link to comment Share on other sites More sharing options...
the_lord_mephy Posted January 11, 2005 Share Posted January 11, 2005 (edited) How are you getting the text through one computer to the other, could you post the whole script or atleast this section of it? If you want, that would be helpful. (You don't have to) Edited January 11, 2005 by the_lord_mephy My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 Getting the text from one comptuer to another is simple. The game Diablo 2 is run on the Battle.net Servers. They have a chat serves that uses "channels" to contact each other in chat. I have the bot enter a channel that I specify that is private to me and my bot. It will read the text from the screen. I just need to know how to make it only read it once, and how to have more then 1 option. I was reading some more in the help and found "OR". Maybe that would work. Now I need to know(if "or" will work) how to make it read the NEW line on the screen 1 time and then reset itself to wait for the next command, from the list of 20 or so. Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 You'd have to make it READ the text in game, which is far ahead of your skills right now. I suggest you send it through TCP. Look in the scripts and scraps section for Lar's UDF's "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
the_lord_mephy Posted January 11, 2005 Share Posted January 11, 2005 Yeah that's what I was getting at. I used to play D2. You'd need to use pixel search and crap. Do you want to be the only person to use it? because you could probably like send a msg through AIM or something and have it respond to that =\ My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 Ok... Then I can do it with aim. Anyway its done, how would i make it re-loop? How would I make it only do it once? Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 Help file, look under "Keyword/Statement Reference"... there are also plenty of tutorials in the help file. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 I've been reading, isn't there just a few keywords that could be said? Ones that would answer my questions? Link to comment Share on other sites More sharing options...
phillip123adams Posted January 11, 2005 Share Posted January 11, 2005 DoWinWait("WindowName", "!join ppq q")Until WinExists("adsad")How can I make autoit wait for a certain text to come on the screen from a list of say 20 differant options or so, then do the command from the list of available options to do, and only do it once, then wait for a new line to appear, then do that command, from the list of 20 or so.Here's a wild shot in the dark!; The bot just issued the join command, user name and password.; Wait for one of several windows to appear.SplashTextOn("Waiting for window", "Waiting for window to appear...", 300, 25)While 1 If WinExists("WindowName", "!join ppq q") or _ WinExists("WindowName", "xx1") or _ WinExists("WindowName", "xx2") or _ WinExists("WindowName", "xx3") Then ExitLoop EndIf sleep(100)WEnd; Wait for the 'adsad' window to appearSplashTextOn("Waiting for 'adsad' window", "Waiting for 'adsad' window...", 325, 25)WinWait("adsad")SplashOff();; All windows appeared, so do something. Phillip Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 What are you doing? You're reading window names for commands? Why don't you test this out and see what works? You got the loop right "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 (edited) That wasn't me who posted that help. That seems like it might lead to me getting this working, the only thing is how would I tell it what to do if a certain text appeared. The window name will always be the same. Its the text that will change. It needs to read it, but only once. So Like... maybe some how read the next line? and no more? until a new line appears? The "OR" statement I believe is the key to making it so that I can use multiple commands instead of having just one. Thanks for the help, more would be greatly appriciated! Also, I see were your coming from with your script, but lets say I want a command to work for the channel? To say somthing, or maybe a channel operating bot? To ban or kick... How would I make it so that it works but the window NAME doesn't change? Thanks! Edited January 11, 2005 by para Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 ; The bot just issued the join command, user name and password. ; Wait for one of several windows to appear. SplashTextOn("Waiting for window", "Waiting for window to appear...", 300, 25) While 1 If WinExists("Untitled - Notepad", "!run notepad") Then Run("notepad.exe") EndIf If WinExists("Untitled - Notepad", "!run paint") Then Run("mspaint.exe") EndIf If WinExists("Untitled - Notepad", "!run calc") Then Run("calc.exe") EndIf If WinExists("Untitled - Notepad", "!run cmd") Then Run("cmd.exe") ExitLoop EndIf sleep(100) WEnd ; Wait for the 'adsad' window to appear SplashTextOn("Waiting for 'adsad' window", "Waiting for 'adsad' window...", 325, 25) WinWait("adsad") SplashOff() ;; All windows appeared, so do something. That is the edited version of the script you gave me. That was my original idea too.... (I tested it with notepad commands just for sake of ease...) but the problem is... when the command is typed, it will continue to run the program over and over and over... How would I make it only run it once? Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 You can't get any text from the Diablo II window currently, so scratch that idea. You CAN however do this: Wait for a trigger key, like ` or similar. Read the text sent after that key, process commands based on it, for example: `join baal-01/1 `say Spank! It'd be very simple. Just use the TCP/IP stuff I mentioned... and wow, this sounds like a great script I may even have to make myself . Having a nice hog to spam games would be nice. Also you can do some basic stuff minimized, if you have a D2BS backend or something then you could easily control multiple D2's from one computer to the next. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 (edited) You can't get any text from the Diablo II window currently, so scratch that idea.You CAN however do this:Wait for a trigger key, like ` or similar.Read the text sent after that key, process commands based on it, for example:`join baal-01/1`say Spank!It'd be very simple. Just use the TCP/IP stuff I mentioned... and wow, this sounds like a great script I may even have to make myself . Having a nice hog to spam games would be nice. Also you can do some basic stuff minimized, if you have a D2BS backend or something then you could easily control multiple D2's from one computer to the next.<{POST_SNAPBACK}>I can use aim for commands.I dont understand how you mean for me to implement this into a script.I have the script basically done, all I need is for it to NOT repeat the text on the screen over and over again. Just 1 time. But using the do until or the while wend causes it to continuesly loop, is this possible to beat?And my trigger key is !As I show, !run... Thanks Edited January 11, 2005 by para Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 Yeah... why don't you show us your code? If $doaction = 1 Then DoAction() EndIf It'll only do it if $DoAction = 1, set $DoACtion =1 when you recieve the command... "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 How do I set it to do that? While testing I came up with. $var1 = WinExists("Untitled - Notepad", "!run notepad") $var2 = WinExists("Untitled - Notepad", "!run paint") $var3 = WinExists("Untitled - Notepad", "!run calc") $var4 = WinExists("Untitled - Notepad", "!run cmd") While 1 If $var1 = 1 Then Run("notepad.exe") EndIf If $var2 = 1 Then Run("mspaint.exe") EndIf If $var3 = 1 Then Run("calc.exe") EndIf If $var = 1 Then Run("cmd.exe") EndIf WEnd I get an error saying I didn't declare the vars... but I specifically did right at the top... anything you guys see that I am missing? Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 Just get the window once... then use control read. Add a little sleep into the while so it's not constantly checking, saves CPU cycles. You declared them, but they didn't necesarilly(sp) return any values. Try this: Local $Var1, $Var2, ect. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 (edited) I don't believe there is a controlread. Hmm.... Decalring the vars would work like you put it, but how do I decalre what they do using that method? Did you mean ControlGetText? If so, can you show me an example of how to do this? thanks alot! Edited January 11, 2005 by para Link to comment Share on other sites More sharing options...
Insolence Posted January 11, 2005 Share Posted January 11, 2005 You just declare them, then use them. There IS a controlread... I just got the function name wrong . It's ControlGetText: ControlGetText ( "title", "text", controlID ) Use AutoIT spy to get the notepad edit controlid. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
para Posted January 11, 2005 Author Share Posted January 11, 2005 I'm a little confused. ; The bot just issued the join command, user name and password. ; Wait for one of several windows to appear. SplashTextOn("Waiting for window", "Waiting for window to appear...", 300, 25) $var1 = WinExists("Untitled - Notepad", "!run notepad") $var2 = WinExists("Untitled - Notepad", "!run paint") $var3 = WinExists("Untitled - Notepad", "!run calc") $var4 = WinExists("Untitled - Notepad", "!run cmd") While 1 If $var1 = 1 Then Run("notepad.exe") EndIf If $var2 = 1 Then Run("mspaint.exe") EndIf If $var3 = 1 Then Run("calc.exe") EndIf If $var = 1 Then Run("cmd.exe") EndIf WEnd What do I need to change to make the variables work? I thought declaring them was making it like $var1 = BLAH BLAH Then to use it you type $var1. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now