OpenKore / openkore

A free/open source client and automation tool for Ragnarok Online
http://openkore.com
Other
1.28k stars 1.04k forks source link

[bug] Kore attempts to initiate autobuy task while talking to NPC as part of route task #3733

Open ahoyaharr opened 1 year ago

ahoyaharr commented 1 year ago

------------------ Openkore Issues Template ------------------

Log:

[2023.03.10 20:36:33.78] [teleport] Teleporting due to idle
[2023.03.10 20:36:33.79] [teleport] You don't have the Teleport skill or a Fly Wing
[2023.03.10 20:36:34.19] [teleport] Auto-buy: Fly Wing
Teleporting to auto-buy
[2023.03.10 20:36:34.20] [useItem] You used Item: Butterfly Wing (1) x 1 - 3 left
[2023.03.10 20:36:34.21] [inventory] Inventory Item Removed: Butterfly Wing (1) x 1
[2023.03.10 20:36:34.21] [console] Permitted to use Teleport (26), level 3
[2023.03.10 20:36:34.24] [selfSkill] You are casting Teleport on yourself (Delay: 0ms)
[2023.03.10 20:36:34.25] [connection] Map Change: gonryun.gat (160, 113)
[2023.03.10 20:36:34.27] [effect] You use effect: 
[2023.03.10 20:36:34.27] [parseMsg_presence] NPC Exists: Chef Assistant#gon (147, 101) (ID 110001800) - (0)
[2023.03.10 20:36:34.27] [parseMsg_presence] NPC Exists: Weapon Dealer#gon (174, 101) (ID 110001689) - (1)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Crafting Materials#gon (152, 109) (ID 110013052) - (2)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Stylist#gef (170, 110) (ID 110013055) - (3)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Consumables#gon (152, 113) (ID 110013051) - (4)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Mailbox#gon (152, 117) (ID 110002369) - (5)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Kafra Employee (159, 122) (ID 110001556) - (6)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Warper#gon (162, 122) (ID 110013005) - (7)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Job Master#gef (168, 120) (ID 110013054) - (8)
[2023.03.10 20:36:34.28] [npcchat] You're now in the '#map' channel for 'gonryun'
[2023.03.10 20:36:35.11] [route] Calculating lockMap route to: Prontera Field F11(prt_fild11)
[2023.03.10 20:36:38.33] [list] -------- Responses (Warper#gon) --------
#  Response
0  Last Warp [orcsdun01]
1   ~ Towns
2   ~ Dungeons
3  Cancel Chat
----------------------------------------
[2023.03.10 20:36:39.61] [list] -------- Responses (Warper#gon) --------
#  Response
0  Abyss Lakes
1  Amatsu Dungeon
2  Anthell
<trimmed>
35 Cancel Chat
----------------------------------------
[2023.03.10 20:36:40.68] [console] NPC requires a response to be selected, but the given instructions don't match that (current step: b).
[2023.03.10 20:36:40.69] [console] Using method '0' defined on config key 'npcWrongStepsMethod' to deal with the error.
[2023.03.10 20:36:40.70] [console] Cleaning all remaining conversation steps, please input more steps using commands.

Debugging log:

ai print
[list] ------------------ AI Sequence -------------------
0: NPC

1: buyAuto
{index=>'0',distance=>'2',sentNpcTalk=>'1',sentNpcTalk_time=>'1678509399.52696',lastIndex=>'0',index_failed=>{e
mpty},npc=>{ok=>'1',map=>'gonryun',pos=>{y=>'113',x=>'152'}}}

2: route

--------------------------------------------------
ai ai_v
[list]
{portalTrace_mapChanged=>'1678509394.24998',temp=>{ai_route_index=>'0',do_route=>'',ai_route_attackOnRoute=>'1'
,found=>'1'},AI_last_finished=>'1678512411.77872',npc_talk=>{talk=>'select',time=>'1678509405.06821'}}

At this point, Kore is stuck until relog is forced (with a plugin I wrote). I think in RouteMap and also whichever class is being used for autobuy (will look into it) and autostorage, we need to implement a lock for interacting with another NPC.

alisonrag commented 1 year ago

just to be sure, are you using some kind of macro/eventmacro? can you also post de plugin list?

ahoyaharr commented 1 year ago

Stock plugins only:

[list] -------------------------- Currently loaded plugins ---------------------------
#   Name                 Description
0   breakTime            Automatically disconnect and reconnect at certain time
1   cmdOnLogin           automatically do a command on login
2   eventMacro           allows usage of eventMacros
3   item_weight_recorder item_weight_recorder plugin
4   macro                allows usage of macros
5   map                  map
6   profiles             Profiles Selector
7   raiseSkill           automatically raise character skills
8   raiseStat            automatically raise character stats
9   reconnect            v1.0
10  xConf                commands for change items_control, mon_control, pickup
-------------------------------------------------------------------------------

All automacros disabled:

eventMacros.txt:

macro manyArrow {
    $i = 0
    while ($i < $.param[0]) {
        call buyFireArrows
        $i++
    }
}

macro buyFireArrows {
    $arrow = Fire Arrow
    $quiver = Fire Arrow Quiver

    do move alb2trea 85 65
    do talk &npc("Tool Dealer#alb") b
    do store
    $amount = &eval( int((($.maxweight * 0.75) - $.weight) / 0.2) )
    do buy &store($arrow) $amount

    do move payon_in01 5 130
    do talk &npc("Inventor Jaax")
    do talk resp 4
    do talk resp 0
    do talk resp 0

    do move gonryun
    do talk &npc("Kafra Employee")
    do talk resp 1
    do storage add &inventory($quiver)
    do storage close
}

Try to workaround issue using standpoint parameter in buyAuto block causes Kore to repeatedly route (and fail because talking to NPC) to standpoint coordinate:

[route] Calculating auto-buy route to: Gonryun, the Hermit Land (gonryun): 153, 113
[route] Stuck at gonryun (160,113), while walking from (160,113) to (153,113).
[console] Stuck during route.
[route] Calculating auto-buy route to: Gonryun, the Hermit Land (gonryun): 153, 113
[route] Stuck at gonryun (160,113), while walking from (160,113) to (153,113).
[console] Stuck during route.
[route] Calculating auto-buy route to: Gonryun, the Hermit Land (gonryun): 153, 113
[route] Stuck at gonryun (160,113), while walking from (160,113) to (153,113).
[console] Stuck during route.
Fruitard commented 1 year ago

------------------ Openkore Issues Template ------------------

  • Openkore version git: Using version with commit hash 2a61bebe6055165ef3476de1632105509b1eac59
  • Server: Private server
  • Bug Report / Feature Request: Sometimes Kore will attempt to route back to lockMap after an autobuy is triggered. If the the route back to the lockMap uses an NPC (e.g., Kafra, warper) and the vendor NPC can be interacted with without moving, then Kore will sometimes start interacting with the route NPC and then attempt to interact with the vendor NPC before it finishes the first sequence. When this happens, Kore gets stuck.
  • Summary:

Log:

[2023.03.10 20:36:33.78] [teleport] Teleporting due to idle
[2023.03.10 20:36:33.79] [teleport] You don't have the Teleport skill or a Fly Wing
[2023.03.10 20:36:34.19] [teleport] Auto-buy: Fly Wing
Teleporting to auto-buy
[2023.03.10 20:36:34.20] [useItem] You used Item: Butterfly Wing (1) x 1 - 3 left
[2023.03.10 20:36:34.21] [inventory] Inventory Item Removed: Butterfly Wing (1) x 1
[2023.03.10 20:36:34.21] [console] Permitted to use Teleport (26), level 3
[2023.03.10 20:36:34.24] [selfSkill] You are casting Teleport on yourself (Delay: 0ms)
[2023.03.10 20:36:34.25] [connection] Map Change: gonryun.gat (160, 113)
[2023.03.10 20:36:34.27] [effect] You use effect: 
[2023.03.10 20:36:34.27] [parseMsg_presence] NPC Exists: Chef Assistant#gon (147, 101) (ID 110001800) - (0)
[2023.03.10 20:36:34.27] [parseMsg_presence] NPC Exists: Weapon Dealer#gon (174, 101) (ID 110001689) - (1)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Crafting Materials#gon (152, 109) (ID 110013052) - (2)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Stylist#gef (170, 110) (ID 110013055) - (3)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Consumables#gon (152, 113) (ID 110013051) - (4)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Mailbox#gon (152, 117) (ID 110002369) - (5)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Kafra Employee (159, 122) (ID 110001556) - (6)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Warper#gon (162, 122) (ID 110013005) - (7)
[2023.03.10 20:36:34.28] [parseMsg_presence] NPC Exists: Job Master#gef (168, 120) (ID 110013054) - (8)
[2023.03.10 20:36:34.28] [npcchat] You're now in the '#map' channel for 'gonryun'
[2023.03.10 20:36:35.11] [route] Calculating lockMap route to: Prontera Field F11(prt_fild11)
[2023.03.10 20:36:38.33] [list] -------- Responses (Warper#gon) --------
#  Response
0  Last Warp [orcsdun01]
1   ~ Towns
2   ~ Dungeons
3  Cancel Chat
----------------------------------------
[2023.03.10 20:36:39.61] [list] -------- Responses (Warper#gon) --------
#  Response
0  Abyss Lakes
1  Amatsu Dungeon
2  Anthell
<trimmed>
35 Cancel Chat
----------------------------------------
[2023.03.10 20:36:40.68] [console] NPC requires a response to be selected, but the given instructions don't match that (current step: b).
[2023.03.10 20:36:40.69] [console] Using method '0' defined on config key 'npcWrongStepsMethod' to deal with the error.
[2023.03.10 20:36:40.70] [console] Cleaning all remaining conversation steps, please input more steps using commands.

Debugging log:

ai print
[list] ------------------ AI Sequence -------------------
0: NPC

1: buyAuto
{index=>'0',distance=>'2',sentNpcTalk=>'1',sentNpcTalk_time=>'1678509399.52696',lastIndex=>'0',index_failed=>{e
mpty},npc=>{ok=>'1',map=>'gonryun',pos=>{y=>'113',x=>'152'}}}

2: route

--------------------------------------------------
ai ai_v
[list]
{portalTrace_mapChanged=>'1678509394.24998',temp=>{ai_route_index=>'0',do_route=>'',ai_route_attackOnRoute=>'1'
,found=>'1'},AI_last_finished=>'1678512411.77872',npc_talk=>{talk=>'select',time=>'1678509405.06821'}}

At this point, Kore is stuck until relog is forced (with a plugin I wrote). I think in RouteMap and also whichever class is being used for autobuy (will look into it) and autostorage, we need to implement a lock for interacting with another NPC.

what server is this so we can take a better look into it