Jump to content

Running 4 infinite loops at the same time


Metigue
 Share

Recommended Posts

Ok well in my ffr bot I have one loop currently:

While $bot = 1
$Start = TimerInit()
While 1
    If TimerDiff($Start) > 1 Then
$left = PixelGetColor(380, 394)
$down = PixelGetColor(449, 394)
$up = PixelGetColor(518, 394)
$right = PixelGetColor(587, 394)
$starter = Pixelgetcolor(735, 545)

If $left <> 0x000000 and $L = 0 and $starter = 0x000000 then
    Send("{LEFT}")
    $L = 1
    EndIf
While $L = 1 
    $left = PixelGetColor(380, 394)
    if $left = 0x000000 then
    $L = 0
    EndIf
            WEnd

   If $down <> 0x000000  and $D = 0 and $starter = 0x000000 then
    Send("{DOWN}")
    $D = 1
    EndIf
While $D = 1 
    $down = PixelGetColor(449, 394)
    if $down = 0x000000 then
    $D = 0
    EndIf
            WEnd
    
      If $Up <> 0x000000 and $U = 0 and $starter = 0x000000 then
    Send("{Up}")
    $U = 1
    EndIf
While $U = 1 
    $up = PixelGetColor(518, 394)
    if $up = 0x000000 then
    $U = 0
    EndIf
            WEnd

   If $Right <> 0x000000 and $R = 0  and $starter = 0x000000 then
    Send("{Right}")
    $R = 1
    EndIf
While $R = 1 
    $right = PixelGetColor(587, 394)
    if $right = 0x000000 then
    $R = 0
    EndIf
            WEnd
    $Start = TimerInit()
EndIf
WEnd
WEnd

This searches for left, down, up, right in that order, but what I want is for it to search for them all at the same time, is it possible to create 4 loops that will run at the same time searching for those pixels seperately? If so, how do I do it?

Link to comment
Share on other sites

@Metigue

I dont think its possible 'at the same time'... you will have to call them separately or make 4 scripts :)

Cheers, FireFox.

In that case is there any other way I can get it to consider my IF's all at exactly the same time? because if it doesn't my bot wont be able to do combos.

Link to comment
Share on other sites

In that case is there any other way I can get it to consider my IF's all at exactly the same time? because if it doesn't my bot wont be able to do combos.

What I know, AutoIt cant perform 2 actions at the same time, they would need to go after each other. Edited by Zisly
Link to comment
Share on other sites

What I know, AutoIt cant perform 2 actions at the same time, they would need to go after each other.

OK, I made them all seperate scripts and now it works perfectly, If I build a gui script could I make it so all 4 scripts run through there?

Link to comment
Share on other sites

As far as i know yes.

Just call or include the 4 different scripts.

Can you show me an example of how to do that? (I'm pretty new at autoit)

If I run the 4 scripts together they all do everything twice for no reason apart from the last one I ran, but they all work perfectly by themselves. If I call or include them it wont happen (I think)

Link to comment
Share on other sites

There is also

AdlibEnable("_my_function_name",1000);call the function every 1 second

it may be useful. but you can use only 1 addlibenable, because as soon as you call addlibdisable() it will turn off addlibenable.

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

I would try declaring some variables globaly and changing the while loops to if loops.

Your script isn't that long so it wont take long for the script to run your whole script...

After the whole script gets executed, it will start from the beginning again until you press the

'x' button or write in the script to exit..

Which can be understood as 'the whole script is a while loop until told to stop.'

Edited by geasiki
Link to comment
Share on other sites

I would try declaring some variables globaly and changing the while loops to if loops.

I'm prefering the 4 seperate scripts, as it speeds up the check to about one every 0.3 ms which is quite good, and it is also all at the same time. I just need an incredibly simple GUI and to learn how to include them. Also does anyone know of a better way instead of $L = 0 / 1 to stop it from key spamming?

Edited by Metigue
Link to comment
Share on other sites

make New AutoIt v3 Script.au3 in the same folders as your main script. Paste this code in the file:

Func _myfunc()
    MsgBox(0,'','Binngo')
EndFuncoÝ÷ ØÚ0¥«-zØb±Êz)í£*.®f¢Ç+b×z§)àjëh×6#include <New AutoIt v3 Script.au3>
_myfunc()oÝ÷ Ø2¢ëxÜç^Âí­æ¥(^¨º«x.¬¶;¬¶»§jYx±Êâ¦Û/©{®*mjëh×6run('script1.exe')
run('script2.exe')
run('script3.exe')
run('script4.exe')
Exit
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

make New AutoIt v3 Script.au3 in the same folders as your main script. Paste this code in the file:

Func _myfunc()
    MsgBox(0,'','Binngo')
EndFuncoÝ÷ ØÚ0¥«-zØb±Êz)í£*.®f¢Ç+b×z§)àjëh×6#include <New AutoIt v3 Script.au3>
_myfunc()oÝ÷ Ø2¢ëxÜç^Âí­æ¥(^¨º«x.¬¶;¬¶»§jYx±Êâ¦Û/©{®*mjëh×6run('script1.exe')
run('script2.exe')
run('script3.exe')
run('script4.exe')
Exit
I don't really have a main script :)

and also now I have a new problem,

The backlash of the arrows is triggering my other arrows to go off,

the colours of the backlash are around

0x201D18

0x201E18

0x201D19

0x201E19

0x20201A

0x20201B

0x201F19

and more, how would I set it to cover all the colours around that area? and how would I tell my if statement to ignore it?

Example:

Posted Image

The green dots are where I'm detecting a pixel change and its one of the only places where a pixel does actually change when an arrow goes across, so I need to keep it there, but make it ignore the backlash.

Edited by Metigue
Link to comment
Share on other sites

as i can see from the pic above.. ur backlash.. is in a wider area than the arrow.. so just reduce the are.. and include only the area of the arrow in ur pixelsearch..

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

as i can see from the pic above.. ur backlash.. is in a wider area than the arrow.. so just reduce the are.. and include only the area of the arrow in ur pixelsearch..

Its not my game, lol. Its a bot for the game, what my bot does, is it scans the black part just above the arrow (the green dots are the bits they scan) until its not black, then presses the corresponding key depending what part its scanning, when you do an arrow correctly though, the game gives that backlash that you can see above, so I need to exclude that from my IF statement, the backlash is actually causing me all the problems I have atm so when I exclude it, the bot will be completed :).

The problem with searching for a specific pixel in the arrows that are coming is that the arrows change colour and are thousands of tones, (they hate botters)

http://www.flashflashrevolution.com/FFR_the_Game.php

if you want to check it out.

Edited by Metigue
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...