Sign in to follow this  
Followers 0
Metigue

FFR bot help, Timers

6 posts in this topic

#1 ·  Posted (edited)

Right. Entire source so far: (I'm ok with it as source will be public (without combos) when I'm done)

CODE
Opt("WinWaitDelay", 100)

Opt("WinTitleMatchMode", 2)

Opt("WinDetectHiddenText", 1)

Opt("MouseCoordMode", 2)

Opt("PixelCoordMode", 2)

; Opt("SendKeyDelay", 0) ;200 milliseconds

WinWait("FFR The Game FlashFlashRevolution.com - Windows Internet Explorer", "")

If Not WinActive("FFR The Game FlashFlashRevolution.com - Windows Internet Explorer", "") Then WinActivate("FFR The Game FlashFlashRevolution.com - Windows Internet Explorer", "")

WinWaitActive("FFR The Game FlashFlashRevolution.com - Windows Internet Explorer", "")

HotKeySet("{END}", "Terminate")

;~ Click to Get Focusof Web flash object

MouseMove(735, 545, 1)

MouseDown("left")

MouseUp("left")

$bot = 0

$L = 0

$D = 0

$U = 0

$R = 0

while $bot = 0

$starter = Pixelgetcolor(735, 545)

if $starter = 0x000000 Then

$bot = 1

EndIf

Wend

While $bot = 1

$Start = TimerInit()

While 1

If TimerDiff($Start) > 25 Then

If TimerDiff($Start) < 50 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, 392)

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, 392)

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(515, 392)

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, 392)

if $right = 0x000000 then

$R = 0

EndIf

WEnd

$Start = TimerInit()

EndIf

EndIf

WEnd

WEnd

Func Terminate()

Exit

EndFunc ;==>Terminate

Yes its working, you can turn it on and go to http://www.flashflashrevolution.com/FFR_the_Game.php and if you don't scroll down it will AAA any song you choose that doesn't have combos in.

Right, the thing I need help with is the timers, I have no idea about whats faster or slower, I kind of want.. about 50 checks a second? and Have I organised my code well? will it only read into the if statements if the events happened? or shall I move them outside of the loop?

Also, How do I go about adding combos? should I do them as seperate IF statements or what? because I tried that and it failed epicly.

And is there anyway for it to call my IF statements all at the same time instead of one after the other?

Edited by Metigue

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

MouseMove(735, 545, 1)
MouseDown("left")
MouseUp("left")

This is not fullproof.. I'd try using _IE functions like _IeGetObjByName.. etc..

If TimerDiff($Start) > 25 Then
If TimerDiff($Start) < 50 Then

Use only 1 if..

Right, the thing I need help with is the timers, I have no idea about whats faster or slower, I kind of want.. about 50 checks a second? and Have I organised my code well? will it only read into the if statements if the events happened? or shall I move them outside of the loop?

The timer section is fine enough.. what help do u need in there?? I tried going to FFR site, u provided but its taking a lot of time to load.. hence not tested ur code.. But as far as i can see.. too many if statements.. U can easily use switch case.. it reduces a lot of lines.. and makes it easy for you to work with.. Since u don't have any "else" es.. it's better if u used a Switch-Case Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

MouseMove(735, 545, 1)
MouseDown("left")
MouseUp("left")

This is not fullproof.. I'd try using _IE functions like _IeGetObjByName.. etc..

If TimerDiff($Start) > 25 Then
If TimerDiff($Start) < 50 Then

Use only 1 if..

The timer section is fine enough.. what help do u need in there?? I tried going to FFR site, u provided but its taking a lot of time to load.. hence not tested ur code.. But as far as i can see.. too many if statements.. U can easily use switch case.. it reduces a lot of lines.. and makes it easy for you to work with.. Since u don't have any "else" es.. it's better if u used a Switch-Case

Thanks for the advice, and Its just to click in there to make sure the flash windows active, its not even necessary, what is switch-case? will it let me run more then 2 of the if statements at the same time.. e.g. for combos? and can you think of a better method then $L=1 then make it scan the pixel like a thousand times a second till its black again $L=0, because sometimes in FFR you get parts where theres too many notes for it to turn black again, and it gets stuck in that loop, all I want is it to press left once, and carry on with the cycle ignoring left till its black again

Share this post


Link to post
Share on other sites

Scanning the pixel a thousand times a second is a good idea, but impractical.

You can increase the speed of the arrows so that they have much more space.


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Scanning the pixel a thousand times a second is a good idea, but impractical.

You can increase the speed of the arrows so that they have much more space.

What do you mean? If I take that code out it just spams the arrow key about 400 times for the one pixel while the key is being pressed, and is there anyway for it to check all of my if statements at the same time instead of one after the other? and to increase the speed of my loop by putting the whiles and ifs elsewhere?

and people testing this, if its not working, change 392 to 394 on all of the getpixel coords, arrows have to be going to the top of the screen (default) and you have to be scrolled all the way up

Edited by Metigue

Share this post


Link to post
Share on other sites

Switch-Case from the Help file..

Switch...Case...EndSwitch

--------------------------------------------------------------------------------

Conditionally run statements.

Switch <expression>

Case <value> [To <value>] [,<value> [To <value>] ...]

statement1

...

[Case <value> [To <value>] [,<value> [To <value>] ...]

statement2

...]

[Case Else

statementN

...]

EndSwitch

Parameters

<expression> An expression that returns a value. This value is then compared against the values of each case until a match is found.

<value> To <value> The case is executed if the expression is between the two values.

<value> The case is executed if the expression matches the value.

Remarks

If no cases match the Switch value, then the Case Else section, if present, is executed. If no cases match and Case Else is not defined, then none of the code inside the Switch structure will be executed.

Switch statements may be nested.


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

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