Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

gmod piano auto song player



  • Please log in to reply
11 replies to this topic
T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

im trying to send my keys to game and it plays auto.

but when i run the script its not pressing the keys ingame but it is out of it


Loop 69
{
    Send {U+0061 down}
    Send {U+0071 down}
    Sleep 5000
    Send {U+0074 down}
    Sleep 1000
    Send {U+0070 down}
    Sleep 1000
    Send {U+0074 down}
    Sleep 1000
    Send {U+0069 down}
    Sleep 1000
    Send {U+0074 down}
    Sleep 1000
}

2Ebhp.jpg



robert_ilbrink
  • Members
  • 548 posts
  • Last active: Aug 25 2014 07:11 PM
  • Joined: 05 May 2012

Many games have issues with receiving keystrokes from ahk. You could try SendPlay or Sendinput but the chance of success is not great. Personally I got some issues resolved by using the vk/sc codes, but you will have to find out if those work for your game. Try with one e.g.

 

 

Send, {vk47sc022 Down} ; letter G from AHK KeyHistory
Sleep, 300
Send, {vk47sc022 Up}

 

When this works, you can reduce the time and if it still works with no delay, use Send, {vk47sc022}

 

I can't explain why it worked for me, as others tell me that Send, g and Send, {vk47sc022} are the same, but I go with what works.



robert_ilbrink
  • Members
  • 548 posts
  • Last active: Aug 25 2014 07:11 PM
  • Joined: 05 May 2012

You could try to run ahk with admin rights. Right click on AutoHotKey.exe and select run as....



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

thanks i thought that this forums was dead because no one would respond and the vk code work now how do i go by find and the characters in the picture



Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
✓  Best Answer

Try this,

This is not mine.

Really smart guys wrote all of them. I am just using it. Thanks !!

 

SetFormat, Integer, Hex
Gui +ToolWindow -SysMenu +AlwaysOnTop
Gui, Font, s14 Bold, Arial
Gui, Add, Text, w250 h33 vSC 0x201 +Border, SCCODE VKCODE
Gui, Show
Loop 9
OnMessage( 255+A_Index, "ScanCode" )   
Return

ScanCode( wParam, lParam )
{
VKCODE := wParam
SCCODE := SubStr((((lParam>>16) & 0xFF)+0xF000),-2)
GuiControl,, SC, VK %VKCODE% SC %SCCODE% 
}



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

@hamlet

 

is vk41sc01E the same as vk0x41sc01E



Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009

Try it, You know it.



robert_ilbrink
  • Members
  • 548 posts
  • Last active: Aug 25 2014 07:11 PM
  • Joined: 05 May 2012

Double click on the AHK icon and press [Ctrl]+k, to see the key history. Press some keys, then [F5] and see (down) what the VK/SC codes are.



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

thanks guys
 
Video of script test
 

Spoiler

 

I know my code look like shit but i'm learn just want to say thanks again.



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

now to make a fuction the call the song name instead of constant looping for 69 interval

then a gui

then a song planner

then a midi converter into letters of that format 

then im done with this project



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

Double click on the AHK icon and press [Ctrl]+k, to see the key history. Press some keys, then [F5] and see (down) what the VK/SC codes are.

41  01E	 	d	7.22	A 
41  01E	 	u	0.14	A              	
42  030	 	d	0.06	B              	
42  030	 	u	0.09	B              	
43  02E	 	d	0.22	C              	
43  02E	 	u	0.14	C              	
Send, {vk44sc020 Down} ;d           	
Send, {vk44sc020 up} ;d            	
45  012	 	d	0.50	E              	
45  012	 	u	0.13	E              	
46  021	 	d	0.17	F              	
46  021	 	u	0.16	F              	
47  022	 	d	0.27	G              	
47  022	 	u	0.16	G              	
48  023	 	d	0.31	H              	
48  023	 	u	0.19	H              	
49  017	 	d	0.26	I              	
49  017	 	u	0.11	I              	
4A  024	 	d	0.30	J              	
4A  024	 	u	0.14	J              	
4B  025	 	d	0.28	K              	
4B  025	 	u	0.13	K              	
4C  026	 	d	0.17	L              	
4C  026	 	u	0.13	L              	
4D  032	 	d	0.23	M              	
4D  032	 	u	0.16	M              	
4E  031	 	d	0.64	N              	
4E  031	 	u	0.20	N              	
Send, {vk4Fsc019 Down} ;o              	
Send, {vk4Fsc019 Up} ;o           	
Send, {vk50sc019 Down} ;p            	
Send, {vk50sc019 Up} ;p            	
51  010	 	d	0.27	Q              	
51  010	 	u	0.20	Q              	
52  013	 	d	0.59	R              	
52  013	 	u	0.14	R              	
Send, {vk53sc013 Down} ;s             	
Send, {vk53sc013 up} ;s             	
54  014	 	d	0.28	T              	
54  014	 	u	0.14	T              	
55  016	 	d	1.04	U              	
55  016	 	u	0.14	U              	
56  02F	 	d	0.14	V              	
56  02F	 	u	0.14	V              	
57  011	 	d	0.28	W              	
57  011	 	u	0.11	W              	
58  02D	 	d	0.37	X              	
58  02D	 	u	0.20	X              	
59  015	 	d	0.42	Y              	
59  015	 	u	0.16	Y              	
5A  02C	 	d	0.26	Z              	
5A  02C	 	u	0.23	Z
31  002	 	d	22.04	1 
31  002	 	u	0.14	1              	
32  003	 	d	0.14	2              	
32  003	 	u	0.13	2              	
33  004	 	d	0.17	3              	
33  004	 	u	0.12	3              	
34  005	 	d	0.17	4              	
34  005	 	u	0.11	4              	
35  006	 	d	0.16	5              	
35  006	 	u	0.13	5              	
36  007	 	d	0.16	6              	
36  007	 	u	0.13	6              	
37  008	 	d	0.19	7              	
37  008	 	u	0.11	7              	
38  009	 	d	0.16	8              	
38  009	 	u	0.11	8              	
39  00A	 	d	0.17	9              	
39  00A	 	u	0.13	9              	
30  00B	 	d	0.13	0              	
30  00B	 	u	0.14	0              	
Send, {vkA0sc02A Down} ;lshift
Send, {vkA0sc02A up} ;lshift

thanks again



T1G3R_5H0T
  • Members
  • 15 posts
  • Last active: Apr 25 2013 04:24 PM
  • Joined: 16 Apr 2013

Try this,

This is not mine.

Really smart guys wrote all of them. I am just using it. Thanks !!

 

SetFormat, Integer, Hex
Gui +ToolWindow -SysMenu +AlwaysOnTop
Gui, Font, s14 Bold, Arial
Gui, Add, Text, w250 h33 vSC 0x201 +Border, SCCODE VKCODE
Gui, Show
Loop 9
OnMessage( 255+A_Index, "ScanCode" )   
Return

ScanCode( wParam, lParam )
{
VKCODE := wParam
SCCODE := SubStr((((lParam>>16) & 0xFF)+0xF000),-2)
GuiControl,, SC, VK %VKCODE% SC %SCCODE% 
}

thank for showing me this i can you this to decet the letter in a msgbox for my song planer