AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2 x Star Wars Galaxies

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Mon Sep 15, 2008 11:24 pm    Post subject: 2 x Star Wars Galaxies Reply with quote

Hi,

I'm trying to write a script for Star Wars Galaxies such that I can control two characters at the same time.
Basically, I want certain keystrokes to be sent to two different Star Wars Galaxies windows at the same time.

However, I cannot seem to get the script to work.
I've searched the forums and also been looking on google and I've read the helpfile quite a bit.

I have tried adding messageboxes and it seems like the script is running through with no errors which is why I am at a loss here...

Any help would be greatly appreciated.

This is the script I have so far:

WinGet, swgid, List, Star Wars Galaxies

~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
ControlSend,, 7, ahk_id %swgid1%
ControlSend,, 7, ahk_id %swgid2%
Return
}

WinGet, swgid, List, Star Wars Galaxies

~8::
KeyWait 8
IfWinActive, Star Wars Galaxies
{
ControlSend,, 8, ahk_id %swgid1%
ControlSend,, 8, ahk_id %swgid2%
Return
}

WinGet, swgid, List, Star Wars Galaxies

~9::
KeyWait 9
IfWinActive, Star Wars Galaxies
{
ControlSend,, 9, ahk_id %swgid1%
ControlSend,, 9, ahk_id %swgid2%
Return
}

WinGet, swgid, List, Star Wars Galaxies

~0::
KeyWait 0
IfWinActive, Star Wars Galaxies
{
ControlSend,, 0, ahk_id %swgid1%
ControlSend,, 0, ahk_id %swgid2%
Return
}
Return



Thank you!
Back to top
View user's profile Send private message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Tue Sep 16, 2008 12:13 am    Post subject: Reply with quote

A small update, if I use "Send" it works, but obviously "Send" only sends the keystroke to the active window which defeats the whole purpose of writing this script.

... just thought I'd add it in case it makes any difference.
Back to top
View user's profile Send private message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Tue Sep 16, 2008 1:31 pm    Post subject: Reply with quote

I know SWG isn't the most commonly played game these days, but noone has used AHK to play 2xSWG's?
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 726
Location: Calgary, AB, Canada

PostPosted: Tue Sep 16, 2008 3:32 pm    Post subject: Reply with quote

I assume it would be quite similar to World of Warcraft Multi-Boxing... Have you tried taking a look at those scripts? Do a forum search.
Back to top
View user's profile Send private message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Tue Sep 16, 2008 3:38 pm    Post subject: Reply with quote

Sivvy wrote:
I assume it would be quite similar to World of Warcraft Multi-Boxing... Have you tried taking a look at those scripts? Do a forum search.


The script I posted is based on a WoW script, and I did a forum search and looked through a multitude of them, and pretty much all of them use the functions as I have them.

Also, I verified the functions used and I cannot see any errors in the script I've posted, but it still doesn't work :-/
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 726
Location: Calgary, AB, Canada

PostPosted: Tue Sep 16, 2008 3:45 pm    Post subject: Reply with quote

Maybe try moving all of the"Return" statements outside the If statements. I think that may contribute. They are all inside the Braces.
Back to top
View user's profile Send private message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Tue Sep 16, 2008 6:36 pm    Post subject: Reply with quote

Thanks for the suggestion, unfortunately, oving the return makes no difference.

I have actually realized that ControlSend is the part that is not working.

If I do it this way it works, although the swapping windows part is extremely annoying and I would prefer to not to it this way.

~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
IfWinActive, ahk_id %swgid1%
{
WinActivate, ahk_id %swgid2%
Sleep, 500
Send, 7
Sleep, 100
WinActivate, ahk_id %swgid1%
Sleep, 2000
Return
}

IfWinActive, ahk_id %swgid2%
{
WinActivate, ahk_id %swgid1%
Sleep, 500
Send, 7
Sleep, 100
WinActivate, ahk_id %swgid2%
Sleep, 2000
Return
}
Return
}
Back to top
View user's profile Send private message
Bytales



Joined: 06 Sep 2008
Posts: 84

PostPosted: Tue Sep 16, 2008 7:34 pm    Post subject: Reply with quote

If win Exist, (window 1) by ahk class, make it active, send the click.
Try making active the window you want to click before each click !
Back to top
View user's profile Send private message
muffen



Joined: 15 Sep 2008
Posts: 11

PostPosted: Tue Sep 16, 2008 7:39 pm    Post subject: Reply with quote

I made http://www.autohotkey.com/forum/viewtopic.php?t=35851 thread as I've narrowed down the problem, and to explain it a bit better.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group