Sign in to follow this  
Followers 0
erickmiyazaki

How can my script recognize id X thing happened?

20 posts in this topic

It open a window, then it connects to the server, then a button will appear.

Is there a commando to make my script recognize that the button appeared and click on it?


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites



Is this a game or a program applicaton? Use the window sniffer to see if the button has a controlId and such. If it's a game please list the title.


I AM ORCA!! A VERY POWERFUL WHALE!!!

Share this post


Link to post
Share on other sites

It's a game, called RoseOnline>

Wuts window sniffer? Sorry I just started making scirpts yesterday, so I'm totally noob.


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

Sorry for double post, but no one knows or just didn't understand me?

Sorry for bad english.


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

Use the AutoIt Window Info tool provided with the installation to see the ControlID of the button and such. Then use functions such as the Control*() functions where * is a wildcard look in the helpfile.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I'm thinking that we need to create a script repository for all the people making scripts very similar to each other for their RO and ROSE games :)

Most likely you can use Send or ControlSend (I would suggest ControlSend, a bit harder to 'break' the script)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

When you put ControlSend (, this appears:

ControlSend ( "title" , "text" , ControlID , "String" [, flag])

What should I put in each place?


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

If I remember correctly

ControlSend("ROSE Online", "", ***, "{ENTER}")

Where *** is either the numerical value of the control (Control ID) or its ClassName. {ENTER} is the key sent to the control, you can also send normal keys (abcdefg...)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

But why you don't put anything in "text"?

What's the numerical value of the control? How do I find this value?

What's the ClassName?

SOrry I'm real newb.

Oh here are some SS.

Before they button play roseonline appears:

Posted Image

After it appears:

Posted Image

Edited by erickmiyazaki

Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

ControlSend("www.roseonline.com", "", ***, "{ENTER}")

The text part is optional, usually its only needed if there are multiple windows open at the same time (if you have two rose online 'games'(?) going at once).

For the ControlID or ClassName, use the AU3 Window Info tool, provided in the main AU3 install directory


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Well now I got those informations, they are correct, aren't they?

I Just moved my mouse to the Play RoseOnline, pressed CTRL+ALT+F

Posted Image

Now I just type this:

ControlSend("www.roseonline.com", "", 786856, "{ENTER}")

But the problem is, I need to left click on it, so I put this:

ControlClick ("www.roseonline.com", "", 786856 [, left] [, 1]] )

But with this command it gives me an error, what's wrong? This one doesn' even open the game.

ControlClick ("www.roseonline.com", "", 786856 [, "left"] [, "1"]] )

This One open the game, but after it I receive an error.

ControlClick ("www.roseonline.com", "", 786856 [, l"eft"] [, 1]] )

This one open the game, but after it I receive an error.

BTW thanks for the help, Step by step I get there!

Edited by erickmiyazaki

Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

Need Quotation Marks not brackets:

ControlClick ("www.roseonline.com", "", 786856 , "left", 1)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Well I just did what you said ronsrules.

Look my whole source code.

Run("D:\GAMES\RoseON\Roseonline"); Abre o RoseOnline
WinWaitActive("www.roseonline.com"); Espera até a janela ser aberta
ControlClick ("www.roseonline.com", "", 786856 , "left", 1)

It opens the game and stay there, doesnt click in the Play RoseOnline.


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Well I just did what you said ronsrules.

Look my whole source code.

Run("D:\GAMES\RoseON\Roseonline"); Abre o RoseOnline
WinWaitActive("www.roseonline.com"); Espera até a janela ser aberta
ControlClick ("www.roseonline.com", "", 786856 , "left", 1)

It opens the game and stay there, doesnt click in the Play RoseOnline.

<{POST_SNAPBACK}>

Try this:

Run("D:\GAMES\RoseON\Roseonline"); Abre o RoseOnline
If WinExists("www.roseonline.com") Then
   ControlClick ("www.roseonline.com", "", 786856 , "left", 1)
Else
   Do
   Until WinExists("www.roseonline.com")
   ControlClick ("www.roseonline.com", "", 786856 , "left", 1)
Endif

EDIT: Endif is usually good after an "If" statement :) @ me!!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Didn't work.

Well let me explain somethings.

When you open the game, this window will appear and check if there are upgrades to do, while it happens, the button will not be able to click.

Posted Image

After it checked and or upgraded the game, the button will appear.

Posted Image

So I want to my script recognize when the game checked for upgrades and finished, because when it finishes, the button will appear. So when the button appear I want to make my script click on that button.

*Sorry for bad english and thanks for everyone that is helping me with my first script*


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

What I would do is have it search for a pixel color and when it finds it. It sends the needed information.

Look under Pixel*() functions.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I Found the pixel of the x, y coordinate, so what command I use now to make my script click in the x, y coordinate when that z pixel exist?

And if the pixel z doesn't match, make it keep trying till the pixel z is correct?

Edited by erickmiyazaki

Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

Run ("D:\GAMES\RoseON\Roseonline")
$1 = 0x609C94
Do
    PixelSearch ("259, 581", "410, 564", "408, 598", "591, 580", "0x609C94")
Until $1 = 0x609C94
If $1= 0x609C94 Then
    MouseClick ("left", 372, 583, 2)
    EndIf

What did I do? Is this source correct for what I want? When I run this script it just click the mouse, don't wait until the pixel color matches, why?


Trying to make my first script, help me!

Share this post


Link to post
Share on other sites

I dont think PixelSearch is a suitable solution for you. It will take too long to go through the different stuff you have in there. Not to mention that you have too much information on there.

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step])

That is the proper way to do a pixel search.

PixelSearch(259, 581, 410, 598, "0x609c94").

But what I would use is PixelGetColor() it returns the color of the pixel where you specify the x and y coords.

PixelGetColor ( x , y )

PixelGetColor(259, 581)

I hope the above helps.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I really don't know if this will work; haven't tested it... but if you insist on PixelSearch... try this:

And please post if something does work :)

Run ("D:\GAMES\RoseON\Roseonline")

While WinExists("your window title")
   WinActivate("your window title")
   Sleep(50)
   PixelSearch (259, 581, 408, 598, 0x609C94)
   If Not @error Then
      MouseClick ("left", 372, 583, 2)
   Else
      Do
         PixelSearch (259, 581, 408, 598, 0x609C94)
      Until Not @error
      MouseClick ("left", 372, 583, 2)
   EndIf
WEnd

Good luck


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0