Openkore.com

OpenKore Forums
It is currently 21 Aug 2018, 15:18

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [eventMacros] Help to talk to npc with looped dialogue
PostPosted: 12 Feb 2018, 23:33 
Offline
Noob
Noob

Joined: 06 Jun 2015, 09:44
Posts: 7
Firstly, I'm sorry for the wrong post in Git. I thought this forum wasn't active anymore and all moved to Git.

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:
Quote:
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
}
}


Hope you can help me with some coding ideas.
Thank you all for your time and help.


Top
 Profile  
 
 Post subject: Re: [eventMacros] Help to talk to npc with looped dialogue
PostPosted: 13 Feb 2018, 16:13 
Offline
Halfway to Eternity
Halfway to Eternity
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 370
Location: Genting Highland, Malaysia
Im no pro but since I've no idea what you really wanna do I can't give much of thought.

Btw, what you mean by efficient?
Does your macro have something wrong?

_________________

Wiki & Google are your best allies.
iRO server supporter.
Image


Top
 Profile  
 
 Post subject: Re: [eventMacros] Help to talk to npc with looped dialogue
PostPosted: 14 Feb 2018, 04:56 
Offline
Noob
Noob

Joined: 06 Jun 2015, 09:44
Posts: 7
fadreus wrote:
Im no pro but since I've no idea what you really wanna do I can't give much of thought.

Btw, what you mean by efficient?
Does your macro have something wrong?


Hello, thanks for your response.

Efficient by means of coding less and automate the response.
What I'm trying to get is to talk to npc with first sequence of response i.e. c r0 c c
thenafter, the npc would recognize the item still exist in my inventory and determined there are many to be turned it i.e. nth turn ins (could be hundreds)
thus kore through the help with this macro will response second sequence of instructions i.e. c c r0 c for nth times

What I'm trying to do is eliminate coding the 2nd instructions "c c r0 c" and repeat the code hundreds of times.


Top
 Profile  
 
 Post subject: Re: [eventMacros] Help to talk to npc with looped dialogue
PostPosted: 14 Feb 2018, 23:49 
Offline
Noob
Noob

Joined: 06 Jun 2015, 09:44
Posts: 7
I have managed to make it work with the use of autotalkcont in config.txt, only thing is it doesn't seem to run in auto.
I can get it to run by calling the macro on demand and it runs smoothly.
Can you please check my automacro conditions if there is something that's preventing it from running automatically?

Code:
automacro talk {
   CharCurrentWeight < 90%
   InInventory "item_name" > 1
   InventoryCurrentSize < 50
   StorageOpened 0
   IsInMapAndCoordinate map_name x y
   NpcNearDist /npc_name/ <= 5
   run-once 1
   exclusive 1
   priority 1
   call {
   $TalkNPC = x y

   do talknpc $TalkNPC
   pause 1.2
   do talk resp 2
   pause 0.5
   do talk resp 0
   log while looping commenced
   while (&invamount(item_name) > 1) {
      log loop has been read
      do talk resp 0
      log loop succeeded
   }
   pause 0.5
   log ending loop no item_name
   do talk resp 2
   

   log releasing talk!
   release $.caller
   }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group