Jump to content


Hit a wall! (Help please)


  • Please log in to reply
10 replies to this topic

#1 Kram

Kram
  • Guests

Posted 18 July 2012 - 11:33 PM

Hey all really new to this kinda thing and been playing around for a few days, reading forums and just trying to learn for myself how to get a script to work but kind of feel I've hit a wall and was hoping someone with a bit more experience would help me with a script I've been writing for WoW.

The scripts pretty simple, it just spams 123 in that order over and over while I'm holding down the mouse button, if I hold it with shift down the same thing but giving me 3 new key binds at the same time, however sometimes it seems to get stuck on or not pick up that I'm either holding or have released the shift key. This seems to happen a lot more if I say am holding it and click shift + Q on the keyboard before I let the mouse button go, sometimes its fine and other times it goes crazy.

Hopefully someone can help me make it a little more stable. Thanks a lot! (I've tried to fix it for myself and read the forums before coming here and asking for help but again I've just hit a wall)

#IfWinActive World of Warcraft

$XButton1::
Loop
{
setkeydelay -1
MouseClick X1
send {Blind}1234567
if not GetKeyState("XButton1", "p")
break
}
KeyWait, Xbutton1
#MaxHotkeysPerInterval 500
return


#2 Guests

  • Guests

Posted 18 July 2012 - 11:39 PM

Just playing with it a little more it seems that if I hold the shift and then the mouse button to start with that the script won't work, does this mean I need a totally different script if I'm going to need to use shift and the mouse button first ??

Note: I use the mouse button by itself for 3 attacks and the the shift and mouse button for AoE attacks if that helps you understand what kind of script I'm aiming to make at all :D

#3 girlgamer

girlgamer
  • Moderators
  • 2039 posts

Posted 19 July 2012 - 12:16 AM

First of all a "script" is the whole thing and a hotkey is the key that starts a given routine running. they are not the same thing. A lot of people mix that up. As to your question, yes, a shift-xbutton1 (+Xbutton1) is not the same as XButton by itself. If you want to use a separate shift-xbutton1 routine that simple fact allows you to create one. So that's likely why you think the routine isn't running. Secondly, why on earth did you set #MaxHotkeysPerInterval 500??? OMG, that's nuts! You should never need more than 10 if you set up your script right except in extreme circumstances. Generally just 2 or 3. And finally, everyone wants their code to "dance as fast as it can" but that can be a huge problem unless you disallow other hotkeys from running or you slow down the speed. The reason being that the game has to have time to respond to the key you just sent. If it can't it may decide to ignore what you sent or in some cases even "stick out it's tongue" at on you. Meanwhile your script is merrily slogging away sending keys to the bit bucket on the floor. Sometimes slower is faster --- I know, that's totally zen, huh?

golden rule here: First make it work. Then make it work right. Then make it work fast. Then slow it down so it works reliably.

Remember everytime you bang on the keyboard either your script or the game is going to think you want to do something else other than what you're currently doing. So, unless you stop what you're doing first to do something else, someone is going to "get their undies in a twist".

#4 Guests

  • Guests

Posted 19 July 2012 - 12:35 AM

Ah ha!

Thank you so much, I've just changed it around and its working like a charm! I have to admit I don't totally understand how the #MaxHotkeysPerInterval works but I'm taking your word for it and slowing it WAY down to 3 =D

I see what you mean about it being to fast at times as you said at times it can really affect gameplay so I'll keep at it until I get it just right.

Thanks again!! :mrgreen:

#5 Guests

  • Guests

Posted 19 July 2012 - 06:47 PM

I slowed it down as above but and fixed the shift problem but everynow and then it still will seem to freeze up so I'm unable to do anything even click buttons on the keyboard. Now I'm guessing this is because its still running to fast and jamming up the CPU or something how else may I go about slowing it down so it still works but doesn't over do it and lock up the CPU?

Thanks in advance!

#6 girlgamer

girlgamer
  • Moderators
  • 2039 posts

Posted 19 July 2012 - 07:22 PM

lets see your script and maybe we can find something in that which can help...

#7 Kram

Kram
  • Guests

Posted 19 July 2012 - 08:42 PM

#IfWinActive World of Warcraft
Pause::Suspend
+Pause::Suspend

$XButton1::
Loop
{
setkeydelay -1
MouseClick X1
send {Blind}123
if not GetKeyState("XButton1", "p")
break
}
KeyWait, Xbutton1
#MaxHotkeysPerInterval 2
return

$+XButton1::
Loop
{
setkeydelay -1
MouseClick X1
send {Blind}123
if not GetKeyState("XButton1", "p")
break
}
KeyWait, Xbutton1
#MaxHotkeysPerInterval 2
return
I added the Suspend because when it locks up if I suspend and then reactivate it everything starts to work fine again. Its only doing it here and there pretty rarely but still would rather it didn't at all ><

Was thinking of maybe changing the setkeydelay?

#8 girlgamer

girlgamer
  • Moderators
  • 2039 posts

Posted 20 July 2012 - 02:49 AM

Try this and see if it helps any... i made a few "suggestions" in the script
#NoEnv
#SingleInstance, Force
#Persistent
#MaxHotkeysPerInterval 2	;<-- moved<--
SetBatchLines, -1	;<-- added for speed
DetectHiddenWindows, On	;<-- added
CoordMode, Tooltip, Screen	;<-- added for the tooltip in the xbutton 1 routine
CoordMode, Pixel, Screen	;<-- added 
CoordMode, Mouse, Screen	;<-- added
setkeydelay 0, 0	;<-- moved<-- added 2nd param for safety

return	;<-- added forced end of autoexecute section


#IfWinActive World of Warcraft
Pause::Suspend
+Pause::Suspend

;------------------------------------------------
*$XButton1:: ;<-- with any modifier shift, ctrl, alt
	WinActivate, Warcraft ;<-- added to make sure game window has focus
	Loop
	{	Tooltip, XButton 1 routine running..., 50,0	;<-- added so you know when it's running
		MouseClick X1		
		send {Blind}123 ;<-- shouldn't really need {blind}
		if not GetKeyState("XButton1", "p")
			break
	}
	tooltip	;<-- added turns off tooltip so you know when it's not running
	return
;------------------------------------------------
/* not needed because of * wildcard above
$+XButton1::
	Loop
	{
		MouseClick X1
		send {Blind}123
		if not GetKeyState("XButton1", "p")
			break
	}
	return
*/
; this is so you can use other hotkeys outside the game's window
#IfWinActive


#9 Guests

  • Guests

Posted 20 July 2012 - 08:55 PM

Going to try it out now.

Thanks so much for the help, it means a lot and you seem to have almost had to rewrite a brand new script for me, so again HUGE thanks =)

#10 Guests

  • Guests

Posted 20 July 2012 - 09:38 PM

Working a charm now! Thanks again for the tips and improving upon what I'd already tried putting together, you're awesome! :D

#11 girlgamer

girlgamer
  • Moderators
  • 2039 posts

Posted 20 July 2012 - 10:40 PM

That's what we do. And BTW, it's especially rewarding to help people who actually *try* to write some script code even tho it may be messed up. Reason being every time you write some, you learn some too. And that's what this community is all about.