Jump to content


simple script for game


  • Please log in to reply
5 replies to this topic

#1 anwc

anwc
  • Guests

Posted 09 October 2012 - 02:36 AM

hi guys,
i'm still learning to create a script for a game and i've ran into some difficulty.
im trying to remap a combination of 3 keys into 1 key but keep facing error when compiling

1) mapping keys `1` into F1
F1::Send {`1`}
return

2) mapping `q` into z
z::Send {`z`}
return

both doesnt seem to work. am i doing something wrong?

Post requests in Support ->gaming not in scripts->gaming

#2 dylan904

dylan904
  • Members
  • 706 posts

Posted 09 October 2012 - 02:46 AM

F1::Send, 1

q::Send, z


#3 Guests

  • Guests

Posted 09 October 2012 - 03:33 AM

i dont get it. why must there be a comma after Send?

and actually, the plan was to send the keys "`", "q" and "`" all at the press of z.
the ` key is the button beside 1

#4 DarkVamprism

DarkVamprism
  • Members
  • 118 posts

Posted 09 October 2012 - 10:13 AM

Putting something into squiggly brackets {} will try and find a key with that name, so using {} does not apply in this script
if you were trying to remap F1 to leftclick though you would do
Send, {LButton}
For your case you would just have to write it without the {} BUT ` is the escape character(for example its used to show a literal % instead of it looking for a variable)
So if you want to actually use the ` in a piece of code then you need to put ``, the first one tells AHK to actually use the next character.

So your code should be
F1::Send ``1``
return

q::Send ``z``
return

As to the question about send, the comma is used to separate parameters
Send is basically a function which needs the value it wants to send.

So the line
Send, Hello
means we want to give the command the word Hello, AHK is smart though and lets you forget about the first comma in most commands, but it is best to use them to be consistent.

#5 okada

okada
  • Members
  • 1 posts

Posted 12 October 2012 - 09:09 AM

why must there be a comma after Send?

#6 DarkVamprism

DarkVamprism
  • Members
  • 118 posts

Posted 12 October 2012 - 09:15 AM

I answered that..., Send is the command the comma is the separator to say the next thing is a parameter