Spam chat

Ask gaming related questions (AHK v1.1 and older)
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Spam chat

22 Mar 2017, 13:22

Hello!
I'm trying to make ahk script to spam in game chat. The issue I have if I close the window of the game the script isn't spamming in game.
I added the #IfWinActive and still isn't working, also If I want to add for example #21 which code is it?

My code looks like this:

#IfWinActive Game name
SetTitleMatchMode,3
F1::
Toggle := !Toggle
If (!Toggle)
return
loop {
word = my text
send %word%{enter}
sleep, 8000
}
Return
F12:: Pause
Thank you in advance.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Spam chat

23 Mar 2017, 06:29

That is not how a toggle is done.

1) You will not be able to stop it, because once it enters the loop, it makes no check on the state of Toggle

2) You do not have EITHER
#MaxThreadsPerHotkey set to > 1
OR
A SetTimer to allow the hotkey to finish.

You need to fix your basic issues before trying to limit it to only work with a specific window.
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Re: Spam chat

23 Mar 2017, 11:09

evilC wrote:That is not how a toggle is done.

1) You will not be able to stop it, because once it enters the loop, it makes no check on the state of Toggle

2) You do not have EITHER
#MaxThreadsPerHotkey set to > 1
OR
A SetTimer to allow the hotkey to finish.

You need to fix your basic issues before trying to limit it to only work with a specific window.
Ok, how I can fix the basics first?? the script is spamming how it is..only the issue I have is with the window, like I said if I close the window do not spam anymore.

Need to add something else??
F1::
#MaxThreadsPerHotkey > 1
#IfWinActive Game name
SetTitleMatchMode,2
loop {
word = my text
send %word%{enter}
sleep, 8000
}
Return
F12:: Pause
Thanks
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Spam chat

23 Mar 2017, 11:13

#MaxThreadsPerHotkey > 1 Invalid syntax. I said it must be greater than 1, not to put "> 1" as the value...
Seeing as you use the syntax Toggle := !Toggle, I am guessing you read a thread about how to make a toggle.
Removing the change of the toggle value and removing any check for the value of Toggle is making things worse, not better.

I also said to remove the window detection until you have the basics working. You are only making it harder to get the basics working by having the window detection in there.

If a script is doing nothing, then adding an IfWinActive will never, ever fix it. It will break it more.
Last edited by evilC on 23 Mar 2017, 11:18, edited 1 time in total.
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Re: Spam chat

23 Mar 2017, 11:27

Is ok, is working..but the detection of the window doesn't.
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Re: Spam chat

23 Mar 2017, 13:35

I don't have Windows Sky installed, this is the screenshot taken from Tast Manager:

Image

I used #IfWinActive Revelation Online and also added the whole name that you see in task manager.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Spam chat

23 Mar 2017, 14:07

Why are you so focused on #IfWinActive and why are you using SetTitleMatchMode, 3 if presumably the title of your game window changes constantly(I don't know what Snowpine, MrGold, @2645629, 89234752897 mean, but I figure those aren't constant values)?

All #IfWinActive is going to do is enable your defined hotkey if the window is currently in focus. From what I gathered reading your initial post, you'd like to send shit to a background/minimized game window. Use ControlSend instead. You can keep the #IfWinActive directive, but do so only if it has a purpose. If you're just adding stuff on a trial-error basis, you wont get anywhere in a reasonable amount of time.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Spam chat

23 Mar 2017, 14:23

you'd like to send shit to a background/minimized game window. Use ControlSend instead. You can keep the #IfWinActive directive
Surely sending input to an inactive window and only triggering the hotkey if the window is active are mutually exclusive?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Spam chat

23 Mar 2017, 14:34

Yeah, you're right, they are.
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Re: Spam chat

23 Mar 2017, 14:57

swagfag wrote:Why are you so focused on #IfWinActive and why are you using SetTitleMatchMode, 3 if presumably the title of your game window changes constantly(I don't know what Snowpine, MrGold, @2645629, 89234752897 mean, but I figure those aren't constant values)?

All #IfWinActive is going to do is enable your defined hotkey if the window is currently in focus. From what I gathered reading your initial post, you'd like to send shit to a background/minimized game window. Use ControlSend instead. You can keep the #IfWinActive directive, but do so only if it has a purpose. If you're just adding stuff on a trial-error basis, you wont get anywhere in a reasonable amount of time.
Snowpine is the current server I'm logged, the rest is more likely the location. I used already SetTitleMatchMode, 3 and isn't working, is only work settled on 2 figure it changes that's why.

I tried with ControlSend as well, the same issue, if the window is minimized isn't "spamming" in game.

I used something like:
#ifwinactive Revelation Online

SetTitleMatchMode,2
return
loop {
ControlSend, , MY TEXT, Revelation Online
Sleep, 100
}
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Spam chat

23 Mar 2017, 18:06

Then you'd need to try out different send methods, dllcall, sendmessage, using a bit of delay, etc. If nothing else works, it might be simply cause by the fact that your game doesn't accept input, while not focused.
Joshuas
Posts: 6
Joined: 14 Mar 2017, 20:26

Re: Spam chat

23 Mar 2017, 20:32

ok thanks! One more thing, how I can make the macro to type symbol like # ?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 27 guests