Jump to content
  • Advertisement
Sign in to follow this  
zippo88

Autoit beginner

This topic is 3085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I am making a program to automate putting sprites together. This is my first time using autoit, so i don't know very well how it works. The if code part is for testing, and it's exiting as soon as i launch the program with it in there. What am i doing wrong?
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Jonny\Mina dokument\Form1.kxf
$Form1_1 = GUICreate("Settings", 326, 477, 327, 174)
$Label7 = GUICtrlCreateLabel("Screen left X value", 16, 224, 94, 17, $WS_TABSTOP)
$Label6 = GUICtrlCreateLabel("Rows", 16, 168, 31, 17)
$Label5 = GUICtrlCreateLabel("Sprites per row", 16, 144, 74, 17)
$Label4 = GUICtrlCreateLabel("Bottom Y value", 16, 88, 76, 17)
$Label3 = GUICtrlCreateLabel("Top Y value", 16, 64, 62, 17)
$Label2 = GUICtrlCreateLabel("Right side X value", 16, 40, 107, 17)
$Label1 = GUICtrlCreateLabel("Left side X value", 16, 16, 104, 17)
$Button1 = GUICtrlCreateButton("Ok", 136, 424, 49, 25, $WS_GROUP)
$xMin = GUICtrlCreateInput("", 128, 16, 57, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$xMax = GUICtrlCreateInput("", 128, 40, 57, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$yMin = GUICtrlCreateInput("", 128, 64, 57, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$yMax = GUICtrlCreateInput("", 128, 88, 57, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$spritesPerRow = GUICtrlCreateInput("", 104, 144, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$rows = GUICtrlCreateInput("", 104, 168, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$screenLeftX = GUICtrlCreateInput("", 120, 224, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label8 = GUICtrlCreateLabel("Screen top Y value", 16, 248, 95, 17)
$screenTopY = GUICtrlCreateInput("", 120, 248, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$blindSpot = 100

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $xMin
				$dragFromX = $xMin - ($screenLeftX)
		Case $xMax
				$dragToX = $xMax - ($screenLeftX)

		Case $yMin
				$dragFromY = $yMin - ($screenTopY - $blindSpot)
		Case $yMax
				$dragToY = $yMax - ($screenTopY - $blindSpot)

	EndSwitch
if $xMin = 200 Then
   Exit
EndIf

WEnd

Edit: Also i am now attempting to use the drag function to create a rect, but it's not working. The mouse won't move to the coordinates that i put in. it moves to the same place no matter what.
$blindSpot = 95
$dragFromX = 0
$dragToX = 0
$dragFromY = 0
$dragToY = 0


While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $xMin
				$dragFromX = $xMin - ($screenLeftX)
		Case $xMax
				$dragToX = $xMax - ($screenLeftX)

		Case $yMin
				$dragFromY = $yMin - ($screenTopY - $blindSpot)
		Case $yMax
				$dragToY = $yMax - ($screenTopY - $blindSpot)
		Case $Button1
				MouseClickDrag("left",$dragFromX,$dragFromY,$dragToX,$dragToY,0)

	EndSwitch

WEnd

The screenTopY and screenLeftX are negative numbers, so it becomes +. for example $yMax - ($screenTopY - $blindSpot) could be 3 -(-203 - 95) = 3 + 298 = 301. I do not know if this is done within computers, but i tried a different way and it still doesn't work to create a mouseClickDrag function when i'm using these variables. [Edited by - zippo88 on April 12, 2010 5:14:52 PM]

Share this post


Link to post
Share on other sites
Advertisement
it's probably better for you to go to Autoit's website and see if you can get help there. I doubt many members here could help you with this particular issue. Given that, AFAIK, it's not a popular tool.

Share this post


Link to post
Share on other sites
Quote:
Original post by Alpha_ProgDes
it's probably better for you to go to Autoit's website and see if you can get help there. I doubt many members here could help you with this particular issue. Given that, AFAIK, it's not a popular tool.


Ok, i will do that aswell. When i finish i might post the program here, if anyone is interested in it. What it will do is it will allow you to put sprites together in 1 image file instead of several (for animations). It will cut the part you specify of the image and paste in the image file that is keeping all the images, and then it will take the next one and put right next to the other one for as many sprites and rows you have specified, and have loaded into paint.net,. I have a walking animation of 26 frames, and i have it in 8 different directions, so it takes hours and hours to put into 1 image file. It will be the same with all animations i create, so i think that other people might also find it useful.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!