so your basicly saying, it would be wise to change the repeativeness in the inital setup, and the item to make by skill into subs so it would be 1 set of 6 lines instead of 6sets of 6lines, make less room for error
Every Code development (Not only Easyuo Scripts) should have some structure.
The Advantages:
1) Better Reading of Code
2) Lesser Writing Codes because you can use the same lines again and again
3) Better Hotfix of Code. Change 1 Sub or change same code 100th of times can be a minor difference
In a Script like this it may not affect that much, that you would need to change and create a structure.
If you ever experienced with scripts with some thousand lines of Code, you will know what i mean.
It doesnt exist a standart in structures, i personal use this
- Header - Describes the whole Script
- Subs - Splitted in Minor and Major Subfunctions
- Main - The Main Workflow how the script should Work
Here is a Pseudo example of a structure:
;#####################
; Name : Pseudo Example
; Puroise : Header
; Author : Crome696
;#####################
Sub Setup
Display cal here your Setup
return
;------------------------------
Sub MajorA
Gosub MinorB
return
;------------------------------
Sub MajorB
gosub MinorC
gosub MinorA
return
;------------------------------
Sub MajorC
gosub MinorC
gosub MinorA
return
;------------------------------
Sub MinorA
display Minor A
return
;------------------------------
Sub MinorB
display Minor B
return
;------------------------------
Sub MinorC
display Minor C
return
;######################
; Main Flow
;######################
Gosub Setup
for %i 1 3
{
Gosub MajorA
}
Gosub MajorB
Gosub MajorC
In Easyuo you can lay the Subs where you want in other ScriptEngines like Stealth or Openuo, functions must be loaded before you can call (forced structure).
Find your way to make a structure as well helps you to find ways to cut time to code and evolve yourself to write bigger scripts with lesser Code
another Example about the Viewing of Code:
set %BOS LLOCYMD
set %Supply POF_GMF_TTO_UVF
set %Queen RGB
set %Underlings PGB_SGB
set %Meold #scnt
Gosub Hole_One
Gosub Move_to_Queen
Start:
Gosub Get_Quest
Gosub Return_Hole_One
Gosub Hole_Two
Gosub Hole_Three
Gosub Do_Quest
Gosub Return_Hole_Three
Gosub Hole_One
Gosub Move_to_Queen
Gosub End_Quest
set %Me #scnt - %Meold
event macro 1 0 %Me
Goto Start
Have fun