Last active
August 25, 2022 16:43
-
-
Save noih/e725349c3ec213385de4d8dfab3dc66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// screen resolution 800x600 | |
// full HP required before start | |
// "PageDown" to stop script | |
ExtVar[0] = 1 // 1 = 70% hp, 2 = 50% hp, 3 = 30% hp | |
ExtVar[1] = 1 // check backpack items / pick round | |
ExtVar[2] = 20 // interval, >= 10 | |
ExtVar[3] = 3 // sample item count, 0 ~ 8 | |
ExtVar[4] = -1 // x offset, +- 13 | |
ExtVar[5] = 1 // y offset, +- 13 | |
//================================================= | |
ExtVar[30] = 36241609 // detect game close pos | |
ExtVar[31] = 39059486 // hp 0% pos | |
ExtVar[32] = Color[39059486] // hp 0% color | |
ExtVar[33] = -1 // hp pos | |
ExtVar[34] = -1 // hp color | |
ExtVar[35] = 34930762 // hungry 5% | |
ExtVar[36] = 51183 // hungry 5% color | |
ExtVar[37] = 1 // pick round count | |
ExtVar[38] = 521 + ExtVar[4] // backpack first x | |
ExtVar[39] = 221 + ExtVar[5] // backpack first y | |
//================================================= | |
ExtVar[40] = 0 // temp | |
ExtVar[41] = 0 // temp | |
//================================================= | |
ExtVar[60] = 0 // found first color | |
ExtVar[61] = 0 // found color x | |
ExtVar[62] = 0 // found color y | |
// ExtVar[50] ~ ExtVar[57] sample item colors | |
If ExtVar[0] = 1 | |
ExtVar[33] = 35323937 // 70% hp pos | |
ElseIf ExtVar[0] = 2 | |
ExtVar[33] = 36175904 // 50% hp pos | |
ElseIf ExtVar[0] = 3 | |
ExtVar[33] = 37093407 // 30% hp pos | |
End If | |
If ExtVar[3] < 0 || ExtVar[3] > 8 | |
ExtVar[3] = 0 | |
End If | |
ExtVar[34] = Color[ExtVar[33]] // hp color | |
Begin: | |
Call CheckResolution | |
Call Init | |
If ExtVar[3] > 0 | |
Call InitBackpackSample | |
End If | |
Event: | |
// game close, hp, hp potion, stop | |
On Color[ExtVar[30]] != 0 || Color[ExtVar[31]] != ExtVar[32] || Color[ExtVar[33]] != ExtVar[34] || ScanKey = 34 Jump Emergency | |
Main: | |
Call Battle | |
Call Pick | |
If ExtVar[37] = 0 && ExtVar[3] > 0 | |
Call CheckBackpack | |
End If | |
Call Disconnection | |
Jump Main | |
//================================================= | |
Pick: | |
Var1 = 332 // x | |
Repeat 10 | |
Var2 = 215 // y | |
Repeat 9 | |
Left Click XY2Pos[Var1,Var2] | |
Var2 = Var2 + 20 | |
End Repeat | |
Var1 = Var1 + 16 | |
End Repeat | |
Var1 = 324 // x | |
Repeat 10 | |
Var2 = 215 // y | |
Repeat 9 | |
Left Click XY2Pos[Var1,Var2] | |
Var2 = Var2 + 20 | |
End Repeat | |
Var1 = Var1 + 16 | |
End Repeat | |
If ExtVar[1] > 0 | |
ExtVar[37] = (ExtVar[37] + 1) % ExtVar[1] | |
End If | |
Return | |
//================================================= | |
InitBackpackSample: | |
Call OpenBackpack | |
// previous page | |
Repeat 3 | |
Left Up 22020722 | |
Delay(64) | |
End Repeat | |
Var1 = 0 | |
Repeat ExtVar[3] | |
ExtVar[61] = ExtVar[38] + (Var1 * 35) // x | |
ExtVar[62] = ExtVar[39] // y | |
Call FindColor | |
ExtVar[50 + Var1] = ExtVar[60] | |
Var1 = Var1 + 1 | |
End Repeat | |
Call CloseBackpack | |
Return | |
//================================================= | |
CheckBackpack: | |
Call OpenBackpack | |
// previous page | |
Repeat 3 | |
Left Up 22020722 | |
Delay(64) | |
End Repeat | |
Var4 = 1 // count | |
Repeat 3 | |
Interval = 1 | |
Var2 = ExtVar[39] // y | |
While Var2 <= 292 | |
Var1 = ExtVar[38] // x | |
While Var1 <= 765 | |
// skip samples | |
If Var4 > ExtVar[3] | |
Var3 = XY2Pos[Var1, Var2] | |
ExtVar[61] = Var1 | |
ExtVar[62] = Var2 | |
Call FindColor | |
Var5 = ExtVar[60] | |
// check sample colors | |
If Var5 != 0 | |
Var6 = 0 // found ? | |
Var7 = 0 // sample index | |
Repeat ExtVar[3] | |
If ExtVar[50 + Var7] = Var5 | |
Var6 = 1 | |
Break | |
End If | |
Var7 = Var7 + 1 | |
End Repeat | |
// throw item | |
If Var6 = 0 | |
Interval = ExtVar[2] | |
Left Down Var3 | |
Delay(110) // >= 110 | |
Left Up 2883962 | |
Interval = 1 | |
End If | |
End If | |
End If | |
Var1 = Var1 + 35 | |
Var4 = Var4 + 1 | |
Wend | |
Var2 = Var2 + 35 | |
WEnd | |
Interval = ExtVar[2] | |
Left Up 21955225 // next page | |
Delay(50) | |
End Repeat | |
Call CloseBackpack | |
Return | |
//================================================= | |
FindColor: | |
ExtVar[40] = ExtVar[61] // x arg | |
ExtVar[41] = ExtVar[62] // y arg | |
ExtVar[60] = 0 // return color | |
Repeat 2 | |
ExtVar[60] = Color[XY2Pos[ExtVar[40], ExtVar[41]]] | |
If ExtVar[60] != 0 | |
Break | |
End If | |
ExtVar[40] = ExtVar[40] + 1 | |
End Repeat | |
Return | |
//================================================= | |
Battle: | |
While Color[XY2Pos[691,567]] != 0 | |
Left Up XY2Pos[733,568] | |
Delay(100) | |
WEnd | |
Return | |
//================================================= | |
OpenBackpack: | |
Var1 = 0 | |
While (Color[13370132] != 0 && Color[19530516] != 0) && Var1 < 50 | |
Left Up 38011136 // open backpack | |
Delay(100) | |
Var1 = Var1 + 1 | |
WEnd | |
Return | |
//================================================= | |
CloseBackpack: | |
Var1 = 0 | |
While (Color[13370132] = 0 || Color[19530516] = 0) && Var1 < 50 | |
Left Up 38011136 | |
Delay(100) | |
Var1 = Var1 + 1 | |
WEnd | |
Return | |
//================================================= | |
Disconnection: | |
If Color[XY2Pos[523,178]] = 7045788 && Color[XY2Pos[524,178]] = 5928340 && Color[XY2Pos[525,178]] = 5404044 | |
Stop | |
End If | |
Return | |
//================================================= | |
CheckResolution: | |
If ScreenWidth != 800 || ScreenHeight != 600 | |
KeyDown(27) // esc | |
Delay(100) | |
KeyUp(27) | |
Delay(100) | |
KeyPress(13) | |
Delay(100) | |
Echo "screen resolution: $[ScreenWidth]x$[ScreenHeight], 800x600 required." | |
Stop | |
End If | |
Return | |
//================================================= | |
Emergency: | |
If ScanKey = 34 // "PageDown" button | |
Jump End | |
End If | |
If Color[ExtVar[30]] != 0 // is game close ? | |
Right Up MousePos // release mouse right | |
While Color[ExtVar[30]] != 0 | |
Delay(100) | |
WEnd | |
Jump Main | |
End If | |
If Color[ExtVar[31]] != ExtVar[32] // wait for relive | |
While Color[ExtVar[31]] != ExtVar[32] | |
Delay(100) | |
WEnd | |
Jump Begin | |
End If | |
If Color[ExtVar[33]] != ExtVar[34] // hp potion | |
KeyDown(18) // alt | |
Delay(50) | |
KeyDown(49) // 1 | |
Delay(100) | |
KeyUp(49) | |
Delay(50) | |
KeyUp(18) | |
End If | |
Resume | |
//================================================= | |
Init: | |
Interval = ExtVar[2] | |
MoveFlag = 1 | |
MouseTick = 1 | |
KeyTick = 1 | |
Right Up Mousepos // release mouse right | |
KeyPress(27) // esc | |
Delay(100) | |
KeyPress(27) | |
Delay(100) | |
MouseMove XY2Pos[397,287] // screen center | |
KeyPress(32) // space | |
Delay(100) | |
KeyPress(32) // space | |
Delay(700) | |
KeyPress(13) | |
Delay(100) | |
Echo "/run" | |
KeyPress(13) | |
Delay(50) | |
Echo "/nowar" | |
KeyPress(13) | |
Delay(50) | |
Echo "/nomenu" | |
KeyPress(13) | |
Delay(50) | |
Echo "/shift on" | |
KeyPress(13) | |
Delay(50) | |
Echo "/trade off" | |
KeyPress(13) | |
Delay(50) | |
Echo "/effectoff all" | |
KeyPress(13) | |
Delay(50) | |
Echo "/weather off" | |
KeyPress(13) | |
Delay(50) | |
KeyPress(27) | |
Return | |
//================================================= | |
End: | |
Interval = ExtVar[2] | |
KeyDown(27) // esc | |
Delay(100) | |
KeyUp(27) | |
Delay(100) | |
KeyPress(13) | |
Delay(100) | |
Echo "/nomenu off" | |
KeyPress(13) | |
Delay(50) | |
Echo "/trade on" | |
KeyPress(13) | |
Delay(50) | |
Echo "/shift off" | |
KeyPress(13) | |
Delay(50) | |
Echo "/effecton" | |
KeyPress(13) | |
Delay(50) | |
Echo "/weather on" | |
KeyPress(13) | |
Delay(50) | |
KeyPress(27) | |
Stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment