[eventMacros] Help to talk to npc with looped dialogue

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Message
Author
noobie_21
Noob
Noob
Posts: 7
Joined: 06 Jun 2015, 09:44
Noob?: Yes

[eventMacros] Help to talk to npc with looped dialogue

#1 Post by noobie_21 »

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:
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.

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: [eventMacros] Help to talk to npc with looped dialogue

#2 Post by fadreus »

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?

iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

noobie_21
Noob
Noob
Posts: 7
Joined: 06 Jun 2015, 09:44
Noob?: Yes

Re: [eventMacros] Help to talk to npc with looped dialogue

#3 Post by noobie_21 »

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.

noobie_21
Noob
Noob
Posts: 7
Joined: 06 Jun 2015, 09:44
Noob?: Yes

Re: [eventMacros] Help to talk to npc with looped dialogue

#4 Post by noobie_21 »

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: Select all

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

Post Reply