DIFF for new and improved auto talk cont !

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
User avatar
lolzorbot
Noob
Noob
Posts: 18
Joined: 28 Apr 2010, 16:20
Noob?: No

DIFF for new and improved auto talk cont !

#1 Post by lolzorbot »

sorry for posting over here (cant post in the commit queue)

here is a patch for a new and improved auto talk cont
this patch will add a 1 second delay before it send the talk cont command (move delay to a config option?)

i have tested this on iro valkrie running through the entire novice land from front to back with autoTalkCont set to 1
and it worked flawlessly not disconnecting once !

Code: Select all

Index: Network/Receive/kRO/Sakexe_0.pm
===================================================================
--- Network/Receive/kRO/Sakexe_0.pm	(revision 7333)
+++ Network/Receive/kRO/Sakexe_0.pm	(working copy)
@@ -4354,10 +4354,10 @@
 	$ai_v{npc_talk}{time} = time;
 
 	if ($config{autoTalkCont}) {
-		message TF("%s: Auto-continuing talking\n", $name), "npc";
-		$messageSender->sendTalkContinue($ID);
+		#message TF("%s: Auto-continuing talking\n", $name), "npc";
+		#$messageSender->sendTalkContinue($ID);
 		# This time will be reset once the NPC responds
-		$ai_v{npc_talk}{time} = time + $timeout{'ai_npcTalk'}{'timeout'} + 5;
+		#$ai_v{npc_talk}{time} = time + $timeout{'ai_npcTalk'}{'timeout'} + 5;
 	} else {
 		message TF("%s: Type 'talk cont' to continue talking\n", $name), "npc";
 	}
Index: Network/Receive/ServerType0.pm
===================================================================
--- Network/Receive/ServerType0.pm	(revision 7333)
+++ Network/Receive/ServerType0.pm	(working copy)
@@ -4327,10 +4327,10 @@
 	$ai_v{npc_talk}{time} = time;
 
 	if ($config{autoTalkCont}) {
-		message TF("%s: Auto-continuing talking\n", $name), "npc";
-		$messageSender->sendTalkContinue($ID);
+		#message TF("%s: Auto-continuing talking\n", $name), "npc";
+		#$messageSender->sendTalkContinue($ID);
 		# This time will be reset once the NPC responds
-		$ai_v{npc_talk}{time} = time + $timeout{'ai_npcTalk'}{'timeout'} + 5;
+		#$ai_v{npc_talk}{time} = time + $timeout{'ai_npcTalk'}{'timeout'} + 5;
 	} else {
 		message TF("%s: Type 'talk cont' to continue talking\n", $name), "npc";
 	}
Index: Task/TalkNPC.pm
===================================================================
--- Task/TalkNPC.pm	(revision 7333)
+++ Task/TalkNPC.pm	(working copy)
@@ -95,6 +95,8 @@
 	$self->{time} = time;
 	$self->{stage} = 'Not Started';
 	$self->{mapChanged} = 0;
+	
+	$self->{talkContWaitDone} = 0;
 }
 
 # Overrided method.
@@ -170,7 +172,25 @@
 		my $step = $self->{steps}[0];
 		my $npcTalkType = $ai_v{npc_talk}{talk};
 
-		if ($step =~ /^w(\d+)/i) {
+		if ($config{autoTalkCont} && $npcTalkType eq 'next') {
+			if ($self->{talkContWaitDone} == 1) {
+				message TF("%s: NEW Auto-continuing talking\n", $self->{target}->name), "npc";
+				
+				$self->{talkContWaitDone} = 0;
+				$messageSender->sendTalkContinue($self->{ID});
+			} else {
+				message TF("%s: waiting 1 second before Auto-continuing talking\n", $self->{target}->name), "npc";
+								
+				# Wait x seconds
+				my $time = 1;
+				$ai_v{npc_talk}{time} = time + $time;
+				$self->{time} = time + $time;
+				$self->{talkContWaitDone} = 1;
+			}
+			
+			return;
+		}
+		elsif ($step =~ /^w(\d+)/i) {
 			# Wait x seconds.
 			my $time = $1;
 			$ai_v{npc_talk}{time} = time + $time;

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: DIFF for new and improved auto talk cont !

#2 Post by kLabMouse »

Very nice one.
At least another AI dependency in Networking removed.

Dev's. Please review and commit.
From my point, there is better to set sys.txt delay option for this kind of feature.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: DIFF for new and improved auto talk cont !

#3 Post by Technology »

Although this is definitely an improvement for automated setups, unfortunately it requires a TalkNPC task to be active.
So i think this wouldn't cover the case where the npc itself initiates a conversation with our character.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: DIFF for new and improved auto talk cont !

#4 Post by kLabMouse »

Technology wrote:Although this is definitely an improvement for automated setups, unfortunately it requires an TalkNPC task to be active.
MM? Is TalkNPC task Inactive in this situation? O_o

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: DIFF for new and improved auto talk cont !

#5 Post by Technology »

kLabMouse wrote:
Technology wrote:Although this is definitely an improvement for automated setups, unfortunately it requires an TalkNPC task to be active.
MM? Is TalkNPC task Inactive in this situation? O_o
I mean, it requires a TalkNPC task to be in the task manager.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: DIFF for new and improved auto talk cont !

#6 Post by kLabMouse »

Technology wrote:I mean, it requires a TalkNPC task to be in the task manager.
So it just need additional check for that task, and that's all.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: DIFF for new and improved auto talk cont !

#7 Post by EternalHarvest »

kLabMouse wrote:So it just need additional check for that task, and that's all.
And what will that task do in that case, when no talk sequence is provided? The same when user is only initializing talk with "talk %d".
kLabMouse wrote:sys.txt delay
What is timeouts.txt for then?

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: DIFF for new and improved auto talk cont !

#8 Post by kLabMouse »

EternalHarvest wrote:
kLabMouse wrote:So it just need additional check for that task, and that's all.
And what will that task do in that case, when no talk sequence is provided? The same when user is only initializing talk with "talk %d".
kLabMouse wrote:sys.txt delay
What is timeouts.txt for then?
OK. timeouts.txt is better. SRY.

well. I think the autoTalkCont must be handled only in Task itself.
the other situations... I donno.

User avatar
lolzorbot
Noob
Noob
Posts: 18
Joined: 28 Apr 2010, 16:20
Noob?: No

Re: DIFF for new and improved auto talk cont !

#9 Post by lolzorbot »

what about a talknpc task with a special manual talk parameter set?
and then a function for pushing the manual talk action into the talknpc task?

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: DIFF for new and improved auto talk cont !

#10 Post by Technology »

lolzorbot wrote:what about a talknpc task with a special manual talk parameter set?
and then a function for pushing the manual talk action into the talknpc task?
yea, that would be easy to do, if we don't already do this. But the case i described is still not handled.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Post Reply