View Single Post
  #4  
Old 04-26-2011, 11:53 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

There were many problems, instead of pointing them all out, I rewrote the script. BTW, I'm not sure if the indents were lost on copy/paste or you just dont use them but until you can write a script without needing to debug it, you should keep things as orderly as possible(and if not for yourself, especially when asking others to look through your code).

Code:
sub EVENT_SPAWN {
	my $x = $npc->GetX();
	my $y = $npc->GetY();
	my $range = 70;
	quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range);
}

sub EVENT_ENTER
{
	if($ulevel == 1) {
		quest::movepc(152, -200, 36, -55, -125);
		$client->Message(15, "You have not become attuned yet. Speak with Gharj at the top of the platform.");
	}
	elsif($hasitem{1079} && $ulevel <= 10) {
		$npc->SendAppearanceEffect(180);
		quest::doanim(66);
		$client->Message(0, "Hey, you! $name! Come over here... You cannot use the portal without a [shard]! Come over here!");
	}
}

sub EVENT_SAY
{
	my @items = qw(9991 9992 9993 9994 1079 9996 9997 9998 9999 10000 10001 10002);
	my @links = qw(Freeport Qeynos Halas Erudin GreaterFaydark Felwithe Neriak Kaladim Grobb Oggok Rivervale Akanon);

	if($text=~/hail/i) {
		if($ulevel == 2) {
			quest::say("Greetings, $name! I am Thiddian and I have the [shards] necessary for you to travel back home. There are rifts throughout Norrath that only those whom have been attuned can see. Simply walk into one and you can return here.");
		}
		foreach $item(@items) {
			if($hasitem{$item}) {
				quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");
			}
		}
	}
	elsif($text=~/shard/i) {
		quest::doanim(55);
		quest::say("Ehhh.. ehm... The shards are what allow us to travel through these soul portals. The thing is, you can only have one. No one has ever stepped into the rift with two shards and I dont think we should try. Anyways, thats enough babbling from me... Please choose your land.");
		$client->Message(15, "Select only ONE of the following:");
		my $link_string = "";
		my $temp_link = "";
		foreach $link(@links) {
			$temp_link = quest::saylink("$link");
			$link_string = $link_string . $temp_link;
		}
		$client->Message(15, "$link_string");
	}
	else {
		my $counter = 0;
		foreach $link(@links) {
			if($text=~/$link/i) {
				quest::doanim(67);
				$npc->SendAppearanceEffect(180);
				quest::summonitem($items[$counter]);
			}
			$counter++;
		}
	}
}
Possibly the link loop won't work like that, havent tested it in a while and cant remember, however its pretty easy to modify it if it doesnt work as intended.
Reply With Quote