View Single Post
  #7  
Old 08-01-2013, 02:53 AM
Furniture
Hill Giant
 
Join Date: Aug 2012
Posts: 205
Default

My db is about 2-3 weeks old, updating is kind of a pain with my custom changes but I will update all my npc related tables soon and see if it works.


My script is the following:

Code:
# A_Timeless_Magus instance handler for plane of time b.

sub EVENT_SAY{
	my $instance = quest::saylink("instance",1);
	my $add = quest::saylink("add",1);
	my $send = quest::saylink("send",1);
	my $remove = quest::saylink("remove",1);
	my $fire = quest::saylink("fire",1);
	my $water = quest::saylink("water",1);
	my $undead = quest::saylink("undead",1);
	my $air = quest::saylink("air",1);
	my $earth = quest::saylink("earth",1);	

	
	$InstID = quest::GetInstanceID("potimeb",0);
	if ($text =~/Hail/i)
	{
		plugin::Whisper("I allow passage to the plane of time.  We must free Zebuxoruk.  I can start a new [$instance], [$send] you to an existing instance, [$add] you to an existing instance, or [$remove] you from your current instance.");
		return;
	}
	if($text =~/instance$/i)
	{
		CREATEINSTANCE();
		return;
	} 
	if($text =~/add$/i)
	{
		plugin::Whisper("Ask the leader of the instance you wish to join to give you the instance ID.  Tell me that ID and I will add you to their party.");
		return;
	} 
	if($text =~/send$/i)
	{
		plugin::Whisper("Which trial would you like to go to: [$fire], [$water], [$undead], [$air], or [$earth]?");
		return;
	} 
	if($text =~/remove$/i)
	{
		quest::DestroyInstance($InstID);
		plugin::Whisper("It is done.  You and your travelers are no longer in any instances.");
		return;
	} 
	if($text =~/fire$/i)
	{
		if($InstID)
		{ 
			quest::MovePCInstance(223,$InstID,-23.1,576.6,493.6); 
		} 
		else 
		{ 
			plugin::Whisper("You are not part of an instance."); 
		}
		return;
	}
	if($text =~/water$/i)
	{
		if($InstID)
		{ 
			quest::MovePCInstance(223,$InstID,-23.1,853,493.6); 
		} 
		else 
		{ 
			plugin::Whisper("You are not part of an instance."); 
		}
		return;
	}
	if($text =~/undead$/i)
	{
		if($InstID)
		{ 
			quest::MovePCInstance(223,$InstID,-23.1,1112,493.6); 
		}
		else 
		{ 
			plugin::Whisper("You are not part of an instance.");
		}
		return;
	} 
	if($text =~/air$/i)
	{
		if($InstID)
		{ 
			quest::MovePCInstance(223,$InstID,-23.1,1358,493.6); 
		} 
		else 
		{ 
			plugin::Whisper("You are not part of an instance.");
		}
		return;
	} 
	if($text =~/earth$/i)
	{
		if($InstID)
		{ 
			quest::MovePCInstance(223,$InstID,-23.1,1595,493.6); 
		}
		else 
		{ 
			plugin::Whisper("You are not part of an instance."); 
		}
		return;
	} 
	
	#check if response is a number if so attempt to assign that person to the specified instance.
	if($text=~/^[+-]?\d+$/) 
	{
		quest::AssignToInstance($text);
		plugin::Whisper("I have attempted to assign you to instance: $text.  If you gave me a bogus number shame on you.");
	} 
	else
		{
		plugin::Whisper("I allow passage to the plane of time.  We must free Zubuxoruk.  I can start a new [$Instance], [$Send] you to an existing instance, [$add] you to an existing instance, or [$Remove] you from your current instance.");
	}
}


sub CREATEINSTANCE 
{
	$running = quest::GetInstanceID("potimeb", 0);
	$raid = $client->GetRaid();
	
	if ($raid) 
	{
		if (defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone})) 
		{
			$client->Message(13, "You are not ready to start a new instance.  You may be locked out.");
		} 
		elsif ($running == 0 && !(defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone}))) 
		{
			$instance = quest::CreateInstance("potimeb", 0, 232000);
			plugin::Whisper("Your instance has been created. Your instance ID is: [$instance].  Keep track of this number as this is the number needed to add others to your instance later.");
			quest::AssignRaidToInstance($instance);
		}
	} 
	else 
	{
		$group = $client->GetGroup();
		if($group){
			if (defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone}))  {
				$client->Message(13, "You are not ready to start a new instance.  You may be locked out.");
			} 
			elsif ($running == 0 && !(defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone}))) 
			{
				$instance = quest::CreateInstance("potimeb", 0, 232000);
				plugin::Whisper("Your instance has been created. Your instance ID is: [$instance].  Keep track of this number as this is the number needed to add others to your instance later.");
				quest::AssignGroupToInstance($instance);
			}
		} else {
			if (defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone}))  {
				$client->Message(13, "You are not ready to start a new instance.  You may be locked out.");
			} 
			elsif ($running == 0 && !(defined($qglobals{potimeLockout}) || defined($qglobals{potime_canzone}))) 
			{
				$instance = quest::CreateInstance("potimeb", 0, 232000);
				plugin::Whisper("You are very brave to journey to time alone.  Your instance has been created. Your instance ID is: [$instance].  Keep track of this number as this is the number needed to add others to your instance later.");
				quest::AssignToInstance($instance);
			}
		}
	}
}


Also since the scripts arent finished yet for lua, does that mean I should just be using the .pl's anyway?
Reply With Quote