Rust script suddenly running abnormally

Ask gaming related questions (AHK v1.1 and older)
wylbor
Posts: 3
Joined: 18 Mar 2017, 11:37
Contact:

Rust script suddenly running abnormally

18 Mar 2017, 11:58

I'm having an issue with my Script (or AHK, i don't know) and if anyone could help me I will be forever grateful.

The script should move my mouse when Ctrl and LButton is pressed with a loop and a break when Ctrl is released, but instead it keeps an Infinite Loop, forcing me to abort the script.
It is worth remembering that the script worked correctly for a long time, it began to happen suddenly.

I've tried some small variations with Loop (including Loop with number), Break and etc but despite solving the problem of "infinite loop" the Script does not work the desired way. I have already tried to uninstall AHK and install other versions but it did not read my script any more normally.

On other machines it works perfectly. Any suggestions?

Code: Select all

#NoEnv
SendMode Input

~F6::Suspend

~F2::ExitApp

LCtrl & ~LButton::
loop
	If GetKeyState("LButton", "LCtrl") {
		Sleep, 5
		moveAmount := (moveAmount = 2) ? 1 : -1
 		mouseXY(moveAmount,3.4)
		
	}
	else
	break

	
Return



mouseXY(x,y)
{
DllCall("mouse_event",int,2,int,x,int,y,uint,0.5,uint,0.5)
}
Last edited by wylbor on 18 Mar 2017, 12:45, edited 1 time in total.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Rust script suddenly running abnormally

18 Mar 2017, 12:38

What constitutes "running abnormally"? You haven't explained.
wylbor
Posts: 3
Joined: 18 Mar 2017, 11:37
Contact:

Re: Rust script suddenly running abnormally

18 Mar 2017, 12:44

swagfag wrote:What constitutes "running abnormally"? You haven't explained.
u're right, sorry. I'll edit the main post.

The script should move my mouse when Ctrl and LButton is pressed with a loop and a break when Ctrl is released, but instead it keeps an Infinite Loop, forcing me to abort the script.

It is worth remembering that the script worked correctly for a long time, this happened suddenly.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Rust script suddenly running abnormally

18 Mar 2017, 13:36

i figure rust could do with one scripter less, but ill give you a hint regardless. There are 2 errors in

Code: Select all

If GetKeyState("LButton", "LCtrl") {
and

Code: Select all

DllCall("mouse_event",int,2,int,x,int,y,uint,0.5,uint,0.5)
Should be easy to spot, considering you wrote the script.

..you did write the script, right? :lol: :lol: :lol: :lol: :D :D :D
wylbor
Posts: 3
Joined: 18 Mar 2017, 11:37
Contact:

Re: Rust script suddenly running abnormally

18 Mar 2017, 19:37

I wish it had been me, haha. I'm still learning about scripting so i can't understand everything yet.

I've noticed that I can use this way too:

Code: Select all

	If GetKeyState("LButton") {
But the same problem still persists.
I'd like to know why this script works normally on other computers

EDIT

I had made some changes and now it looks like everything is working as intended (I need a testing time to be sure).

I'm using this format right now:

Code: Select all

#MaxHotKeysPerInterval	200000000
#NoEnv
SendMode Input

~F6::Suspend

~F2::ExitApp

~RButton & ~LButton::
Loop
	If GetKeyState("LButton") {
		Sleep, 5
		moveAmount := (moveAmount = 2) ? 1 : -1
 		mouseXY(moveAmount,3.4)
		break
	}


	
Return



mouseXY(x,y)
{
DllCall("mouse_event",int,2,int,x,int,y,uint,0.5,uint,0.5)
}
EDIT 2

It was a great advance but there is still something to understand. Now the script works as I wanted, but then the action continues until I press the LButton again (I press once to start and I must press another to stop, when in fact I want to proceed until LButton is released.)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: slowwd and 127 guests