Jump to content

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

Help with a crafting script.


  • Please log in to reply
3 replies to this topic
nikostill
  • New members
  • 2 posts
  • Last active: Oct 14 2015 02:42 AM
  • Joined: 12 Oct 2015
Hi, I just started learning to use ahk yesterday so my apologies if the answer to this is really obvious. I'm trying to create a crafting script for a game called mortal online but the click command doesn't seem to be working within the game client. Any help would be greatly appreciated.
Here's the script.
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


WinWait, MortalGame,
IfWinNotActive, MortalGame, , WinActivate, MortalGame,
WinWaitActive, MortalGame,

if !A_IsAdmin
{
    Run *RunAs "%A_ScriptFullPath%"
    ExitApp
}

{
BlockInput On
CoordMode, Mouse, Client
Sleep 2000
Click right, 1549, 738
Sleep 1000
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 1000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 68
Sleep 1000
Click, 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1760, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1815, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1760, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1815, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 173
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 173
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Click right 1607, 738
Sleep 1000
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 1000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1760, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1815, 68
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1760, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1815, 121
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1658, 173
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 1000
Send, {R Up}
Sleep 1000
Click 1712, 173
Sleep 1000
Click 864, 518
Sleep 1000
Click 918, 573
Sleep 50000
Click right 1607, 738
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Click right 1657, 738
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Click right 1710, 738
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Click right 1766, 738
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Click right 1814, 738
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Click right 1549, 790
Sleep 500
MouseClickDrag, L, 960, 443, 1821, 10
Sleep 500
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 68
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1760, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1815, 121
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1658, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
Send, {R Down}
Sleep 500
Send, {R Up}
Sleep 500
Click 1712, 173
Sleep 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
}



Esc:: ; in case of emergency hit escape key
exitapp

Edited by Jackie Sztuk _Blackholyman, 12 October 2015 - 09:08 AM.
Added code tags


Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Is the clicking not seeming to work the only problem you've recognized?

 

Test with simple hotkeys if the clicking can work.

 

1::Click
2::Click, right

 

You can try doing this too, by setting the SendMode in the auto-execute section.

 

SendMode, InputThenPlay
1::Click
2::Click, right

 

The SendInput can change how the client recognizes the input. If the above fails, I would try SendMode, Event as well.



nikostill
  • New members
  • 2 posts
  • Last active: Oct 14 2015 02:42 AM
  • Joined: 12 Oct 2015

Thanks for taking the time man. The Sendmode, Event worked.



Grant
  • Members
  • 14 posts
  • Last active: Nov 13 2015 10:03 AM
  • Joined: 03 Feb 2010

looks to me like some of my first bits of code.  Functions are your friend...

 

 A quick glance hints that you might be able to use this:

	;plug this into your main program where you would normally have the bit below
repeated_bit()


	;this bit is called every time the above is called.
	;this makes things a lot more simple in maintaining your code in case the buttom moves a bit with an update happens.
repeated_bit()
{
sleep, 500
Click 864, 518
Sleep 500
Click 918, 573
Sleep 50000
return
}