This will be a cross-post. I'm still looking for help on having this code to work to talk toan NPC with continuing dialogue, loop count and response instruction is determined by the inventory item count in your character.
This was my post in Git:https://github.com/OpenKore/openkore/issues/1768
This is the mirrored post:
Hi guys! I would just like to know if it would be possible to code an efficient automacro with eventMacros?
What I'm hoping to to get is something like,
1. Automacro triggered in certain map
2. Kore will go near the npc at random cell to talk to it
3. Will evaluate an "inventory item"; pass its quantity with condition and get the result as count to loop that many times. (Sorry with this description, can't really elaborate efficiently with English)
Example:
do talknpc x y c c r0 c c
(npc determined you have this many item, will loop as determined how many was it)
do "send instructions this many with this variable" c c r0 n (can this be made into an array?)
Here is my code:
Hope you can help me with some coding ideas.automacro talk {
CharCurrentWeight < 90%
InInventory "item_name" > 2
InventoryCurrentSize < 50%
StorageOpened 0
IsInMapAndCoordinate map_name x y
run-once 1
call {
$tlk = c r0 c c $tlk1 ##this is the code that I want to be determined automatically by kore##
$tlk1 = c r0 c c c $tlk2
$tlk2 = c r0 c tlk3
$tlk3 = tlk2 ##my attempt to loop it to continue and just repeat the conversation instruction##
$TalkNPC = x y c c r2 c c $tlk
while (@invamount(item_name) > 2) as loop
do talknpc $TalkNPC
end loop
log releasing talk!
release $.caller
}
}
Thank you all for your time and help.