Skip to content

Instantly share code, notes, and snippets.

@noih
Created September 19, 2022 13:02
Show Gist options
  • Save noih/ad4204deca901cc6b183ab05fb9df998 to your computer and use it in GitHub Desktop.
Save noih/ad4204deca901cc6b183ab05fb9df998 to your computer and use it in GitHub Desktop.
// screen resolution 800x600
// "F8" = cure skill hotkey
// Pos1 = potion NPC
// Pos2 = bank
// Pos3 = potion (work panel)
// "PageDown" to stop script
ExtVar[1] = 20 // interval, >= 10
ExtVar[2] = 1 // 1 = skill cure, 2 = food
ExtVar[3] = 2 // 1 = store bank to 4 billion, 2 = bond
ExtVar[4] = 2 // 1 = smith sell, 2 rkdr sell (need DRP2000.dll)
ExtVar[5] = 2 // 1 = ez < 2.339, 2 ez 2.339 (experimental)
ExtVar[6] = 1500000 // how much to prepare the materials
// flag
ExtVar[41] = 0 // is backpack money over 100 million ?
ExtVar[42] = 0 // backpack has 4 billion bond ?
ExtVar[43] = 0 // is backpack full ?
ExtVar[44] = 0 // is bank over 1 billion ?
ExtVar[48] = 0 // call windows failed count
// clear
ExtVar[24] = 0 // x
ExtVar[25] = 0 // y
Call CheckResolution
Begin:
Call Init
KeyPress(27)
Event:
// 0 = game open, hp, PageDown
On Color[36241609] != 0 || Color[39059486] = 4873587 || ScanKey = 34 Jump Emergency
Main:
Call Food
Call Smith
Call SmithSell
Call SmithBuy
If ExtVar[43] = 0
Call Work
Call WorkMake
Call Disconnection
End If
If ExtVar[41] = 1 || ExtVar[43] = 1 // is money over 1 billion or backpack full ?
Call Bank
Call BankMoney
If ExtVar[42] = 1 && ExtVar[3] = 2
Call BankStoreBond
End If
If ExtVar[43] = 1
Call ClearBackpack
ExtVar[43] = 0
End If
End If
Jump Main
//===================================================================
Smith:
While Color[6029850] != 0 || Color[6095436] != 0
KeyDown(32) // space
Delay(50)
KeyUp(32)
Delay(50)
MouseMove Pos1
KeyPress(13)
Delay(100)
Echo "boss"
KeyPress(13)
ExtVar[48] = 0
While(Color[6029850] != 0 || Color[6095436] != 0) && ExtVar[48] < 50
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
If ExtVar[48] >= 50
Call Disconnection
End If
Wend
Return
//===================================================================
SmithSell:
ExtVar[48] = 0
While((Color[18481700] = 0 && Color[18743871] = 0) || (Color[3342991] != 0 || Color[16843407] != 0)) && ExtVar[48] < 50
Left Up 10617434 // sell button
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
If Color[3342991] = 0 && Color[16843407] = 0
While(Color[4391385] != 2701378 || Color[4915662] != 2701378 || Color[4719061] != 2700345) && Color[3342991] = 0
If ExtVar[4] = 1
Call SmithSellAll
Else
SellAll 1 55
End If
Left Up XY2Pos[638,145] // next page
Delay(50)
Wend
Call CheckBagOver100Million
Left Up 19071601 // cancel button (close panel)
Delay(100)
End If
Return
SmithSellAll:
ExtVar[25] = 73 // y
Repeat 3
ExtVar[24] = 468 // x
Repeat 5
Left Up XY2Pos[ExtVar[24],ExtVar[25]]
Delay(50) // >= 50
Left Up XY2Pos[467,293] // confirm button
Delay(30) // >= 30
ExtVar[24] = ExtVar[24] + 35
End Repeat
ExtVar[25] = ExtVar[25] + 35
End Repeat
Return
//===================================================================
SmithBuy:
ExtVar[48] = 0
While((Color[18481700] = 0 && Color[18743871] = 0) || (Color[3342991] != 0 || Color[16843407] != 0)) && ExtVar[48] < 50
Left Up 10617356 // buy button
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
If Color[3342991] = 0 && Color[16843407] = 0
Left Up 4719229 // previous page
Delay(50)
Left Up 7078352 // material 1
Delay(50)
Repeat 10
Left Up 19071443
Delay(40) // >= 40
End Repeat
Delay(100)
Left Up 9306720 // material 2
Delay(50)
Repeat 20
Left Up 19071443
Delay(40)
End Repeat
Left Up 9241212 // next page
Delay(50)
Left Up 7209524 // material 3
Delay(50)
Repeat 20
Left Up 19071443
Delay(40)
End Repeat
End If
Call CheckBackpackFull
Left Up 7340532 // cancel exception popup
Delay(100)
Left Up 18940529 // cancel
Delay(100)
Left Up 18350642 // exit
Delay(100)
Return
//===================================================================
Work:
ExtVar[48] = 0
While (Color[27394838] = 5923179 || Color[28705546] = 5921114) && ExtVar[48] < 50
Left Up 28902168
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
MouseTick = 100
Right Click 1310740
MouseTick = 1
Return
//===================================================================
WorkMake:
Left Up Pos3
Delay(100)
Left Up 24969616 // max button
Delay(100)
Left Up 24248643 // confirm button
ExtVar[48] = 0
While Color[22282738] = 0 && Color[25362909] = 0 && ExtVar[48] < 50
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
If ExtVar[48] < 50
Call Peace
ExtVar[24] = 47
While ExtVar[24] >= -53
ExtVar[25] = 70
While ExtVar[25] >= -40
Left Click XY2Pos[400 + ExtVar[24], 300 + ExtVar[25]]
ExtVar[25] = ExtVar[25] - 15
WEnd
ExtVar[24] = ExtVar[24] - 8
WEnd
Else
Left Up 24248797 // cancel button
End If
Return
//===================================================================
Bank:
While Color[2818593] != 0 || Color[3867210] != 0
KeyDown(32) // space
Delay(100)
KeyUp(32)
Delay(100)
MouseMove Pos2
KeyPress(13)
Delay(100)
Echo "boss"
KeyPress(13)
ExtVar[48] = 0
While(Color[2818593] != 0 || Color[3867210] != 0) && ExtVar[48] < 50
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
If ExtVar[48] >= 50
Call Disconnection
End If
Wend
Return
//===================================================================
BankMoney:
Interval = 300
Left Up 6750775 // save money
Echo "9999999999" // save all
Left Up 19857914 // confirm button
Left Up 19923577 // cancel button
Left Up 8651318 // take money
Echo "$[ExtVar[6]]"
Left Up 19857914 // confirm button
Call CheckBankOver1Billion
If ExtVar[44] = 1 && ExtVar[3] = 2 // take bond
Echo "1000000000"
Left Up 19857914 // confirm button
ExtVar[42] = 1
Else If ExtVar[44] = 0 || ExtVar[3] = 1
ExtVar[42] = 0
End If
Left Up 19923577 // cancel button
If ExtVar[42] = 0
Left Up 20316726 // exit bank
End If
Interval = ExtVar[1]
Return
//===================================================================
BankStoreBond:
Interval = 200
Left Up 10879541 // store button
Left Up 21955189 // previous button
Left Up 21955189 // previous button
If ExtVar[5] = 1
Repeat 3
Pos7 = GetColorPos[6534812, 13435384, 20185870] // bond pos
While Pos7 >= 1
Left DbClick Pos7 // double click bond
Pos7 = GetColorPos[6534812, 13435384, 20185870]
WEnd
Left Up 21955225 // next page
End Repeat
Else
Interval = 1
Repeat 3
ExtVar[25] = 222 // Y
While ExtVar[25] <= 222 + 35 * 2
ExtVar[24] = 510 // X
While ExtVar[24] <= 510 + 35 * 7
If Color[XY2Pos[ExtVar[24], ExtVar[25]]] = 11519
Repeat 2
Left DbClick XY2Pos[ExtVar[24], ExtVar[25]]
Delay(100)
End Repeat
MouseMove 21889611
End If
ExtVar[24] = ExtVar[24] + 35
Wend
ExtVar[25] = ExtVar[25] + 35
WEnd
Left Up 21955225 // next page
Delay(100)
End Repeat
End If
Delay(100)
Left Up 21889786 // exit bank
Delay(50)
Interval = ExtVar[1]
Return
//===================================================================
CheckBagOver100Million:
If ExtVar[5] = 1
If GetColorPos[13558750, 18743800, 19137020] != -1
ExtVar[41] = 1
Else
ExtVar[41] = 0
End If
Else
If Color[XY2Pos[503,288]] = 13558750 || Color[XY2Pos[504,288]] = 13558750 || Color[XY2Pos[505,288]] = 13558750
ExtVar[41] = 1
Else
ExtVar[41] = 0
End If
End If
Return
//===================================================================
CheckBankOver1Billion:
If ExtVar[5] = 1
If GetColorPos[13558750,9962046,10355264] != -1
ExtVar[44] = 1
Else
ExtVar[44] = 0
End If
Else
If Color[XY2Pos[573,152]] = 13558750 || Color[XY2Pos[574,152]] = 13558750 || Color[XY2Pos[575,152]] = 13558750
ExtVar[44] = 1
Else
ExtVar[44] = 0
End If
End If
Return
//===================================================================
CheckBackpackFull:
If Color[11928082] = 5928340 && ExtVar[43] = 0
ExtVar[43] = 1
End If
Return
//===================================================================
ClearBackpack:
ExtVar[48] = 0
While (Color[13370132] != 0 && Color[19530516] != 0) && ExtVar[48] < 50
Left Up 38011136 // open backpack
Delay(100)
ExtVar[48] = ExtVar[48] + 1
WEnd
Repeat 2
Left Up 22020722 // previous page
Delay(50)
End Repeat
Repeat 3
ExtVar[25] = 0 // Y
While ExtVar[25] <= 2
ExtVar[24] = 0 // X
While ExtVar[24] <= 7
// 2726589 money, 1612510 magic book
If Color[XY2Pos[518+35*ExtVar[24],214+35*ExtVar[25]]] != 0 || Color[XY2Pos[518+35*ExtVar[24],218+35*ExtVar[25]]] != 0 // empty bin
If Color[XY2Pos[520+35*ExtVar[24],222+35*ExtVar[25]]] != 2726589 && Color[XY2Pos[520+35*ExtVar[24],222+35*ExtVar[25]]] != 1612510 // exclude money, magic book
Left Down XY2Pos[520+35*ExtVar[24],222+35*ExtVar[25]]
Delay(110) // >= 110
Left Up 2883962
Delay(100)
End If
End If
ExtVar[24] = ExtVar[24] + 1
Wend
ExtVar[25] = ExtVar[25] + 1
WEnd
Left Up 21955225 // next page
Delay(50)
End Repeat
Left Up 38011136 // close backpack
Delay(100)
Return
//==============================================================================
Init:
Interval = ExtVar[1]
MoveFlag = 1
MouseTick = 1
KeyTick = 1
Right Up Mousepos // release mouse right
KeyDown(27) // esc
Delay(100)
KeyUp(27)
Delay(100)
MouseMove XY2Pos[397,287] // screen center
KeyDown(32) // space
Delay(800)
KeyUp(32)
Delay(50)
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)
Echo "/takeonly 0"
KeyPress(13)
KeyPress(27)
If Color[27394838] != 5923179 && Color[28705546] != 5921114
Call InitChooseWork
End If
Return
//==============================================================================
InitChooseWork:
Left Up 37814704 // work panel
Delay(50)
ExtVar[48] = 0
While(Color[30474678] != 0 || Color[30474682] != 0) && ExtVar[48] <= 5
Left Up 30802253 // next page
Delay(50)
ExtVar[48] = ExtVar[48] + 1
WEnd
ExtVar[48] = 0
While(Color[30474678] != 0 || Color[30474682] != 0) && ExtVar[48] <= 5
Left Up 30605626 // previous page
Delay(50)
ExtVar[48] = ExtVar[48] + 1
WEnd
ExtVar[48] = 0
While Color[31719792] != 0 && ExtVar[48] <= 20
Left Up 32833869 // right page
Delay(50)
ExtVar[48] = ExtVar[48] + 1
WEnd
ExtVar[48] = 0
While Color[31719792] != 0 && ExtVar[48] <= 20
Left Up 32899384 // left page
Delay(50)
ExtVar[48] = ExtVar[48] + 1
WEnd
Left Up 32440689 // first work
Delay(50)
Left Up 24248797 // close
Return
//=============================================================
Emergency:
If ScanKey = 34 // "PageDown" button
Jump End
End If
If Color[36241609] != 0 // is game close ?
Right Up MousePos // release mouse right
While Color[36241609] != 0
Delay(100)
WEnd
Jump Main
End If
If Color[39059486] = 4873587 // wait for relive
While Color[39059486] = 4873587
Delay(100)
WEnd
Jump Begin
End If
Resume
//=================================================
Food:
If Color[34996310] != 51183 // is hungry ?
If ExtVar[2] = 1
Call Battle
Repeat 2
KeyUp(f8) // F8
MouseMove XY2Pos[397,287] // mouse to center
Delay(2400)
MouseTick = 50
Right Click XY2Pos[397,287] // self body
MouseTick = 10
Delay(4000)
End Repeat
Call Peace
ElseIf ExtVar[2] = 2
KeyPress(49)
End If
End If
Return
//=================================================
Peace:
While Color[36700855] = 0 || Color[37159613] = 0
Left Up 36635356
Delay(100)
WEnd
Return
//=================================================
Battle:
While Color[36700855] != 0 || Color[37159613] != 0
Left Up 36635356
Delay(100)
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
//=================================================
End:
Interval = ExtVar[1]
KeyDown(27) // esc
Delay(100)
KeyUp(27)
Delay(100)
Call Peace
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