The Wiki for Tale 5 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

Difference between revisions of "Code"

From ATITD5
Jump to navigationJump to search
Line 1: Line 1:
// This currently works for my screen resolution 1024:768 with ATITD in full screen
+
<pre>
// Pin the crematory window in the upper left of the screen as far into the corner as possible
+
// This currently works for my screen resolution 1024:768 with ATITD in full screen
// Load with stuff manually and make sure the window is fully refreshed so that the  
+
// Pin the crematory window in the upper left of the screen as far into the corner as possible
// "fire crematory" button appears and there is no slider bar!
+
// Load with stuff manually and make sure the window is fully refreshed so that the  
// Start the macro - it will click the fire button which will also bring ATITD to the top
+
// "fire crematory" button appears and there is no slider bar!
// Once the crematory has finished go back to ACTOOL and stop the macro - it currently just  
+
 
// has a huge crude loop - it would be relatively easy to monitor the progress bar but I  
+
// Start the macro - it will click the fire button which will also bring ATITD to the top
// haven't done that yet
+
// Once the crematory has finished go back to ACTOOL and stop the macro - it currently just  
// For different screen resolutions I guess use "pixie" or something similar to get coords
+
// has a huge crude loop - it would be relatively easy to monitor the progress bar but I  
// Need to change slider and button numbers under slider control for your particular crematory
+
// haven't done that yet
// (The wiki explains how to analyse your crematory)
+
 
 +
// For different screen resolutions I guess use "pixie" or something similar to get coords
 +
// Need to change slider and button numbers under slider control for your particular crematory
 +
// (The wiki explains how to analyse your crematory)
 +
 
 +
//SACFAR:
 +
//Sliders numbered left-to-right 1-7.
 +
//Buttons labeled left-to-right 1-5.
 +
 
 +
//Button 1 -> 3, 7
 +
//Button 2 -> 1
 +
//Button 3 -> 2
 +
//Button 4 -> 5, 6
 +
//Button 5 -> 4
 +
 
 +
 
 +
 
 
Constants  
 
Constants  
//Make sure the "Take..." option is NOT in the pinup menu or else this script will fail (burn your loaded resources).
+
 
//Make sure the crematory is completely empty before pinning up the menu, in the upper left corner.
+
 
//More instructions/screenshots at http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros/Crematory
+
 
//These settings will work on 1024x768. Only change these it you want it work at a different resolution.
+
//Make sure the "Take..." option is NOT in the pinup menu or else this script will fail (burn your loaded resources).
// Vertical position of middle of slider bar
+
//Make sure the crematory is completely empty before pinning up the menu, in the upper left corner.
midSlider = 265
+
//More instructions/screenshots at http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros/Crematory
// Vertical position of button centres
+
 
vrtButton = 345
+
//These settings will work on 1024x768. Only change these it you want it work at a different resolution.
// Horizontal positions of seven slider bars
+
 
hrzSlider1 = 30
+
// Vertical position of middle of slider bar
hrzSlider2 = 66
+
midSlider = 265
hrzSlider3 = 102
+
 
hrzSlider4 = 138
+
// Vertical position of button centres
hrzSlider5 = 174
+
vrtButton = 345
hrzSlider6 = 210
+
 
hrzSlider7 = 246
+
// Horizontal positions of seven slider bars
// Horizontal positions of five button centres
+
hrzSlider1 = 30
 +
hrzSlider2 = 66
 +
hrzSlider3 = 102
 +
hrzSlider4 = 138
 +
hrzSlider5 = 174
 +
hrzSlider6 = 210
 +
hrzSlider7 = 246
 +
 
 +
 
 +
// Horizontal positions of five button centres
 
hrzButton1 = 57
 
hrzButton1 = 57
 
hrzButton2 = 97
 
hrzButton2 = 97
Line 67: Line 92:
  
  
//Click the top of menu to refresh the menu
+
//Click the top of menu to refresh the menu
mousepos 104, 44
+
mousepos 104, 44
delay 200
+
delay 200
LeftClick
+
LeftClick
  
  
// Clicks to fire the crematory (need to specify centre of fire button)
+
// Clicks to fire the crematory (need to specify centre of fire button)
mousepos 62, 86
+
mousepos 62, 86
delay 200
+
delay 200
LeftClick
+
LeftClick
  
// First call to obtain initial positions of sliders
+
// First call to obtain initial positions of sliders
call GETSLIDERPOS
+
call GETSLIDERPOS
Compute posSlider1old = $posSlider1
+
Compute posSlider1old = $posSlider1
Compute posSlider2old = $posSlider2
+
Compute posSlider2old = $posSlider2
Compute posSlider3old = $posSlider3
+
Compute posSlider3old = $posSlider3
Compute posSlider4old = $posSlider4
+
Compute posSlider4old = $posSlider4
Compute posSlider5old = $posSlider5
+
Compute posSlider5old = $posSlider5
Compute posSlider6old = $posSlider6
+
Compute posSlider6old = $posSlider6
Compute posSlider7old = $posSlider7
+
Compute posSlider7old = $posSlider7
  
// Crude loop at the moment. Should really monitor the progress bar.  
+
// Crude loop at the moment. Should really monitor the progress bar.  
  
loop 500
+
loop 500
  
  
Line 108: Line 133:
 
call GETSLIDERPOS
 
call GETSLIDERPOS
  
// One slider per button control
+
// One slider per button control
// Need to alter slider and button numbers for particular crematory
+
// Need to alter slider and button numbers for particular crematory
  
  
//1st single slider/button combo:
+
//1st single slider/button combo:
  
 
if $posSlider2 > 0
 
if $posSlider2 > 0
Line 130: Line 155:
  
  
//2nd single slider/button combo:
+
//2nd single slider/button combo:
  
 
if $posSlider3 > 0
 
if $posSlider3 > 0
Line 148: Line 173:
  
  
//3rd single slider/button combo:
+
//3rd single slider/button combo:
  
 
if $posSlider5 > 0
 
if $posSlider5 > 0
Line 165: Line 190:
 
END
 
END
  
// Two sliders per button control (use centre of mass, i.e. average)
+
// Two sliders per button control (use centre of mass, i.e. average)
// Need to alter slider and button numbers for particular crematory
+
// Need to alter slider and button numbers for particular crematory
//Note Editing a slider number is $posSlider#, not comSlider#. Do not change the 1 or 2 on $comSlider1 and $comSlider2
+
//Note Editing a slider number is $posSlider#, not comSlider#. Do not change the 1 or 2 on $comSlider1 and $comSlider2
  
//1st two slider/one button combo:
+
//1st two slider/one button combo:
//
+
//
// Compute comSlider1 = ($posSlider1 + $posSlider7)/2
+
// Compute comSlider1 = ($posSlider1 + $posSlider7)/2
// if $comSlider1 > 0
+
// if $comSlider1 > 0
// Compute clickflag = 0
+
// Compute clickflag = 0
// if $posSlider1 > $posSlider1old
+
// if $posSlider1 > $posSlider1old
// Compute clickflag = 1
+
// Compute clickflag = 1
// END
+
// END
// if $posSlider7 > $posSlider7old
+
// if $posSlider7 > $posSlider7old
// Compute clickflag = 1
+
// Compute clickflag = 1
// END
+
// END
// if $clickflag = 1
+
// if $clickflag = 1
// mousepos $hrzButton1,$vrtButton
+
// mousepos $hrzButton1,$vrtButton
// delay 200
+
// delay 200
// LeftClick
+
// LeftClick
// END
+
// END
// END
+
// END
// if $comSlider1 < 0
+
// if $comSlider1 < 0
// Compute clickflag = 0
+
// Compute clickflag = 0
// if $posSlider1 < $posSlider1old
+
// if $posSlider1 < $posSlider1old
// Compute clickflag = 1
+
// Compute clickflag = 1
// END
+
// END
// if $posSlider7 < $posSlider7old
+
// if $posSlider7 < $posSlider7old
// Compute clickflag = 1
+
// Compute clickflag = 1
// END
+
// END
// if $clickflag = 1
+
// if $clickflag = 1
// mousepos $hrzButton1,$vrtButton
+
// mousepos $hrzButton1,$vrtButton
// delay 200
+
// delay 200
// LeftClick
+
// LeftClick
// END
+
// END
// END
+
// END
  
 
     if $posSlider1 > $posSlider1old
 
     if $posSlider1 > $posSlider1old
Line 219: Line 244:
  
  
//2nd two slider/one button combo:
+
//2nd two slider/one button combo:
  
 
Compute comSlider2 = ($posSlider4 + $posSlider6)/2
 
Compute comSlider2 = ($posSlider4 + $posSlider6)/2
Line 260: Line 285:
 
Compute posSlider7old = $posSlider7
 
Compute posSlider7old = $posSlider7
  
END
+
END
  
// Procedure to find slider positions
+
// Procedure to find slider positions
  
Procedure GETSLIDERPOS
+
Procedure GETSLIDERPOS
 
 
 
Compute counthi = $midSlider
 
Compute counthi = $midSlider
Line 406: Line 431:
 
END
 
END
  
END
+
END
 +
 
 +
</pre>

Revision as of 19:32, 19 October 2010

// This currently works for my screen resolution 1024:768 with ATITD in full screen
// Pin the crematory window in the upper left of the screen as far into the corner as possible
// Load with stuff manually and make sure the window is fully refreshed so that the 
// "fire crematory" button appears and there is no slider bar!

// Start the macro - it will click the fire button which will also bring ATITD to the top
// Once the crematory has finished go back to ACTOOL and stop the macro - it currently just 
// has a huge crude loop - it would be relatively easy to monitor the progress bar but I 
// haven't done that yet

// For different screen resolutions I guess use "pixie" or something similar to get coords
// Need to change slider and button numbers under slider control for your particular crematory
// (The wiki explains how to analyse your crematory)

//SACFAR:
//Sliders numbered left-to-right 1-7.
//Buttons labeled left-to-right 1-5.

//Button 1 -> 3, 7
//Button 2 -> 1
//Button 3 -> 2
//Button 4 -> 5, 6
//Button 5 -> 4



	Constants 



		//Make sure the "Take..." option is NOT in the pinup menu or else this script will fail (burn your loaded resources).
		//Make sure the crematory is completely empty before pinning up the menu, in the upper left corner.
		//More instructions/screenshots at http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros/Crematory

		//These settings will work on 1024x768. Only change these it you want it work at a different resolution.

		// Vertical position of middle of slider bar
		midSlider = 265

		// Vertical position of button centres
		vrtButton = 345

		// Horizontal positions of seven slider bars
		hrzSlider1 = 30
		hrzSlider2 = 66
		hrzSlider3 = 102
		hrzSlider4 = 138
		hrzSlider5 = 174
		hrzSlider6 = 210
		hrzSlider7 = 246


		// Horizontal positions of five button centres
		hrzButton1 = 57
		hrzButton2 = 97
		hrzButton3 = 137
		hrzButton4 = 177
		hrzButton5 = 217


		// Position of left most point of red line
		hrzRed = 34
		verRed = 176



		//Leave these alone
		count = 0
		counthi = 0
		countlo = 0
		clickflag = 0
		flag = 1
		posSlider1 = 0
		posSlider2 = 0
		posSlider3 = 0
		posSlider4 = 0
		posSlider5 = 0
		posSlider6 = 0
		posSlider7 = 0
		comSlider1 = 0
		comSlider2 = 0
		posSlider1old = 0
		posSlider2old = 0
		posSlider3old = 0
		posSlider4old = 0
		posSlider5old = 0
		posSlider6old = 0
		posSlider7old = 0
	END



//Click the top of menu to refresh the menu
mousepos 104, 44
delay 200
LeftClick


// Clicks to fire the crematory (need to specify centre of fire button)
mousepos 62, 86
delay 200
LeftClick

// First call to obtain initial positions of sliders
call GETSLIDERPOS
Compute posSlider1old = $posSlider1
Compute posSlider2old = $posSlider2
Compute posSlider3old = $posSlider3
Compute posSlider4old = $posSlider4
Compute posSlider5old = $posSlider5
Compute posSlider6old = $posSlider6
Compute posSlider7old = $posSlider7

// Crude loop at the moment. Should really monitor the progress bar. 

loop 500


	//Credit to Daniels for this sniplet of code to watch the red progress bar
	//and exit script when the bar disappears (when done).

	// Checks whether the batch is done, breaks loop if so
	LoadRGB $hrzRed,$verRed
	delay 100
	if {RGBRed} < 250
		break
	END




	call GETSLIDERPOS

// One slider per button control
// Need to alter slider and button numbers for particular crematory


//1st single slider/button combo:

	if $posSlider2 > 0
		if $posSlider2 > $posSlider2old
			mousepos $hrzButton3,$vrtButton
			delay 200
			LeftClick
		END
	END
	if $posSlider2 < 0
		if $posSlider2 < $posSlider2old
			mousepos $hrzButton3,$vrtButton
			delay 200
			LeftClick
		END
	END


//2nd single slider/button combo:

	if $posSlider3 > 0
		if $posSlider3 > $posSlider3old
			mousepos $hrzButton5,$vrtButton
			delay 200
			LeftClick
		END
	END
	if $posSlider3 < 0
		if $posSlider3 < $posSlider3old
			mousepos $hrzButton5,$vrtButton
			delay 200
			LeftClick
		END
	END


//3rd single slider/button combo:

	if $posSlider5 > 0
		if $posSlider5 > $posSlider5old
			mousepos $hrzButton2,$vrtButton
			delay 200
			LeftClick
		END
	END
	if $posSlider5 < 0
		if $posSlider5 < $posSlider5old
			mousepos $hrzButton2,$vrtButton
			delay 200
			LeftClick
		END
	END

// Two sliders per button control (use centre of mass, i.e. average)
// Need to alter slider and button numbers for particular crematory
//Note Editing a slider number is $posSlider#, not comSlider#. Do not change the 1 or 2 on $comSlider1 and $comSlider2

//1st two slider/one button combo:
//
//	Compute comSlider1 = ($posSlider1 + $posSlider7)/2
//	if $comSlider1 > 0
//		Compute clickflag = 0
//		if $posSlider1 > $posSlider1old
//			Compute clickflag = 1
//		END
//		if $posSlider7 > $posSlider7old
//			Compute clickflag = 1
//		END
//		if $clickflag = 1
//			mousepos $hrzButton1,$vrtButton
//			delay 200
//			LeftClick
//		END
//	END
//	if $comSlider1 < 0
//		Compute clickflag = 0
//		if $posSlider1 < $posSlider1old
//			Compute clickflag = 1
//		END
//		if $posSlider7 < $posSlider7old
//			Compute clickflag = 1
//		END
//		if $clickflag = 1
//			mousepos $hrzButton1,$vrtButton
//			delay 200
//			LeftClick
//		END
//	END

    if $posSlider1 > $posSlider1old
        if $posSlider1 > $posSlider7
    			mousepos $hrzButton1,$vrtButton
	    		delay 200
		    	LeftClick
		    END
    END
    if $posSlider1 < $posSlider1old
        if $posSlider1 < $posSlider7
 					mousepos $hrzButton1,$vrtButton
		  		delay 200
			  	LeftClick
			 END
    END
 



//2nd two slider/one button combo:

	Compute comSlider2 = ($posSlider4 + $posSlider6)/2
	if $comSlider2 > 0
		Compute clickflag = 0
		if $posSlider4 > $posSlider4old
			Compute clickflag = 1
		END
		if $posSlider6 > $posSlider6old
			Compute clickflag = 1
		END
		if $clickflag = 1
			mousepos $hrzButton4,$vrtButton
			delay 200
			LeftClick
		END
	END
	if $comSlider2 < 0
		Compute clickflag = 0
		if $posSlider4 < $posSlider4old
			Compute clickflag = 1
		END
		if $posSlider6 < $posSlider6old
			Compute clickflag = 1
		END
		if $clickflag = 1
			mousepos $hrzButton4,$vrtButton
			delay 200
			LeftClick
		END
	END


	Compute posSlider1old = $posSlider1
	Compute posSlider2old = $posSlider2
	Compute posSlider3old = $posSlider3
	Compute posSlider4old = $posSlider4
	Compute posSlider5old = $posSlider5
	Compute posSlider6old = $posSlider6
	Compute posSlider7old = $posSlider7

END

// Procedure to find slider positions

Procedure GETSLIDERPOS
	
	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider1, $midSlider
			Compute posSlider1 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider1, $counthi
			Compute posSlider1 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider1, $countlo
			Compute posSlider1 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider2, $midSlider
			Compute posSlider2 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider2, $counthi
			Compute posSlider2 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider2, $countlo
			Compute posSlider2 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider3, $midSlider
			Compute posSlider3 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider3, $counthi
			Compute posSlider3 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider3, $countlo
			Compute posSlider3 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider4, $midSlider
			Compute posSlider4 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider4, $counthi
			Compute posSlider4 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider4, $countlo
			Compute posSlider4 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider5, $midSlider
			Compute posSlider5 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider5, $counthi
			Compute posSlider5 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider5, $countlo
			Compute posSlider5 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider6, $midSlider
			Compute posSlider6 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider6, $counthi
			Compute posSlider6 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider6, $countlo
			Compute posSlider6 = $midSlider - $countlo
			Compute flag = 0
		END
	END

	Compute counthi = $midSlider
	Compute countlo = $midSlider
	Compute flag = 1
	IsBlack $hrzSlider7, $midSlider
			Compute posSlider7 = 0
			Compute flag = 0
	END	
	while $flag > 0
		Compute counthi = $counthi + 6
		IsBlack $hrzSlider7, $counthi
			Compute posSlider7 = $midSlider - $counthi
			Compute flag = 0
		END
		Compute countlo = $countlo - 6
		IsBlack $hrzSlider7, $countlo
			Compute posSlider7 = $midSlider - $countlo
			Compute flag = 0
		END
	END

END