no viable alternative at input keydown?

Asked by Ralph Whitlock

So I'm making a program for automatically fishing in stardew valley, but I can't even get the program to hold the mousebutton or a keypress. It only gives me this error:

[error] SyntaxError ( "no viable alternative at input 'keyDown'", )

What I've written so far is this:

wait(5)
click("1667230014998.png") #Stardew taskbar icon so the game is focused#
mouseMove(Location(2031, 807)
keyDown(C)
wait(1.5)
keyUp(C)

I don't see how this gives me an error.
I get the same error when I do this:

mouseDown(Button.LEFT)
wait(1.5)
mouseUp(Button.LEFT)

Any help would be appreciated!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Best Manfred Hampl (m-hampl) said :
#1

You have to put the C between quotes to specify that it is the character "C" and not a variable with that name.
keyDown("C")
or
keyDown("c")
if it is without "shift".

What is the exact error message for the mouse click? (I assume it cannot be "... at input 'keyDown'")

Revision history for this message
Ralph Whitlock (wafflefromspace) said :
#2

Thanks a lot Manfred Hampl!
That was the problem regarding the keyDown and keyUp and it works with quotation marks!
And now it seems that mouseDown and mouseUp works for some reason.

Revision history for this message
Ralph Whitlock (wafflefromspace) said :
#3

Thanks Manfred Hampl, that solved my question.