PDA

View Full Version : weird bug


kimura
10-25-2013, 10:36 AM
ok, two different Npcs...two different quests...

npc1 (aa merchant npc) has a quest with an itemlink in it

npc2 (buffer npc) has a say link that when I click on the say link, it brings up the pop up window for the item in npc1's quest...

not sure how they are linking together...the saylink and itemlink triggers are completely different...

they each have different names and npcids and their own pl file...

*shrug*

joligario
10-25-2013, 12:41 PM
Perhaps you have something declared globally. I'd post the code.

kimura
10-25-2013, 01:01 PM
NPC2


sub EVENT_SAY {

my $cure = quest::saylink ("cure", 1);
my $heal = quest::saylink ("heal", 1);
my $bind = quest::saylink ("bind", 1);
my $advanced = quest::saylink ("Advanced blessing");
my $Kimura = quest::saylink ("Kimura's Super Buff");

if ($text =~/Hail/i)
{ quest::say("Greetings $name. I have been sent to aid you on your journey! Would you like a [$cure], [$heal], [$advanced], [$Kimura] or I can [$bind] you to this location."); }
if ($text=~/cure/i) { quest::selfcast(3299); }
if ($text=~/heal/i) { quest::selfcast(13); }
if ($text=~/bind/i) { quest::selfcast(35); }

if ($text =~/advanced/i)
{
quest::say ("I charge 200pp for Advanced buffs.");
}

if ($text =~/Kimura/i)
{
quest::say ("I charge 20000pp for a buff so AWESOME!");
}
}

sub EVENT_ITEM
{

if($platinum == 20000)
{
quest::say ("Get ready for a breath from Kimura!");
quest::selfcast(6817);
}

if($platinum == 200)
{
quest::say ("Good, stand where you are while I cast");
quest::selfcast(18248);
quest::selfcast(5358);
quest::selfcast(3178);
quest::selfcast(1568);
quest::selfcast(2524);
}
}



NPC1



sub EVENT_SAY
{
# ItemID -> Cost -> Say text to match -> Slot type
# Slot type //1 = Alternate Currency // 2 = Epic Pieces // 3 = Platinum
%IL = (
1 => [40903, 2, "Radiant Crystal", 1],
2 => [50830, 2, "Shard of Living Crystal", 1],
3 => [40902, 2, "Ebon Crystal", 1],
4 => [500015, 5, "Dracus 5k Coin", 3],
5 => [500016, 10, "Dracus 10k Coin", 3],
6 => [500017, 50, "Dracus 50k Coin", 3],
7 => [500018, 100, "Dracus 100k Coin", 3],
8 => [1264, 200, "Mark of Saryn", 2],
9 => [1266, 200, "Mark of Bertoxxulous", 2],
10 => [1267, 200, "Mark of Aerin Dar", 2],
11 => [1118, 200, "Mark of Earth", 2],
12 => [1319, 200, "Mark of Water", 2],
13 => [1323, 200, "Mark of Fire", 2],
14 => [1352, 200, "Mark of Air", 2],
15 => [1096, 200, "Mark of Grummus", 2],
16 => [1374, 200, "Mark of Terris Thule", 2],
17 => [1270, 200, "Mark of Mithaniel Marr", 2],
18 => [1119, 200, "Mark of Rallos Zek", 2],
19 => [1261, 200, "Mark of Solusek Ro", 2],
20 => [1079, 200, "Mark of Agnarr the Storm Lord", 2],
21 => [31842, 200, "Mark of Execution", 2],
22 => [1377, 200, "Manaetic Behemoth Schematic", 2],
23 => [1375, 200, "Askr's Gratitude", 2],


);
my $empty = $client->GetItemIDAt(30); #Check cursor for an itemID will be HUGE number if INVALID or no item
my $total = $client->GetAAPoints();
my $epic = quest::saylink("Epic Pieces",1);
my $alternate = quest::saylink("Alternate Currency",1);
my $platinum = quest::saylink("Platinum",1);
my $n = 1;

if($text=~/Hail/i)
{
#$itemsid = undef;
#$itemcost = undef;
plugin::Whisper("Hi there $name do you want to browse my items?");
$client->Message(315, "[$alternate] || [$epic] || [$platinum]");
}

if($text=~/^alternate currency$/i)
{
$client->Message(315, "==== Alternate Currency ===");
while ($IL{$n}[0])
{
my $typeslot = $IL{$n}[3];
if($typeslot==1)
{
my $itemlink = quest::varlink($IL{$n}[0]);
my $saylink = quest::saylink($IL{$n}[2],1,"Buy");
my $cost = int($IL{$n}[1]);
$client->Message(315, "$saylink >for $cost AA points > $itemlink");
$client->Message(315, "----------------");
}
$n++;
}
$client->Message(315, "=============");
}


if($text=~/^Epic Pieces$/i)
{
$client->Message(315, "==== Epic Pieces ===");
while ($IL{$n}[0])
{
my $typeslot = $IL{$n}[3];
if($typeslot==2)
{
my $itemlink = quest::varlink($IL{$n}[0]);
my $saylink = quest::saylink($IL{$n}[2],1,"Buy");
my $cost = int($IL{$n}[1]);
$client->Message(315, "$saylink >for $cost AA points > $itemlink");
$client->Message(315, "----------------");
}
$n++;
}
$client->Message(315, "=============");
}


if($text=~/^platinum$/i)
{
$client->Message(315, "=== Platinum ===");
while ($IL{$n}[0])
{
my $typeslot = $IL{$n}[3];
if($typeslot==3)
{
my $itemlink = quest::varlink($IL{$n}[0]);
my $saylink = quest::saylink($IL{$n}[2],1,"Buy");
my $cost = int($IL{$n}[1]);
$client->Message(315, "$saylink >for $cost AA points > $itemlink");
$client->Message(315, "----------------");
}
$n++;
}
$client->Message(315, "=============");
}

######## Item Saylink Start
if ($text !~ /^Hail/)
{
while ($IL{$n}[0])
{

my $matchtxt = $IL{$n}[2];
my $cost = int($IL{$n}[1]);
my $createitem = $IL{$n}[0];
my $itemlink = quest::varlink($IL{$n}[0]);
if($text=~/$matchtxt/i)
{
if($empty > 400000) #Checks the cursor itemID to see if its valid returns a huge number for invalid
{
if($total >= $cost) #Cost of the item
{
$total = int($total-$cost);
$client->SetAAPoints($total);
plugin::Whisper("You made a wise choice.");
#Itemname
quest::summonitem($createitem,1);
$client->Message(315, "You now have $total AA points to spend.");
}
else
{
plugin::Whisper("You need more AA points for $itemlink."); #Player did not have enough AA
}
}
else
{
plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
}
}
$n++
}
}
######## Item Saylink END




}

Advanced Blessing from NPC2 brings up a window for dracus 5k coin from NPC1 when link is clicked, even if NPC2 isn't even targeted or in range...

Kimura's Super Buff from NPC2 brings up a window for dracus 10k coin from NPC1 when link is clicked, even if NPC2 isn't even targeted or in range...