Jump to content

When... Then... Any function like this? :(


Recommended Posts

I really need a function like When... Then...(or When... Do this...)

An example worth 1,000 words

example:

When
  Pixelgetcolor(a,b)=0x000000
Then
  mouseclick("left",a,b)
(ortherwise, wait until the Pixelgetcolor(a,b)=0x000000)

Anyone?

Link to comment
Share on other sites

If...Then.

While...Wend.

Do...Until.

Take your pick.

Edit: typo

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Read up on loops, what I have for you make not work in your situation... also I'm about to leave so this is a quick type up but should get you started

Do

sleep(100)

until Pixelgetcolor(a,:whistle:=0x000000

mouseclick("left",a,:lmao:

like I said though read up on loops

EDIT: Don't know why its putting smiley faces where the b's were...

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

Reviewing the help file or searching the forum would have turned up VERY good results. These exact same questions are asked repeatedly. Here we go again.......try this:

While 1
    $color = PixelGetColor($x, $y)
    If $color = 0x000000 Then
        ;do some clicking
    EndIf
WEnd
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Reviewing the help file or searching the forum would have turned up VERY good results. These exact same questions are asked repeatedly. Here we go again.......try this:

While 1
    $color = PixelGetColor($x, $y)
    If $color = 0x000000 Then
        ;do some clicking
    EndIf
WEndoÝ÷ Ûú®¢×¨Ê(»­Ö©¥æ«²Øb±û§rب
+Ê'*'^­è¬¶©j»h~l¬r¸©¶'hÛ§uê쵩Ý­騺Ǭµ¬¬jØ­²Zqì!z{ayø«²Ú®¢Ü!W°zwjºb±Ú'y«­¢+Ù5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌÜ°ÈàÄ°Ä°Ô¤()]¡¥±Ä(ÀÌØí½±½ÈôA¥á±Ñ
½±½È ÐàÄ°àÀĤ(%ÀÌØí½±½ÈôÁáÅÅQ¡¸(5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐàÄ°àÀÄ°Ä°Ô¤($%µ½Õͱ¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ØØÔ°äÔä°Ä°Ô¤(¹%)]¹)ͱÀ ÈÀÀ¤()=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤(ÀÌØí¹½ÑÁÄô]¥¹ÑQáÐ ÅÕ½ÐíÁɹ½µÌ¹Ñáд9½ÑÁÅÕ½Ðì¤(ÀÌØí±¥¹ÌÄôMÑÉ¥¹MÁ±¥Ð ÀÌØí¹½ÑÁıɱ°Ä¤(ÀÌØíɹ½µ±¥¹ÄôI¹½´ Ä°ÀÌØí±¥¹ÌÅlÁt°Ä¤)
±¥ÁÁÕÐ ÀÌØí±¥¹ÌÅlÀÌØíɹ½µ±¥¹Åt¤()]¡¥±Ä(ÀÌØí½±½ÈÈôA¥á±Ñ
½±½È ÜÀä°ÌÔФ(%ÀÌØí½±½ÈÈôÁáQ¡¸(5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÜÀä°ÌÔаİԤ($%M¹¡
±¥ÁÐ ¤¤($%ͱÀ ÈÀÀ¤($$ÀÌØí¹½ÑÁÈô]¥¹ÑQáÐ ÅÕ½Ðí¹½µÌ¹Ñáд9½ÑÁÅÕ½Ðì¤($$ÀÌØí±¥¹ÌÈôMÑÉ¥¹MÁ±¥Ð ÀÌØí¹½ÑÁȱɱ°Ä¤($$ÀÌØíɹ½µ±¥¹ÈôI¹½´ Ä°ÀÌØí±¥¹ÌÉlÁt°Ä¤($%
±¥ÁÁÕÐ ÀÌØí±¥¹ÌÉlÀÌØíɹ½µ±¥¹Ét¤($%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ØäØ°ÌàÜ°Ä°Ô¤($%M¹¡
±¥ÁÐ ¤¤(¹%)]¹
Link to comment
Share on other sites

ok so what you suggest me to do if i want it to stop when the first loop is done, like when it finishes its job

Use a smattering of punctuation. :-)

I'm not trying to be mean here, but have you tried the Do/Until suggested posted by two members in this thread?

It may be clear to you what you want - but it is not clear to me and it is probably for a game, something I don't care to spend much time helping people script.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Use a smattering of punctuation. :-)

I'm not trying to be mean here, but have you tried the Do/Until suggested posted by two members in this thread?

It may be clear to you what you want - but it is not clear to me and it is probably for a game, something I don't care to spend much time helping people script.

hey, the Do...Until worked better :whistle:

But now I have a question. What function should i use to tell the script that if it did the first do...until, then skip the second one or vice versa

Do ;the first do...until
    $color3 = PixelGetColor(720,445)
Until $color3 = 0xFFFFFF 
        Clipput($lines2[$randomline2])
        MouseClick("left", 720 , 444,1,5)
        Send(Clipget())
        sleep(600)
        Clipput($lines1[$randomline1])
        MouseClick("left", 720 , 444,1,5)
        Send(Clipget())
        MouseClick("left", 848 , 446,1,5)
Do ;the second do...until
    $color4 = PixelGetColor(710,418)
Until $color4 = 0xFFFFFF 
       MouseClick("left", 710 , 418,1,5)
        Send(Clipget())
        sleep(600)
        Clipput($lines1[$randomline1])
        MouseClick("left", 710 , 418,1,5)
        Send(Clipget())
        MouseClick("left", 848 , 418,1,5)

Btw: this script is not for a game, its more for completing forms online, i need that "when...then" function to know exactly when the page has finished refreshing (so the pixel will be white when the blank case (to write our name by example) appears)

Edited by anyways
Link to comment
Share on other sites

...What function should i use to tell the script that if it did the first do...until, then skip the second one or vice versa...

How about If...Then?

I would change the Do/Until to this so as to not use up too much of the CPU

Do ;the first do...until
    Sleep(9)
Until PixelGetColor(720, 445) = 0xFFFFFF ;color3

I do not know where to put the If...Then 'cuz I don't completely understand the task. As you have it written, it will stay in the first Do/Until "until" the color is found. You could maybe use the Adlib func to periodically run the second Do/Until... You would need to set a flag that tells the main part of the script that the Adlib has taken care of things and to exit the first Do/Until loop. Your Adlib func would need to be wrapped in an If...Then...EndIf so that it checks a flag set by just after the first Do/Until loop so that the Adlib func will not run if the main Do/Until took care of things. Is all of that clear as mud?

Before you go chasing that kind of code, 'splain some more about why you need two checks like that.

[so you are completing a form with random info?] Hmmmm.

Edit: Man I wished that I had seen googemyster's code before I typed all of my ramblings :-(

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

How about If...Then?

I would change the Do/Until to this so as to not use up too much of the CPU

Do ;the first do...until
    Sleep(9)
Until PixelGetColor(720, 445) = 0xFFFFFF ;color3

I do not know where to put the If...Then 'cuz I don't completely understand the task. As you have it written, it will stay in the first Do/Until "until" the color is found. You could maybe use the Adlib func to periodically run the second Do/Until... You would need to set a flag that tells the main part of the script that the Adlib has taken care of things and to exit the first Do/Until loop. Your Adlib func would need to be wrapped in an If...Then...EndIf so that it checks a flag set by just after the first Do/Until loop so that the Adlib func will not run if the main Do/Until took care of things. Is all of that clear as mud?

Before you go chasing that kind of code, 'splain some more about why you need two checks like that.

[so you are completing a form with random info?] Hmmmm.

hmmm, you are talking me with a language i dont understand, ill try the googemaster code and will let you know tomorow

and btw its pretty simple why i need two checks. Sometimes, in the form, the blank case that should be completed is a little bit over sometime a little under his main position (the website is a little f***ed, idk why). So i need to know exactly where it is to complete it with informations...

Edited by anyways
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...