Loading...   

[Show Table of Contents]


  • For as long as I know, NPC to player interaction has involved players and quest saylinks to make it easy. But this can be not very entertaining and very bland to read sometimes.
  • This plugin will take a lot of the complexities out of making dialogue in general, make it beautiful and bring life to it
    • Allows syntax for animations such as +wave+
    • Allows syntax for simply colors such as light blue {lb}This is light blue~
    • Allows syntax for many different options listed below
    • Appends the NPC name to the window for dialogue
    • Can use 'Mysterious Voice' if you want to use it for narrator type approaches
    • You can set a popup window timer with =70= seconds
    • Easily add bullets {bullet} or indent {in} or linebreak {linebreak}
  • Some people might have thought that using popup windows for NPC interaction would be great, but the syntax is painful to use and it is hard to keep a window formatted nice. This plugin solves all of those issues and goes a step above...
  • This plugin can also be used as a drop in replacement for quest::say, see video below:


 

  • This is probably one of the best creations of mine and it took the least amount of time. This system is SUPER easy to use and you don't have to think about doing much when you are creating dialogue.
  • It is feature rich, and allows you to highlight keywords in a window and format it nicely rather than trying to remember a bunch of fancy codes.
  • It takes ALOT of work out of making dialogue stuff work. The below markup can be used anywhere in the first argument of the plugin, it is designed so that it parses the tags and actually formats the popup window accordingly.

§The Markup

  • {lb} = Light Blue Color
  • {y} = Yellow Color
  • {gold} = Gold Color
  • {g} = Green Color
  • {r} = Red Color
  • {gray} = Gray Color
  • ~ = End Color Tag ()
  • [> = Response Text (Not Visible) - This is what the player responds with, for example: [What else do we need to do?>
  • [] = Response Text (Visible) - If a NPC has multiple brackets, it will give the player multiple saylinks to click, if there is just one [bracket] inline with the text, the player will respond by clicking 'Yes' on the window
  • +66+ = Animation number - As long as there is a number between two plus signs together, the NPC will perform that animation
  • +Salute+ = Animation phrase - This references plugin:oAnim() - If the data between the two ++'s are a string, it will try to parse it with plugin:oAnim
  • {bullet} - Equivalent to a bullet such as the one in this list
  • {in} - Will indent the text
  • {linebreak} - Will create a linebreak
  • mysterious - If the text 'mysterious' is anywhere in the text, it will not show up in the player window, but it will format the window as 'Mysterious Voice tells you'
  • wintype:0/1 - If this is 1 the window will be Yes/No
  • popupid:ID - If this option is present, it will give the popup window and ID
  • noquotes - This tells the window to not use any quotes for special formatting at times
  • nosound - No sound affect will play with the window
  • =Timer= - If a number is specified between the two ==, it will countdown a timer on the popup window

§To Activate This Plugin

  • Place following code in global/global_player.pl
    • ​Note you need the plugin::DiaWind_Process_Response() if you want the ability to have players automatically respond with messages
sub EVENT_POPUPRESPONSE{
	#::: plugin::DiaWind response subroutine
	plugin::DiaWind_Process_Response();
}
#::: Author: Akkadius
#::: This plugin can work as an extensive drop in replacement for quest::say
#::: This plugin also offers extensive options for easily formatting windows. 
#::: Usage: plugin::DiaWind("Window text");
#::: For explanation of use, see: http://wiki.eqemulator.org/p?The_DiaWind_Plugin&frm=Perl_Plugins_Master_Reference

sub DiaWind { 
	my $Text = $_[0]; my $npc = plugin::val('$npc'); $client = plugin::val('$client'); $name = plugin::val('$name');
    my $Opt = 0;
	if(!$PopId){ $PopId = 999; } 
	$Text=~ s/~/<\/c>/g;
	$Text=~ s/\{y\}//g;
	$Text=~ s/\{lb\}//g;
	$Text=~ s/\{r}//g;
	$Text=~ s/\{g}//g;
	$Text=~ s/\{gold}//g;
	$Text=~ s/\{orange}//g;
	$Text=~ s/\{gray}//g;
	$Text=~ s/\{tan}//g;
	$Text=~ s/\{bullet}/•/g;
	$Text=~ s/\$name/$name/g;
	$Text=~ s/\{linebreak}/--------------------------------------------------------------------/g;
	$Text=~ s/\{rowpad}/{tdpad}<\/td>{tdpad}<\/td><\/tr>/g; 
	$Text=~ s/\{tdpad}/----------------------/g; 
	$Text=~ s/\{in}/        /g;
	my ($mvoice) = $Text =~ s/mysterious//g;
	my ($achievement) = $Text =~ s/achievement//g;
	my ($noquotes) = $Text =~ s/noquotes//g; if($noquotes){ $quo = ""; } else{ $quo = "'"; }
	my ($nobracket) = $Text =~ s/nobracket//g;
	my ($nosound) = $Text =~ s/nosound//g;
	my ($cname) = $Text =~ /{(.*)\>/; $Text =~ s/{$cname\>//g;
	if(!$nobracket){
		($bracket) = $Text =~ /\[([^\]]+)\].*/;
		($bracket2) = $Text =~ /\[(.*)\>/;
	}

	my ($anim) = $Text =~ /\+(.*)\+/; $Text=~ s/\+$anim\+//g;
	my ($Timer) = $Text =~ /\=(.*)\=/; $Text=~ s/\=$Timer\=//g;
	my $response = ""; my $ClickQueue = ""; my $Options = "";
	my @popupid = $Text =~ /popupid\:(\d+)/g;
	if($popupid[0]){ $PopId = $popupid[0]; my $string = "popupid:" . $popupid[0]; $Text=~ s/$string//g; }
	my @wintype = $Text =~ /wintype\:(\d+)/g;
	if($wintype[0]){ if($wintype[0] == 1){ $Opt = 1; }; my $string = "wintype:" . $wintype[0]; $Text=~ s/$string//g; }
	if(!$nobracket){
		if($bracket){ $response = $bracket; 	}
		if($bracket2){ $response = $bracket2; 	}
		@data = ($Text =~ m/\[([^\]]+)\]/g);
		foreach $val (@data){ $Options .= "" . quest::saylink($val, 1) . " - ";}
		if($data[1]){ $client->Message(15, " --- Select Response from Options --- "); $client->Message(0, "[" . substr ($Options, 0, -3) . "]"); }
	}
	if($anim){ if($anim > 0){ quest::doanim($anim); } else{ plugin::DoAnim($anim);} }
	my $string = quotemeta("[" . $bracket2 . ">"); $Text=~ s/$string//g;
	if($Timer > 0){ $ClickQueue = "This message will disappear in " . $Timer . " second(s)..."; }
	elsif($response ne ""){ $client->SetEntityVariable("npcresponse", $response); 
		if($Opt == 1){ $ClickQueue = "Click 'Yes' to continue'..."; }
		else{ $ClickQueue = "Click 'OK' to respond with '" . $response . "'..."; }
	}else{ $client->SetEntityVariable("npcresponse", ""); 
		if($Opt == 1){ $ClickQueue = "Click 'Yes' to continue'...";}
		else{ $ClickQueue = "Click 'OK' to continue..."; }
	}
	if($achievement){} elsif($cname){ $Speaking = $cname . " says"; } elsif($mvoice){ $Speaking = "A Mysterious Voice says"; } else{ if($npc){ $Speaking = $npc->GetCleanName() . ' says'; } }
	if($achievement){ $Title = "New Achievment!"; } else{ $Title = "Dialogue: " . $Speaking; }
	if($achievement){ $Timer = 5; quest::popup($Title,  $Text . "" . $ClickQueue . "", $PopId, $Opt, $Timer); }
	else{ quest::popup($Title,  "" . $Speaking . "

" . $quo . "" . $Text . "" . $quo . "" . "

" . $ClickQueue . "", $PopId, $Opt, $Timer); }
	$PopId = undef; $achievement = undef;
} 

sub DiaWind_Process_Response{
	my $popupid = plugin::val('$popupid');
	my $client = plugin::val('$client');
	if($popupid == 999){
		my $nresponse = $client->GetEntityVariable("npcresponse");
		if($Debug){ $client->Message(15, "Debug Silent Message: '" . $nresponse . "'"); }
		if($nresponse ne ""){ $client->SilentMessage($nresponse); } return;
	}
}

§Examples:

  The below example makes use of basic color highlighting, animations and responses.

 

 

sub EVENT_SAY{
	if($text=~/hail/i){
		plugin::DiaWind("Ahhh, yes, {gold}$name!~. {lb}Very good work~. You must be [very strong willed] my friend.+bowto+");
	} 
	elsif($text=~/very strong willed/i){
		plugin::DiaWind("Ahhh, yes, you see, there is much to be done and {lb}you've only begun~. 
		When you are proving yourself in these {y}halls~ I have been troubled to tell you 
		to keep in mind you need to see {gold}Falco~. Don't ask questions.[See Falco?>+nodyes+");
	}
	elsif($text=~/see falco/i){
		plugin::DiaWind("I just told you {y}$name~, there are no questions. 
		{y}Falco~ is a {lb}spirit that exists within this realm but only by fine threads~, he has the information that you need. 
		But you must be 'prepared' 

 Do you understand the words that are coming out of my mouth {y} $name~? [I am prepared> +nodyes+");
	}
	elsif($text=~/prepared/i){
		plugin::DiaWind("Yes, you must be prepared. I will give you what you need to know.+point+");
		quest::taskselector(158);
	}
	else{
		plugin::DiaWind("I'm sorry $name, but now is not your time +nodyes+");
	}
}
  Below is another example of colors, animations and responses

sub EVENT_SAY{
	if($text=~/hail/i){                
		plugin::DiaWind("Yawwnnn. Your name is {gold}$name~? Hrmm, I just can't {gold}remember anymore...~ {gray}I, I, I, ugh... what was it again...~ 
		Ah, yes strange one.  You wake me from my {lb}slumber~... wait what was it, {lb}who are you?~  I just want to {lb}remember~ [I can help you remember> +31+");
	}
	if($text=~/help you Remember/i){
		plugin::DiaWind("The dreams I {lb}used to have~, they were {y}wondeakkadiusrful~.  {lb}Dreams~ of {gold}mountains and skeletons~ and err... 
		fire I..I...{gray}I just don't remember~.  Have you ventured into the {gold}angels tower and slept in their wonderful beds~? 
		They are amazing but it has been ages since I was able to {lb}feel those beds~.  
		The {y}angels~ {r}banished me~ from the {lb} tower~ for my deeds, but alas, that is another {y}story~...
		Wait, I have a {y}wonderful idea~! {y}YES~!!! This idea is {lb}amazing~ and perhaps you would like to {lb}help~ me with it!!! [I will help you> +cheer+");
	}
	if($text=~/I will help/i){
		plugin::DiaWind("Yes... whoever you are, small being.  {lb}Sleep~ in each of those {lb}wonderful beds~ and fall into the dreams in which I try to remember.  
		Bring me back what you remember of the dreams and help {y}ME~ remember the days when I was able to sleep in those amazing beds, will yeh?  
		So what do you think?  {y}Are you willing to take on this~ {lb}task~? [I will take on this task for you> +shrug+");
	}
	if($text=~/I will take on this task/i){
		plugin::DiaWind("{y}Perfect~! Start now small one! I am going to try and sleep on this {gray}horrible bed~... +cheer+");
		quest::taskselector(190);
	}
}

 

  A simple use of Mysterious Voice on enter of an NPC Proximity, message disappears in 5 seconds with =5=
sub EVENT_ENTER{
         plugin::DiaWind("You can't help but observe that {y}Morell Thule~ is {r}shackled~ by some {g}magic spell~... 

 
			{gray}Has he lost his mind? He never roams the bottom floors of the castle...~


			{gray}Morell never comes down to the bottom of the castle...~ =5= mysterious");
}
  An example that uses HTML Tables, bullets and indents

This example is a link because this page will try to format that HTML table

http://wiki.eqemulator.org/index.php?Module=Pastebin&Paste=IiIMsMAm