How can I hold down a key

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

How can I hold down a key

Post by wicked357 » Thu Apr 23, 2009 8:22 am

I am trying to make macro that will hold down a key in my case "v" and release after a certain amount of time. I am unable to figure this out I have read the help text but im not exactly sure what I need here. Can someone please help me out here. Thank you!

ainterne
Junior Coder
Posts: 29
Joined: Tue Jun 05, 2007 4:03 am

Post by ainterne » Thu Apr 23, 2009 9:34 am

Is this what you are looking for?

Press V
wait>3
Release V
Phil.......

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Thu Apr 23, 2009 9:50 am

I tried that and it isn't working, It might be the client I am running it under, I am trying to simulate a game key being held down to make certain things easier for me. I am not sure why this wouldn't work, any insight on how to get around this?

I tried this from a different forum post

Let>VK_control=86
Let>ExtendedKey=0
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_control,0,ExtendedKey,0
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
wait>5
LibFunc>user32.dll,keybd_event,r,VK_control,0,FLAGS,0

but cant seem to get this to work either.

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Try Let>ExtendedKey=1

Post by gdyvig » Thu Apr 23, 2009 2:51 pm

Checked my sample code for playing a flash demo.
Also checked the forums for ExtendedKey.
In all cases the code was just like yours except:

Let>ExtendedKey=1




Does that work?

Gale

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Thu Apr 23, 2009 7:51 pm

Oh yea I changed that hoping that it would work if I went from 1 to 0 but it also had no effect, so I just forgot to change it back to 1.

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Thu Apr 23, 2009 8:53 pm

Here is what I have so far everything else works fine, just have a problem with holding a key down. I could use send>v but that only used it once and spamming v over and over doesn't work properly.

Code: Select all

label>start
wait>3
send>w
wait>2
send>r
label>action
wait>3
//Insert key press here for "v"
wait>2
label>action2
wait>3
send>r
wait>3
send>7
wait>1
send>n
wait>10
goto>start

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

What application are you sending the key presses to?

Post by gdyvig » Thu Apr 23, 2009 9:13 pm

What app are you running that is supposed to respond to your key presses and releases?

Did you write it, or is it on a web site we can try out?


Gale

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Thu Apr 23, 2009 9:26 pm

It is actually Darkfall Online, I am thinking the the Win32 API for input isn't the normal being used here.

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Thu Apr 23, 2009 10:38 pm

Ill state this just in case it helps anyone out with this, if I record the macro holding down v just spams it in send>vvvvvvvvvvvvvvvvvvvv.... until I quit.

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Try SetFocus, maybe Send>vvvvvvv is way to go.

Post by gdyvig » Fri Apr 24, 2009 2:31 pm

Make sure your script has a SetFocus on the Darkfall window. Your Press and Send commands may be landing where they are ignored. This may especially happen if you are running with the Macro Scheduler editor open.

Also, do you need to be moving the mouse to a location where game will react to the key strokes?

I did a web seach for "Darkfall online" "Macro Scheduler" and found several cheat and bot sites with sample Macro Scheduler code. None used any advanced features like libfunc. Instead they used Press and Release for holding down the Alt, shift, and ctrl keys and the Send> command to send key strokes. They used what you call the spam method, often in a loop for a period of time or until the objective was met.

Gale

wicked357
Newbie
Posts: 7
Joined: Thu Apr 23, 2009 8:07 am
Location: UP, WA

Post by wicked357 » Sat Apr 25, 2009 11:39 pm

I actually did you setfocus and still not working correctly, I have other macros made that work properly but to simulate the holding method doesn't seem to work or work properly.

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Keydown is problematic in games.

Post by gdyvig » Sun Apr 26, 2009 4:18 am

Read post dated Sun Jun 12, 2005 10:54 am:

http://www.mjtnet.com/usergroup/viewtop ... =1991#8081

In the above post the method (repeated libfuncs) suggested by support worked for some applications, but not for the game in question. Maybe it will work for you.

In the game forums some players say bots should not be used to gain "skill", wonder if the Darkfall developers are trying to disable the bots?


Gale

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts