Need expert help on a complicated Starcraft script

Ask gaming related questions
acnl
Posts: 2
Joined: 25 Nov 2017, 09:04

Need expert help on a complicated Starcraft script

25 Nov 2017, 09:09

In Starcraft Remastered (Brood War), while a mouse button is held down, keyboard inputs are ignored. To fix this, there as a very clever autohotkey script that simply sent a "mouse button up" signal for all right clicks, and all left clicks except when drag selecting units (aka box select).

This is the script: http://golfscript.com/temp/scmouse3/autohotkey.ini

However, it does not work with the current Starcaft Remastered and I was wondering if I could get some help fixing it. I got it to work in some cases, but it is hit and miss. Could an autohotkey guru take a look?
FeTTyWaP

Re: Need expert help on a complicated Starcraft script

16 Feb 2018, 16:51

Code: Select all

setkeydelay -1
setmousedelay -1

Process, Exist  ; sets ErrorLevel to the PID of this running script
; Get the handle of this script with PROCESS_QUERY_INFORMATION (0x0400)
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel)
; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
DllCall("Advapi32.dll\OpenProcessToken", "UInt", h, "UInt", 32, "UIntP", t)
VarSetCapacity(ti, 16, 0)  ; structure of privileges
NumPut(1, ti, 0, 4)  ; one entry in the privileges array...
; Retrieves the locally unique identifier of the debug privilege:
DllCall("Advapi32.dll\LookupPrivilegeValueA", "UInt", 0, "Str", "SeDebugPrivilege", "UIntP", luid)
NumPut(luid, ti, 4, 8)
NumPut(2, ti, 12, 4)  ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
; Update the privileges of this process with the new access token:
DllCall("Advapi32.dll\AdjustTokenPrivileges", "UInt", t, "Int", false, "UInt", &ti, "UInt", 0, "UInt", 0, "UInt", 0)
DllCall("CloseHandle", "UInt", h)  ; close this process handle to save memory

read1(MADDRESS)
{
global processhandle
varsetcapacity(mvalue,1,0)
temp:=DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",1,"UInt",0)

if (ErrorLevel or !ProcessHandle or !temp)
{
	winget, pid, PID, Brood War
	ProcessHandle := DllCall("OpenProcess", "Int", 16, "Char", 0, "UInt", pid, "UInt")
	temp:=DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",1,"UInt",0)
	if (ErrorLevel or !ProcessHandle or !temp)
		MsgBox fail %errorlevel% %processhandle% %temp%
}
return *(&mvalue)
}

select()
{
return (read1(0x6556f2)!=72)
}


sc()
{
return read1(0x6d11ec)
}
Now, here in our modern software languages the context equals the syntax which should stay clean, concise, and logically sequential.
I won't fix your problem.
Not even God can understand what your clicking.

Code: Select all

#ifWinActive Brood War

*$~RButton::
send {RBUTTON UP}
return

*$LButton::
x:=!select()
send {BLIND}{LBUTTON DOWN}
if(x && sc())
	send {BLIND}{LBUTTON UP}
return

*~LButton UP::
return
Don't make the script more complex than it naturally acts on the operating system 125Mhz., on repeat at like 32ms intervals

System is above in Priority over the ahk files and the sc2.exe files

You know the problem. KeyBoards broke...... jk

We need to. Just ask Starcraft to not over-ride the mouse & Keyboard by placing script on system level.

and not changing security access privileges. just *run as admin**....

finally., attach your own readme.txt to help explain in depth of what every line calls, points, or does. GGwp
suhdajin
Posts: 1
Joined: 15 Jun 2018, 11:00

while cliking mouse, input keyboard

15 Jun 2018, 19:47

Hi
i gonna play starcraft but stuck with problem.
While i press mouse button, it blocks keyboard inputs. just in starcraft not in other games.
so ive search with google to solve problem but i found just the clue from here

http://golfscript.com/temp/scmouse3/autohotkey.ini

Code: Select all

setkeydelay -1
setmousedelay -1

Process, Exist  ; sets ErrorLevel to the PID of this running script
; Get the handle of this script with PROCESS_QUERY_INFORMATION (0x0400)
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel)
; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
DllCall("Advapi32.dll\OpenProcessToken", "UInt", h, "UInt", 32, "UIntP", t)
VarSetCapacity(ti, 16, 0)  ; structure of privileges
NumPut(1, ti, 0, 4)  ; one entry in the privileges array...
; Retrieves the locally unique identifier of the debug privilege:
DllCall("Advapi32.dll\LookupPrivilegeValueA", "UInt", 0, "Str", "SeDebugPrivilege", "UIntP", luid)
NumPut(luid, ti, 4, 8)
NumPut(2, ti, 12, 4)  ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
; Update the privileges of this process with the new access token:
DllCall("Advapi32.dll\AdjustTokenPrivileges", "UInt", t, "Int", false, "UInt", &ti, "UInt", 0, "UInt", 0, "UInt", 0)
DllCall("CloseHandle", "UInt", h)  ; close this process handle to save memory

read1(MADDRESS)
{
global processhandle
varsetcapacity(mvalue,1,0)
temp:=DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",1,"UInt",0)

if (ErrorLevel or !ProcessHandle or !temp)
{
	winget, pid, PID, Brood War
	ProcessHandle := DllCall("OpenProcess", "Int", 16, "Char", 0, "UInt", pid, "UInt")
	temp:=DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",1,"UInt",0)
	if (ErrorLevel or !ProcessHandle or !temp)
		MsgBox fail %errorlevel% %processhandle% %temp%
}
return *(&mvalue)
}

select()
{
return (read1(0x6556f2)!=72)
}


sc()
{
return read1(0x6d11ec)
}


#ifWinActive Brood War

*$~RButton::
send {RBUTTON UP}
return

*$LButton::
x:=!select()
send {BLIND}{LBUTTON DOWN}
if(x && sc())
	send {BLIND}{LBUTTON UP}
return

*~LButton UP::
return


and im still struggle with same problem.
with that source it shows 'fail' so i changed some source last few words

Code: Select all

#ifWinActive Brood War

*$~RButton::
send {RBUTTON UP}
return

*$~LButton::
return

*$LButton UP::
return
yeah it works just for right mouse button.
however still have same problem blocking keyboard inputs.
i think with right mouse button i dont need to change it.
but left one...

if i press 1a and click left button, its okay but problem is while i clicking, press 2 and its block.
it sounds silllly but if u guys play starcraft, u need to press fast.
some guys said just after click perfectly and press keyboard, but i wanna solve this problem.
plz give me a tips.....
thanks

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 15 guests