City Core Knights Tour

11/05/2016 08:19 Odlid Tubpu#1
To get the Rift Achievement "City Knights" in City Core you have to complete a 6x6 chess Knight tour of the board THREE times. I'm terrible at stuff like that...but damn fine at writing programs in Autoit. Here is a simple Autoit script that will position the cursor for you at all 108 places you must right click on.

1. Install Autoit. Copy the attached program to a file. Run the file.
2. Do all the prerequisite stuff (artifact set, collect magic poo, buy a completed knight book). Get your character to the City Core chess board. The board must be 'new' - that is you haven't played around with it yet. Position your character next to the controls.
3. Start up the program. When prompted LEFT click each of the controls as follows:

....4....5....
..3........6..
..2........7..
....1....8....

4. The program will position the cursor on each control in order they must be clicked to solve the Knights tour problem. YOU must do the moving of the Knight by RIGHT clicking on each control - doing so will move the Knight to the next proper location.
5. The program will make 3 complete Knight tours of the board, changing from red to green to blue to white. When you have the board all white you get the key to your prize.

Enjoy!
Code:
#include <Misc.au3>
#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

HotKeySet("{esc}","Terminate")

Sleep(500)

Local $i, $j

Local $KN_pos[9][2]
Local $move[36]
Local $hDLL = DllOpen("user32.dll")
Local $MousePos[2]

$move[0]  = 1
$move[1]  = 8
$move[2]  = 2
$move[3]  = 3
$move[4]  = 4
$move[5]  = 6
$move[6]  = 3
$move[7]  = 8
$move[8]  = 1
$move[9]  = 6
$move[10] = 7
$move[11] = 5
$move[12] = 4
$move[13] = 1
$move[14] = 6
$move[15] = 3
$move[16] = 2
$move[17] = 1
$move[18] = 8
$move[19] = 6
$move[20] = 7
$move[21] = 4
$move[22] = 2
$move[23] = 2
$move[24] = 5
$move[25] = 8
$move[26] = 5
$move[27] = 8
$move[28] = 5
$move[29] = 4
$move[30] = 3
$move[31] = 2
$move[32] = 7
$move[33] = 4
$move[34] = 7
$move[35] = 6

ConsoleWrite("Stand at knight control quadrant.  Board must be 'fresh' - if not click big knight at board then again at top of roof"&@CRLF)
Sleep(1000)
For $i=1 To 8
	ConsoleWrite("LEFT click Position #"&$i&@CRLF)
	While Not _IsPressed("01",$hDLL)
		Sleep(10)
	WEnd
	$MousePos = MouseGetPos()
	$KN_pos[$i][0]=$MousePos[0]
	$KN_pos[$i][1]=$MousePos[1]
	While _IsPressed("01",$hDLL)
		Sleep(10)
	WEnd
Next

Sleep(500)
ConsoleWrite(@CRLF&@CRLF&"Now Starting Knight Moves"&@CRLF&@CRLF)

For $j=1 To 3
	For $i=0 To 35
		MouseMove($KN_pos[$move[$i]][0], $KN_pos[$move[$i]][1])
		ConsoleWrite("Round="&$j&" Move="&$i+1&": Knight Move Position="&$move[$i]&" -- RIGHT click at mouse position"&@CRLF)
		While Not _IsPressed("02",$hDLL)
			Sleep(10)
		WEnd
		Sleep(2000)
	Next
Next

Func Terminate()
	Exit
EndFunc