Sign in to follow this  
Followers 0
LonelyRaven

Proud User Of AutoIt Having Scripting Errors HELP!

15 posts in this topic

#1 ·  Posted (edited)

:D Ok I had a script from version 2.0 that looked like this and it worked fine. But... (Continued down past code)

return 
GoSub, craft1 
GoSub, craft2 
GoSub, craft3 
GoSub, craft1 
GoSub, craft2 
GoSub, craft3 
Send, /sit{ENTER} 
GoSub, craft1 
GoSub, craft2 
GoSub, craft3 
GoSub, craft1 
GoSub, craft2 
GoSub, craft3 
Send, /stand{ENTER} 
craft1: 
LeftClick,322,51;Craft Tool #1 
Sleep, 3000 
LeftClick,345,315;Tissues Tab 
Sleep, 3000 
LeftClick,215, 495;Micronutrient Supplement 
Send, {ENTER} 
Sleep, 5000 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
Sleep, 5000 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
Sleep, 5000 
Send, {ENTER} 
Sleep, 2500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 5000 
return 
craft2: 
LeftClick,355, 51;Craft Tool #1 
Sleep, 3000 
LeftClick,345,315;Tissues Tab 
Sleep, 3000 
LeftClick,215, 495;Micronutrient Supplement 
Send, {ENTER} 
Sleep, 5000 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
Sleep, 5000 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
Sleep, 5000 
Send, {ENTER} 
Sleep, 2500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 5000 
return 
craft3: 
LeftClick,385, 51;Craft Tool #1 
Sleep, 3000 
LeftClick,345,315;Tissues Tab 
Sleep, 3000 
LeftClick,215, 495;Micronutrient Supplement 
Send, {ENTER} 
Sleep, 5000 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
LeftClick,230, 205;Berries 
Sleep, 5000 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
LeftClick,275, 205;Meat 
Sleep, 5000 
Send, {ENTER} 
Sleep, 2500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 3500 
Send, {ENTER} 
Sleep, 5000 
return

But it was having repeating errors and after so many loops itd just close out and then I noticed V3 had an ability to repeat easily so I downloaded it and used the "Script Converter" and then typed

WinActivate("SwgClient")
while 1
sleep( 3000) <---At the top
sleep( 3000) <---at the Bottom
wend

And now it says there is no matching Wend for While 1 whenever I try and open the script for testing. The script looks like this\/(Down). Could someone kindly tell me how I could fix it And/Or fix the AutoItV2 script so that it loops enough that I could go to school and comeback with it still looping? :lol: That would be awesome! ;) By the way.. Im still learning!:-) I got this script from a forum and I learned the coordinates but I'm still learning the "How To" about things in "Auto-It"

Aim:LonelyRaven000 Email LonelyRaven0000@yahoo.com

WinActivate("SwgClient")
while 1
sleep( 3000)


craft1 ( )
craft2 ( )
craft3 ( )
craft1 ( )
craft2 ( )
craft3 ( )
Send ( '/sit{ENTER}' )
craft1 ( )
craft2 ( )
craft3 ( )
craft1 ( )
craft2 ( )
craft3 ( )
Send ( '/stand{ENTER}' )
Func craft1 ( )
    MouseClick( "left", 322, '51;Craft Tool #1' )
    Sleep ( 3000 )
    MouseClick( "left", 345, '315;Tissues Tab' )
    Sleep ( 3000 )
    MouseClick( "left", 215, '495;Micronutrient Supplement' )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    Sleep ( 5000 )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    Sleep ( 5000 )
    Send ( '{ENTER}' )
    Sleep ( 2500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    Return 
EndFunc    ; craft1

Func craft2 ( )
    MouseClick( "left", 355, '51;Craft Tool #1' )
    Sleep ( 3000 )
    MouseClick( "left", 345, '315;Tissues Tab' )
    Sleep ( 3000 )
    MouseClick( "left", 215, '495;Micronutrient Supplement' )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    Sleep ( 5000 )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    Sleep ( 5000 )
    Send ( '{ENTER}' )
    Sleep ( 2500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    Return 
EndFunc    ; craft2

Func craft3 ( )
    MouseClick( "left", 385, '51;Craft Tool #1' )
    Sleep ( 3000 )
    MouseClick( "left", 345, '315;Tissues Tab' )
    Sleep ( 3000 )
    MouseClick( "left", 215, '495;Micronutrient Supplement' )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    MouseClick( "left", 230, '205;Berries' )
    Sleep ( 5000 )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    MouseClick( "left", 275, '205;Meat' )
    Sleep ( 5000 )
    Send ( '{ENTER}' )
    Sleep ( 2500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 3500 )
    Send ( '{ENTER}' )
    Sleep ( 5000 )
    Return 
EndFunc    ; craft3

Sleep( 3000)
wend

PLEASE HELP! :idiot:

Edited by LonelyRaven

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

...a...

Edited by Dalarn

Share this post


Link to post
Share on other sites

Move the functions outside of the While loop.


Phillip

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Altered\Moved to my next post.

Edited by MHz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Wow! YOU GUYS ARE SO AWESOME! I love this website and program! :idiot: Lemme see if it works.. Ill get back to you:-)

Edited by LonelyRaven

Share this post


Link to post
Share on other sites

Oh no.... It's not working it will just sit there idle after it gets through the first three parts.. Cause the Pause 1 second is on repeat.. I want the whole thing to repeat

Share this post


Link to post
Share on other sites

Oh no.... It's not working it will just sit there idle after it gets through the first three parts.. Cause the Pause 1 second is on repeat.. I want the whole thing to repeat

<{POST_SNAPBACK}>

Send the code, and I'll take a look.


Phillip

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Sorry, Try this.

WinActivate("SwgClient")

HotKeySet('!e', 'Leave'); Set Alt-E to Exit

While 1
craft1 ( )
craft2 ( )
craft3 ( )
craft1 ( )
craft2 ( )
craft3 ( )
Send ( '/sit{ENTER}' )
craft1 ( )
craft2 ( )
craft3 ( )
craft1 ( )
craft2 ( )
craft3 ( )
Send ( '/stand{ENTER}' )
WEnd

Func Leave(); Alt-E Hotkey function
   Exit
EndFunc

Func craft1 ( )
   MouseClick( "left", 322, 51 );Craft Tool #1
   Sleep ( 3000 )
   MouseClick( "left", 345, 315 );Tissues Tab
   Sleep ( 3000 )
   MouseClick( "left", 215, 495 );Micronutrient Supplement
   Send ( '{ENTER}' )
   Sleep ( 5000 )
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   Sleep ( 5000 )
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   Sleep ( 5000 )
   Send ( '{ENTER}' )
   Sleep ( 2500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 5000 )
EndFunc   ; craft1

Func craft2 ( )
   MouseClick( "left", 355, 51 );Craft Tool #1
   Sleep ( 3000 )
   MouseClick( "left", 345, 315 );Tissues Tab
   Sleep ( 3000 )
   MouseClick( "left", 215, 495 );Micronutrient Supplement
   Send ( '{ENTER}' )
   Sleep ( 5000 )
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   Sleep ( 5000 )
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   Sleep ( 5000 )
   Send ( '{ENTER}' )
   Sleep ( 2500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 5000 )
EndFunc   ; craft2

Func craft3 ( )
   MouseClick( "left", 385, 51 );Craft Tool #1
   Sleep ( 3000 )
   MouseClick( "left", 345, 315 );Tissues Tab
   Sleep ( 3000 )
   MouseClick( "left", 215, 495 );Micronutrient Supplement
   Send ( '{ENTER}' )
   Sleep ( 5000 )
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   MouseClick( "left", 230, 205 );Berries
   Sleep ( 5000 )
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   MouseClick( "left", 275, 205 );Meat
   Sleep ( 5000 )
   Send ( '{ENTER}' )
   Sleep ( 2500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 3500 )
   Send ( '{ENTER}' )
   Sleep ( 5000 )
EndFunc   ; craft3
Edited by MHz

Share this post


Link to post
Share on other sites

Sorry, Try this.

<{POST_SNAPBACK}>

MHz, the following is from the attachment you sent a few minutes ago.

Func Exit() ; Alt-E Hotkey function

Exit

Func

The function EXIT fails the syntax check because it is a reserved word. And the closing statement should be EndFunc.


Phillip

Share this post


Link to post
Share on other sites

Yes, opps. I was trying to make it look straight forward but used a command as a function name. Please check again, as I have reattached it. :">

Share this post


Link to post
Share on other sites

Yes, opps. I was trying to make it look straight forward but used a command as a function name. Please check again, as I have reattached it.  :">

<{POST_SNAPBACK}>

Nope! The closing statement is still mispelled. Here's the correction.

Func Leave() ; Alt-E Hotkey function

Exit

EndFunc

BTW, aren't you the SciTe guy? That's what I used to check it. It a damn fine editor!!!


Phillip

Share this post


Link to post
Share on other sites

Thanks phillip123adams. Changed it back to Au3 format so I could use Scite to error check.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Is it possible to make the leftclick random within a square?

So instead of using fixed pointing, it would just use random leftclick within a fixed square.

MouseClick( "left", 230, 205 );Berries

230 and 205 should be somewhere within 200-240 / 200-220 (example)

Is it also possible to make the sleep random within a fixed time?

Sleep ( 5000 )

5000 should be something between 4-7 second.

Thanks in advance

EDIT:

Maybe i should look in the help file before i post here :idiot:

;Random Sleep
$Sleepchange = Int(Random(4000, 7000)); generate an integer between 4000 and 7000
$Sleep = $Sleep + $Sleepchange
    MsgBox(4096, "Sleep", "You have been sleeping" & $Sleep)

;Random Click
$LCChange1 = Int(Random(200, 240)); generate an integer between 200 and 240
$LC1 = $LC1 + $LCChange1
   MsgBox(4096, "Lefclick", "Position 1 " & $LC1)
$LCChange2 = Int(Random(200, 220)); generate an integer between 200 and 220
$LC2 = $LC2 + $LCChange2
   MsgBox(4096, "Lefclick", "Position 2 " & $LC2)

MouseClick( "left", $LC1, $LC2 );Berries

woow, actually the first time i got something to work from the start :D

Both random sleep and click works great.

Now we just have to figure out the positions of the boxes.

Do you know if window spy works for this?

Edited by Doxie

Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites

I tried the script yesterday, and it works really nice.

Even if the craft session is failed, the script continue.

And i also use all random in it, sleep and mouseclick.

3 Craft boxes, within 1½ hour. :idiot:


Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

@ Doxie

Glad you had some success.

Cheers :idiot:

Edited by MHz

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