Sign in to follow this  
Followers 0
Taudy

Problem with code logic

16 posts in this topic

#1 ·  Posted (edited)

Hi, so I have a piece of code that i wrote to do an action 20 times and then do a different action and then repeat, not sure why it isn't happy to do it though

the error that i get is

==> "Wend" statement with no matching "While" statement.:

i have a while statement but for some reason, it isn't being related to the wend.

$a = 0
    While 1
    $variable4 = PixelSearch(0, 0,1920, 1080,"0xEC883D")   
   
        if IsArray($variable4) = True Then
            SoundPlay("C:\WINDOWS\media\notify.wav",1)
            sleep (1000)
MouseMove($variable4 [0], $variable4 [1],1)
MouseClick("left")
$a = $a +1
if $a = 20 Then
        $variable2 = PixelSearch(0, 0,1920, 1080,"0x26286B")
    
     

    if IsArray($variable2) = True Then
        MouseMove($variable2 [0], $variable2 [1],1)
        MouseClick("left")
        $a = 0
    EndIf
       
        sleep (25000)
        else
        sleep (10)
        
    EndIf
wend

previously i had my code without the extra part to do another action after 20 loops but i wanted to make it do one more thing, can anyone see what is wrong with my code?

Edited by Taudy

Share this post


Link to post
Share on other sites



Poker bots are against the rules

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

sorry, to clarify, it isn't being used as a poker bot, it's a simple script made for a friend namd poe kerrington, the way i was taught to name programs during my SDD(software development and design) course was to include first 2 letters of first name and abbreviated last name, sorry if it has caused confusion. speaking of which, what game of poker could possibly be played with this script, if you choose not to believe me, then that is understandable, i hope someone is willing to help.

Edited by Taudy

Share this post


Link to post
Share on other sites

Thanks for your reply john, that may be the case, but each piece of code works singularly, it's when i try to stick it all together that i get the problem. i can't get it to recognise the entire piece of code as a while loop

Share this post


Link to post
Share on other sites

the code merely automates a program that my friend coded but has a feature where a large button appears over the middle of the screen at intervals of 80 seconds and disappears after 20 seconds, unless clicked, where it vanishes instantly,

the program spits out a box of a specific color at an interval of 80 seconds

after 20 alerts, it brings up a different box prompting to buy.

the feature was intended to be a nuisance for anyone trying to steal the program, and if they purchased it for some ridiculously cheap price, she would give them the version without the code, however it has been a couple years since she coded and doesn't have the source code any more, so i thought i would make a little program that fixed the bug,

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I ran it and got this:

(27,1) : ERROR: missing EndIf.

wend

^

REF: missing EndIf.

if IsArray($variable4) = True Then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Do you get it now ?

I tried placing an EndIf, but then i got this:

(9) : ==> Subscript used with non-Array variable.:

MouseMove($variable4 [0], $variable4 [1],1)

MouseMove($variable4 ^ ERROR

You do know you get a window wich tells you the error and its also written in the console. Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

okay, thats probably more right.... since i just... added a endif... in a place it seemed to fit... :huh2:


[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

Am I missing something here?

I dont see anything in that code to suggest its for a game.

He modified his first post. The code clearly said poker bot.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Hi guys, thanks for your help, i added the endif, which seems to be what the actual problem was after using the syntax stepthrough and that removed the error.

now i'm just need to revise the code and make sure it is actually doing what it should

is there a way to quickly check it is working. i suppose i could start a at 19 and see what happens.

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