Jump to content

Please Help Me with this script


Recommended Posts

Found this RO2 script from a fellow forumer. It got some syntax errors and tidy issues but I am very noob at scripts. Anyone can tidy up the script for me? I've been workating on this for several hours now learning some basics about autoit scripting. I tried ctrl+t with my code and found 10 errors, but I just simply don't know how to fix them. Thanks, I'd really appreciate it if anyone could help. Here is the code (with the tidy codes placed by the editor)

HotKeySet("{F12}", "Start")
HotKeySet("{F11}", "Pause")

Func Start()
While 1
Sleep(100)
Target()
WEnd

EndFunc   ;==>Start

Func Target()

While 1
PixelSearch(321, 79, 494, 97, 0x140B01, 10) ;Last HP pixel (black)
If Not @error Then
Pot()
Attack()
ExitLoop
EndIf

Sleep(100)
Loot()
Sleep(100)
Send("{TAB}")
Send("{TAB}")
Sleep(100)
;### Tidy Error -> "endfunc" is closing previous "while" on line 14
EndFunc   ;==>Target

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
Func Attack()
Send("2") ;Attack skill 2
Send("2")
Sleep(3000)
Send("3") ;Attack skill 3
Send("3")
Sleep(500)
EndFunc   ;==>Attack

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
Func Pot()

While 1
PixelSearch(321, 79, 494, 97, 0x81CB12, 10) ;HP @ %
If Not @error Then
Send("9")
Send("9")
EndIf

PixelSearch(323, 199, 478, 112, 0x509BC, 10) ;MP @ %
If Not @error Then
Send("0")
Send("0")
EndIf

WEnd
EndFunc   ;==>Pot

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
Func Loot()

While 1
Send("R")
Send("R")
Sleep(2000)
Send("R")
Send("R")
PixelSearch(506, 344, 824, 482, 0x897E21, 10) ;Loot menu corner
If Not @error Then
Sleep(1000)
Send("R")
Send("R")
ExitLoop
EndIf
Sleep(100)
Send("R")
Send("R")
Sleep(100)
WEnd
EndFunc   ;==>Loot

;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
Func Pause()

While 1
Sleep(1000)
WEnd
EndFunc   ;==>Pause


;### Tidy Error -> func is never closed in your script.
Edited by Melba23
Added code tags
Link to comment
Share on other sites

Couple of things:

1. game automation discussion is prohibited as per the Forum Rules

2. please post autoit code in autoit tags

3. While loops must be ended with a WEnd :graduated:

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

SadBunny is correct.

The link to the forum rules can be found in the lower right corner of this page.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

HuwanBisente,

Nothing much more to add - so....... :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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