dirtybob Posted August 22, 2005 Posted August 22, 2005 Id like to make a simple script that while playing World Of Warcraft would read a line from a txt file and send it to WOW. So say in game i hit the "M" key, the script would then read line one, and send it to WOW. Ghetto expamle: ; Sets the "Pause" Key to Exit. HotKeySet("{PAUSE}", "EndScript") : Sets the "M" key to send text to the WOW window. HotkeySet("{PAUSE}", "Talky") ; Brings up the WOW window. WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) talky() :Waits for the "M" key to be pressed and sends the line to the window func (talky) While 1 hotkey is pressed $line = FileReadLine($file) send $line If @error = -1 Then talky() EndIf Wend Am i even close?
Gigglestick Posted August 22, 2005 Posted August 22, 2005 (edited) Getting close. Try a _FileReadToArray to get the whole file and use a For loop to go through it line by line. Also, you are using Pause for both functions. Make sure you change the Talky one to "M"... or better yet use a combo like "!m" for alt-m because AutoIt will capture the M key from ALL other programs. And if you're using this while you're already playing WOW, it's already activated, so you don't need the WinActivate and WinSetOnTop stuff... or maybe you do, I haven't scripted games yet. Edited August 22, 2005 by c0deWorm My UDFs: ExitCodes
dirtybob Posted August 22, 2005 Author Posted August 22, 2005 How about the random() function. It seems like it would be easyer to set everything up within one Au3 file. Im just not sur ehow to generate a random number and then take that and send a string of txt that corresponds with the number. expandcollapse popup; Sets the "Pause" Key to Exit the script. HotKeySet("{PAUSE}", "EndScript") HotKeySet("{m}", "Talky") ; Globals $win_title = "World of Warcraft" $1 = "hey hey" $2 = "hey now" $3 = "woo woo" WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) func talky() Random([[1 ,] 3]) ;Random number between 1 and 3. Each number calls a global. If Random([[1 ,] 3]) = 1 Then Send("{$1}") Elseif Random([[1 ,] 3]) = 2 Then Send("{$2}") Elseif Random([[1 ,] 3]) = 3 Then Send("{$3}") Else Talky() Endif endfunc Func EndScript() $exit = MsgBox(4, "Ender", "Exit the scipt?") If $exit = 6 Then Exit EndIf EndFunc Or would i use $var1 $var2 and $var3 in stead of $1 $2 $3? my brain hurts
Gigglestick Posted August 22, 2005 Posted August 22, 2005 (edited) Dim $array[3] = ["hey hey","hey now","woo woo"] Send($array[Random(1,3,1)]) Edit: Syntax issues Edited August 22, 2005 by c0deWorm My UDFs: ExitCodes
SupraNatural Posted August 22, 2005 Posted August 22, 2005 Dim $array[4] $array[1]= "hey hey" $array[2]="hey now" $array[3]="woo woo" Send($array[Random(1,3,1)]) Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!
JoshDB Posted August 23, 2005 Posted August 23, 2005 You can easily return text from INI files. I use something like this in Guild Wars, for sending common shouts, emotes, etc. Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
dirtybob Posted August 23, 2005 Author Posted August 23, 2005 (edited) TY guys/gals for all the help. Got it done and it wooks great. Basily it does the voice emote "Im out of Mana." , triggers a key to drink mana juice, and quotes a silly line about drinking. Heres the code: expandcollapse popup; <AUT2EXE VERSION: 3.1.0.4> ; ---------------------------------------------------------------------------- ; <AUT2EXE INCLUDE-START: C:\Documents and Settings\Home\My Documents\Oomer.au3> ; ---------------------------------------------------------------------------- ; ; Oomer by Dirtybob. ; Just hit PAUSE to end. ; Thanks to the guys on the Au3 forums for answering my questions. HotKeySet("{PAUSE}", "Terminate") HotKeySet("{END}", "ShowMessage") ;Just some quites. Dim $array[38] $array[1]= "I drink i can I drink i can." $array[2]="Ahhh sweet pimp juice." $array[3]="Ahhh Jeez, it's warm." $array[4]="A drunk mans words are a sober mans thoughts." $array[5]="No animal ever invented anything as bad as drunkenness - or so good as drink." $array[6]="People who drink to drown their sorrow should be told that sorrow knows how to swim." $array[7]="Drink what you want, drink what you're able. If you are drinking with me, you'll be under the table." $array[8]="Ahh the good old days when beer foamed and drinking water didn't." $array[9]="Be wary of strong drink. It can make you shoot at tax collectors... and miss." $array[10]="Work is the curse of the drinking classes." $array[11]="The problem with the world is that everyone is a few drinks behind." $array[12]="You're not drunk if you can lie on the floor without holding on." $array[13]="He was a wise man who invented beer." $array[14]="If you drink, don't drive. Don't even putt." $array[15]="My Grandmother is over eighty and still doesn't need glasses. Drinks right out of the bottle." $array[16]="When I read about the evils of drinking, I gave up reading." $array[17]="Reminds me of my safari in Africa. Somebody forgot the corkscrew and for several days we had to live on nothing but food and water." $array[18]= "Nah its not booze, honest." $array[19]= "Conjoured Spring water, the choice of a new generation." $array[20]= "Tastes great, less filling." $array[21]= "Can i buy you one?" $array[22]= "People who don't drink are afraid of revealing themselves." $array[23]= "It's a long time between drinks." $array[24]= "I don't drink these days. I am allergic to alcohol and narcotics. I break out in handcuffs." $array[25]= "A man's got to believe in something. I believe I'll have another drink." $array[26]= "I've never been drunk, but often I've been overserved." $array[27]= "Time is never wasted when you're wasted all the time." $array[28]= "A drink a day keeps the shrink away." $array[29]= "I've stopped drinking, but only while I'm asleep." $array[30]= "A woman drove me to drink, and I hadn't even the courtesy to thank her." $array[31]= "The difference between a drunk and a alcoholic is that a drunk doesn't have to attend all those meetings." $array[32]= "I drink too much. The last time I gave a urine sample it had an olive in it." $array[33]= "Prohibition is better than no liquor at all." $array[34]= "I know I'm drinking myself to a slow death, but then I'm in no hurry." $array[35]= "I exercise strong self control. I never drink anything stronger than gin before breakfast." $array[36]= "An alcoholic is anyone you don't like who drinks more than you do." $array[37]= "I drink therefore I am." $win_title = "World of Warcraft" WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) While 1 Sleep(100) WEnd Func ShowMessage() ;This is my in game macro key to voice emote the out of mana. Send("+l" ) sleep(300) ;This is the key i have set to hold my mana juice. Send("=") sleep(175) Send(" {ENTER} " ) Send($array[Random(1,38)]) Send("{ENTER}" ) EndFunc Func Terminate() Exit 0 EndFunc Ugg too tired right now to explain anything, fairly easy to understand i think. Hope you like. Edited to remove the line ";Run("notepad.exe")" i was useing for testing. Sooo tired. Edited August 23, 2005 by dirtybob
SupraNatural Posted August 23, 2005 Posted August 23, 2005 (edited) Always happy to help a fellow game scripter Now only if you can make something like this for diablo 2 Edited August 23, 2005 by SupraNatural Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!
dirtybob Posted August 23, 2005 Author Posted August 23, 2005 haha Ill need your copy of the game and your acount info.
SupraNatural Posted August 23, 2005 Posted August 23, 2005 you can get the demo from www.blizzard.com Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!
dirtybob Posted August 23, 2005 Author Posted August 23, 2005 Ahhh free demo. ill get back to you tomorrow.
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