Jump to content

Simple Chatter. Idea, but nee help.


Recommended Posts

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?

:whistle:

Link to comment
Share on other sites

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 by c0deWorm

My UDFs: ExitCodes

Link to comment
Share on other sites

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.

; 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 :whistle:

Link to comment
Share on other sites

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:

; <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.

:whistle:

Edited to remove the line ";Run("notepad.exe")" i was useing for testing. Sooo tired.

Edited by dirtybob
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...