View Full Version : Possibly a few questions.
Kingmen30264
02-10-2013, 08:00 PM
I am in the middle of working on a quest, but the only thing that I cannot seem to get working are the skills section. Everything else is working just fine. (I tested each piece as I was writing it to insure it's working state.)
Here is what I have so far:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $skills = quest::saylink("skills");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can train you in your $skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
quest::setallskill(250);
}
plugin::return_items(\%itemcount);
}
As I said, above, the only thing that is not working is the skills command.
Does the command no longer work, or am I simply using it in the wrong manner?
I followed the usage from here (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestCheatSheet).
Also, I was wondering about something else. On the plugin::check_handin*** I have it set right now as:
if(plugin::check_handin(\%itemcount, 9989 => 1))
If I wanted to add more items for the NPC to take, could I just modify it as follows?
if(plugin::check_handin(\%itemcount, 9989 => 1, 9990 => 1))
Or would I have to add another line to make it work? And what is the max amount of items that I can have the NPC take?
Thanks,
Kingmen
c0ncrete
02-10-2013, 09:58 PM
have you tried a number other than 250 to see if that works?
i've never used quest::setallskill() as i'm not a fan of setting all skills to the same number, especially if the character isn't supposed to be able to use a certain skill or have it go over a certain level due to race or class limitations.
you can use something like this to limit skills by race, class, and level:
foreach my $skill ( 0 .. 74 ) {
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
you can change $ulevel to the maximum level attainable on your server and it will just limit skills by the character's race and class.
yes, that's the correct way to use check_handin()
sorvani
02-10-2013, 10:41 PM
someone needs to export the routine used by #maxskills that one is useful.
the max is 4 as prior to RoF the system was never designed for stacked items to be turned in.
c0ncrete
02-10-2013, 11:08 PM
yeah, limiting spell casting specializations to 50 is a good idea. i hadn't considered that.
Kingmen30264
02-11-2013, 01:59 AM
Thanks.
I am in the middle of working on repopulating a zone (corathus) with some custom mobs/content, but one of the things that I am having issues with is when I create the NPC, and I try to set the race to one of the ones that was currently being used, the mobs stay a human. However, I can use #race # to make them look like the race that I want, and I am not sure how to set up a perl file to allow me to make them cast it on themselves when spawned.
Thanks,
Kingmen
c0ncrete
02-11-2013, 02:07 AM
if you can set the correct race via in-game command, i'd recommend looking at the related entries for that npc your database instead of putting a perl band-aid on the issue.
Kingmen30264
02-11-2013, 02:32 AM
if you can set the correct race via in-game command, i'd recommend looking at the related entries for that npc your database instead of putting a perl band-aid on the issue.
Yeah, I was trying to do that from the beginning.... Unfortunately, I was messing with the NPC_TYPES table, and I just ended up duplicating the npc row that I wanted and I am going to just use the #dbspawn command for pre-made characters that I know work in the zone(s) that I am populating.
Thanks for all your help though, it is greatly appreciated, and you have been really helpful and quick to respond to me c0ncrete.
Thanks.
c0ncrete
02-11-2013, 03:43 AM
this should take care of spell casting specialization skills correctly.
i haven't tested it yet, but the syntax is correct and the logic looks sound.
use List::Util qw(first);
# shorthand aliases for the client methods we'll be using
$CanSkill = sub { $client->CanHaveSkill(shift) };
$MaxSkill = sub { $client->MaxSkill( shift, $class, $ulevel ) };
$RawSkill = sub { $client->GetRawSkill(shift) };
$SetSkill = sub { $client->SetSkill( shift, shift ) };
# set all available skills to max value for client's current level
# NOTE: spell-casting specialization skills are handled later
foreach my $skillNum ( 0 .. 42, 48 .. 74 ) {
next unless $CanSkill->($skillNum);
$SetSkill->( $skillNum, $MaxSkill->($skillNum) );
}
# if client is a caster and can specialize
if ( $CanSkill->(43) ) {
# get current raw value for all spell-casting spec skills
my %spec = map { $_ => $RawSkill->($_) } ( 43 .. 47 );
# if one spell-casting spec skill is above 50 (main spec for caster),
# set it to the max value for the client's current level
# (this skill is deleted from hash and doesn't get calculated again)
if ( my $mainSpec = first { $spec{$_} > 50 } keys %spec ) {
$SetSkill->( $mainSpec, $MaxSkill->($mainSpec) );
delete $spec{$mainSpec};
}
# set spell-casting spec skills to max value for client's current level
# all skill levels but the first one that goes over 50 are capped at 50
foreach my $skillNum ( keys %spec ) {
next if $spec{$skillNum} == 50;
my $maxVal = $MaxSkill->($skillNum);
$SetSkill->( $skillNum, $maxVal > 50 ? 50 : $maxVal );
}
}
NOTE: oops... i forgot to include the List::Util module in my copy/paste. corrected.
lerxst2112
02-11-2013, 04:46 AM
I don't know if the emulator supports all the same features as live as far as specialization goes, but there is an AA to allow a second specialization that caps a bit higher, and the specialization caps rise as you level.
So, as an example the caps for first, second, and the rest are 256, 155, 105 at level 81.
c0ncrete
02-11-2013, 01:39 PM
challenge accepted!
Kingmen30264
02-12-2013, 10:13 PM
have you tried a number other than 250 to see if that works?
i've never used quest::setallskill() as i'm not a fan of setting all skills to the same number, especially if the character isn't supposed to be able to use a certain skill or have it go over a certain level due to race or class limitations.
you can use something like this to limit skills by race, class, and level:
foreach my $skill ( 0 .. 74 ) {
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
you can change $ulevel to the maximum level attainable on your server and it will just limit skills by the character's race and class.
yes, that's the correct way to use check_handin()
I tried to get this to work, but I just can't do it. I am not sure if this is meant to be put in the player.pl file, or if it was meant for the trainer.
What I am really wanting to do is make it a quest in the end. For the lower levels, you can just hail him, and he will set your skills to around 50 or so to start off with. Later, if you want, then you can do a quest and make them max level.
I don't really care if the person is using skills not normally aquired by that class, but I am just wanting it to where thier skills can be maxed outside of skilling it up, like Meditate, or Specializations or something of that caliber.
Here is my quest file so far. The only thing missing from it is where I would appoint skills.
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = (0 .. 74);
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
#Insert Skill Command Here <--
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
#Insert Skill Command Here <--
}
plugin::return_items(\%itemcount);
}
Hopefully I can get something working. I am going to try and put it in the player.pl file for the zone and see if once zoning into the zone if it doesn't just make it what I want.
As I said, I was really hoping to do a quest to max out all the skills later without having to write out each skill code.
Example
$client->SetSkill(#,#);
$client->SetSkill(#,#);
Thanks,
Kingmen
c0ncrete
02-12-2013, 10:25 PM
commented, to hopefully help you sort out exactly what it is you want to remove/change.
# do this for skill number 0 through 74
foreach my $skill ( 0 .. 74 ) {
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# get the maximum skll level for current skill number, based on client's class and level
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() );
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
Kingmen30264
02-13-2013, 12:23 AM
commented, to hopefully help you sort out exactly what it is you want to remove/change.
# do this for skill number 0 through 74
foreach my $skill ( 0 .. 74 ) {
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# get the maximum skll level for current skill number, based on client's class and level
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() );
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
Please forgive my ignorance, or whatever it is that I seem to be having with this. I followed your comments, and I am still unable to get this working through a few variations.
Here is the modified script:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = $client->GetSkill(0);
my $skill = $client->GetSkill(1);
my $skill = $client->GetSkill(2);
my $skill = $client->GetSkill(3);
my $skill = $client->GetSkill(4);
my $skill = $client->GetSkill(5);
my $skill = $client->GetSkill(6);
my $skill = $client->GetSkill(7);
my $skill = $client->GetSkill(8);
my $skill = $client->GetSkill(9);
my $skill = $client->GetSkill(10);
my $skill = $client->GetSkill(11);
my $skill = $client->GetSkill(12);
my $skill = $client->GetSkill(13);
my $skill = $client->GetSkill(14);
my $skill = $client->GetSkill(15);
my $skill = $client->GetSkill(16);
my $skill = $client->GetSkill(17);
my $skill = $client->GetSkill(18);
my $skill = $client->GetSkill(19);
my $skill = $client->GetSkill(20);
my $skill = $client->GetSkill(21);
my $skill = $client->GetSkill(22);
my $skill = $client->GetSkill(23);
my $skill = $client->GetSkill(24);
my $skill = $client->GetSkill(25);
my $skill = $client->GetSkill(26);
my $skill = $client->GetSkill(27);
my $skill = $client->GetSkill(28);
my $skill = $client->GetSkill(29);
my $skill = $client->GetSkill(30);
my $skill = $client->GetSkill(31);
my $skill = $client->GetSkill(32);
my $skill = $client->GetSkill(33);
my $skill = $client->GetSkill(34);
my $skill = $client->GetSkill(35);
my $skill = $client->GetSkill(36);
my $skill = $client->GetSkill(37);
my $skill = $client->GetSkill(38);
my $skill = $client->GetSkill(39);
my $skill = $client->GetSkill(40);
my $skill = $client->GetSkill(41);
my $skill = $client->GetSkill(42);
my $skill = $client->GetSkill(43);
my $skill = $client->GetSkill(44);
my $skill = $client->GetSkill(45);
my $skill = $client->GetSkill(46);
my $skill = $client->GetSkill(47);
my $skill = $client->GetSkill(48);
my $skill = $client->GetSkill(49);
my $skill = $client->GetSkill(50);
my $skill = $client->GetSkill(51);
my $skill = $client->GetSkill(52);
my $skill = $client->GetSkill(53);
my $skill = $client->GetSkill(54);
my $skill = $client->GetSkill(55);
my $skill = $client->GetSkill(56);
my $skill = $client->GetSkill(57);
my $skill = $client->GetSkill(58);
my $skill = $client->GetSkill(59);
my $skill = $client->GetSkill(60);
my $skill = $client->GetSkill(61);
my $skill = $client->GetSkill(62);
my $skill = $client->GetSkill(63);
my $skill = $client->GetSkill(64);
my $skill = $client->GetSkill(65);
my $skill = $client->GetSkill(66);
my $skill = $client->GetSkill(67);
my $skill = $client->GetSkill(68);
my $skill = $client->GetSkill(69);
my $skill = $client->GetSkill(70);
my $skill = $client->GetSkill(71);
my $skill = $client->GetSkill(72);
my $skill = $client->GetSkill(73);
my $skill = $client->GetSkill(74);
my $skill = $client->GetSkill(75);
my $skill = $client->GetSkill(76);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
$npc->SetSkillAll(400, $client);
}
plugin::return_items(\%itemcount);
}
If I do just my $skill(#); then the NPC will not talk to me in the least. So I tried to find a parameter that WOULD work, but I am using the wrong one?
If I leave the $max = $client-> .... where you have it in the original, NPC still will not talk to me.
I don't know what I am doing wrong to be honest.
Sorry for the annoyance with this, I truly am trying to learn this the best that I can. I can do everything else just fine, spawn mobs, create tasks, etc, etc... but it just seems that any of the skill commands I get from here (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects) just either don't work, or don't wanna work. Which I am not sure.
Thanks,
Kingmen
===EDIT===
I have found a temporary work around for the skill trainer, but I am going to mess with it some more until I find a more workable command/script for it.
Here is what I have:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = quest::addskill(0, $ulevel = 20);
my $skill = quest::addskill(1, $ulevel = 20);
my $skill = quest::addskill(2, $ulevel = 20);
my $skill = quest::addskill(3, $ulevel = 20);
my $skill = quest::addskill(4, $ulevel = 20);
my $skill = quest::addskill(5, $ulevel = 20);
my $skill = quest::addskill(6, $ulevel = 20);
my $skill = quest::addskill(7, $ulevel = 20);
my $skill = quest::addskill(8, $ulevel = 20);
my $skill = quest::addskill(9, $ulevel = 20);
my $skill = quest::addskill(10, $ulevel = 20);
my $skill = quest::addskill(11, $ulevel = 20);
my $skill = quest::addskill(12, $ulevel = 20);
my $skill = quest::addskill(13, $ulevel = 20);
my $skill = quest::addskill(14, $ulevel = 20);
my $skill = quest::addskill(15, $ulevel = 20);
my $skill = quest::addskill(16, $ulevel = 20);
my $skill = quest::addskill(17, $ulevel = 20);
my $skill = quest::addskill(18, $ulevel = 20);
my $skill = quest::addskill(19, $ulevel = 20);
my $skill = quest::addskill(20, $ulevel = 20);
my $skill = quest::addskill(21, $ulevel = 20);
my $skill = quest::addskill(22, $ulevel = 20);
my $skill = quest::addskill(23, $ulevel = 20);
my $skill = quest::addskill(24, $ulevel = 20);
my $skill = quest::addskill(25, $ulevel = 20);
my $skill = quest::addskill(26, $ulevel = 20);
my $skill = quest::addskill(27, $ulevel = 20);
my $skill = quest::addskill(28, $ulevel = 20);
my $skill = quest::addskill(29, $ulevel = 20);
my $skill = quest::addskill(30, $ulevel = 20);
my $skill = quest::addskill(31, $ulevel = 20);
my $skill = quest::addskill(32, $ulevel = 20);
my $skill = quest::addskill(33, $ulevel = 20);
my $skill = quest::addskill(34, $ulevel = 20);
my $skill = quest::addskill(35, $ulevel = 20);
my $skill = quest::addskill(36, $ulevel = 20);
my $skill = quest::addskill(37, $ulevel = 20);
my $skill = quest::addskill(38, $ulevel = 20);
my $skill = quest::addskill(39, $ulevel = 20);
my $skill = quest::addskill(40, $ulevel = 20);
my $skill = quest::addskill(41, $ulevel = 20);
my $skill = quest::addskill(42, $ulevel = 20);
my $skill = quest::addskill(43, $ulevel = 20);
my $skill = quest::addskill(44, $ulevel = 20);
my $skill = quest::addskill(45, $ulevel = 20);
my $skill = quest::addskill(46, $ulevel = 20);
my $skill = quest::addskill(47, $ulevel = 20);
my $skill = quest::addskill(48, $ulevel = 20);
my $skill = quest::addskill(49, $ulevel = 20);
my $skill = quest::addskill(50, $ulevel = 20);
my $skill = quest::addskill(51, $ulevel = 20);
my $skill = quest::addskill(52, $ulevel = 20);
my $skill = quest::addskill(53, $ulevel = 20);
my $skill = quest::addskill(54, $ulevel = 20);
my $skill = quest::addskill(55, $ulevel = 20);
my $skill = quest::addskill(56, $ulevel = 20);
my $skill = quest::addskill(57, $ulevel = 20);
my $skill = quest::addskill(58, $ulevel = 20);
my $skill = quest::addskill(59, $ulevel = 20);
my $skill = quest::addskill(60, $ulevel = 20);
my $skill = quest::addskill(61, $ulevel = 20);
my $skill = quest::addskill(62, $ulevel = 20);
my $skill = quest::addskill(63, $ulevel = 20);
my $skill = quest::addskill(64, $ulevel = 20);
my $skill = quest::addskill(65, $ulevel = 20);
my $skill = quest::addskill(66, $ulevel = 20);
my $skill = quest::addskill(67, $ulevel = 20);
my $skill = quest::addskill(68, $ulevel = 20);
my $skill = quest::addskill(69, $ulevel = 20);
my $skill = quest::addskill(70, $ulevel = 20);
my $skill = quest::addskill(71, $ulevel = 20);
my $skill = quest::addskill(72, $ulevel = 20);
my $skill = quest::addskill(73, $ulevel = 20);
my $skill = quest::addskill(74, $ulevel = 20);
my $skill = quest::addskill(75, $ulevel = 20);
my $skill = quest::addskill(76, $ulevel = 20);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
$npc->SetSkillAll(400, $client);
}
plugin::return_items(\%itemcount);
}
===EDIT 2===
After messing with it some more, here is what I have come up with so far that will work for what I am trying to do... It is VERY sloppy, but I am hoping that I can alter this through Hashes?
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
my $skill = quest::addskill(0, $ulevel = 100);
my $skill = quest::addskill(1, $ulevel = 100);
my $skill = quest::addskill(2, $ulevel = 100);
my $skill = quest::addskill(3, $ulevel = 100);
my $skill = quest::addskill(4, $ulevel = 100);
my $skill = quest::addskill(5, $ulevel = 100);
my $skill = quest::addskill(6, $ulevel = 100);
my $skill = quest::addskill(7, $ulevel = 100);
my $skill = quest::addskill(8, $ulevel = 100);
my $skill = quest::addskill(9, $ulevel = 100);
my $skill = quest::addskill(10, $ulevel = 100);
my $skill = quest::addskill(11, $ulevel = 100);
my $skill = quest::addskill(12, $ulevel = 100);
my $skill = quest::addskill(13, $ulevel = 100);
my $skill = quest::addskill(14, $ulevel = 100);
my $skill = quest::addskill(15, $ulevel = 100);
my $skill = quest::addskill(16, $ulevel = 100);
my $skill = quest::addskill(17, $ulevel = 100);
my $skill = quest::addskill(18, $ulevel = 100);
my $skill = quest::addskill(19, $ulevel = 100);
my $skill = quest::addskill(20, $ulevel = 100);
my $skill = quest::addskill(21, $ulevel = 100);
my $skill = quest::addskill(22, $ulevel = 100);
my $skill = quest::addskill(23, $ulevel = 100);
my $skill = quest::addskill(24, $ulevel = 100);
my $skill = quest::addskill(25, $ulevel = 100);
my $skill = quest::addskill(26, $ulevel = 100);
my $skill = quest::addskill(27, $ulevel = 100);
my $skill = quest::addskill(28, $ulevel = 100);
my $skill = quest::addskill(29, $ulevel = 100);
my $skill = quest::addskill(30, $ulevel = 100);
my $skill = quest::addskill(31, $ulevel = 100);
my $skill = quest::addskill(32, $ulevel = 100);
my $skill = quest::addskill(33, $ulevel = 100);
my $skill = quest::addskill(34, $ulevel = 100);
my $skill = quest::addskill(35, $ulevel = 100);
my $skill = quest::addskill(36, $ulevel = 100);
my $skill = quest::addskill(37, $ulevel = 100);
my $skill = quest::addskill(38, $ulevel = 100);
my $skill = quest::addskill(39, $ulevel = 100);
my $skill = quest::addskill(40, $ulevel = 100);
my $skill = quest::addskill(41, $ulevel = 100);
my $skill = quest::addskill(42, $ulevel = 100);
my $skill = quest::addskill(43, $ulevel = 100);
my $skill = quest::addskill(44, $ulevel = 100);
my $skill = quest::addskill(45, $ulevel = 100);
my $skill = quest::addskill(46, $ulevel = 100);
my $skill = quest::addskill(47, $ulevel = 100);
my $skill = quest::addskill(48, $ulevel = 100);
my $skill = quest::addskill(49, $ulevel = 100);
my $skill = quest::addskill(50, $ulevel = 100);
my $skill = quest::addskill(51, $ulevel = 100);
my $skill = quest::addskill(52, $ulevel = 100);
my $skill = quest::addskill(53, $ulevel = 100);
my $skill = quest::addskill(54, $ulevel = 100);
my $skill = quest::addskill(55, $ulevel = 100);
my $skill = quest::addskill(56, $ulevel = 100);
my $skill = quest::addskill(57, $ulevel = 100);
my $skill = quest::addskill(58, $ulevel = 100);
my $skill = quest::addskill(59, $ulevel = 100);
my $skill = quest::addskill(60, $ulevel = 100);
my $skill = quest::addskill(61, $ulevel = 100);
my $skill = quest::addskill(62, $ulevel = 100);
my $skill = quest::addskill(63, $ulevel = 100);
my $skill = quest::addskill(64, $ulevel = 100);
my $skill = quest::addskill(65, $ulevel = 100);
my $skill = quest::addskill(66, $ulevel = 100);
my $skill = quest::addskill(67, $ulevel = 100);
my $skill = quest::addskill(68, $ulevel = 100);
my $skill = quest::addskill(69, $ulevel = 100);
my $skill = quest::addskill(70, $ulevel = 100);
my $skill = quest::addskill(71, $ulevel = 100);
my $skill = quest::addskill(72, $ulevel = 100);
my $skill = quest::addskill(73, $ulevel = 100);
my $skill = quest::addskill(74, $ulevel = 100);
my $skill = quest::addskill(75, $ulevel = 100);
my $skill = quest::addskill(76, $ulevel = 100);
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
my $skill = quest::addskill(0, $ulevel = 1000);
my $skill = quest::addskill(1, $ulevel = 1000);
my $skill = quest::addskill(2, $ulevel = 1000);
my $skill = quest::addskill(3, $ulevel = 1000);
my $skill = quest::addskill(4, $ulevel = 1000);
my $skill = quest::addskill(5, $ulevel = 1000);
my $skill = quest::addskill(6, $ulevel = 1000);
my $skill = quest::addskill(7, $ulevel = 1000);
my $skill = quest::addskill(8, $ulevel = 1000);
my $skill = quest::addskill(9, $ulevel = 1000);
my $skill = quest::addskill(10, $ulevel = 1000);
my $skill = quest::addskill(11, $ulevel = 1000);
my $skill = quest::addskill(12, $ulevel = 1000);
my $skill = quest::addskill(13, $ulevel = 1000);
my $skill = quest::addskill(14, $ulevel = 1000);
my $skill = quest::addskill(15, $ulevel = 1000);
my $skill = quest::addskill(16, $ulevel = 1000);
my $skill = quest::addskill(17, $ulevel = 1000);
my $skill = quest::addskill(18, $ulevel = 1000);
my $skill = quest::addskill(19, $ulevel = 1000);
my $skill = quest::addskill(20, $ulevel = 1000);
my $skill = quest::addskill(21, $ulevel = 1000);
my $skill = quest::addskill(22, $ulevel = 1000);
my $skill = quest::addskill(23, $ulevel = 1000);
my $skill = quest::addskill(24, $ulevel = 1000);
my $skill = quest::addskill(25, $ulevel = 1000);
my $skill = quest::addskill(26, $ulevel = 1000);
my $skill = quest::addskill(27, $ulevel = 1000);
my $skill = quest::addskill(28, $ulevel = 1000);
my $skill = quest::addskill(29, $ulevel = 1000);
my $skill = quest::addskill(30, $ulevel = 1000);
my $skill = quest::addskill(31, $ulevel = 1000);
my $skill = quest::addskill(32, $ulevel = 1000);
my $skill = quest::addskill(33, $ulevel = 1000);
my $skill = quest::addskill(34, $ulevel = 1000);
my $skill = quest::addskill(35, $ulevel = 1000);
my $skill = quest::addskill(36, $ulevel = 1000);
my $skill = quest::addskill(37, $ulevel = 1000);
my $skill = quest::addskill(38, $ulevel = 1000);
my $skill = quest::addskill(39, $ulevel = 1000);
my $skill = quest::addskill(40, $ulevel = 1000);
my $skill = quest::addskill(41, $ulevel = 1000);
my $skill = quest::addskill(42, $ulevel = 1000);
my $skill = quest::addskill(43, $ulevel = 1000);
my $skill = quest::addskill(44, $ulevel = 1000);
my $skill = quest::addskill(45, $ulevel = 1000);
my $skill = quest::addskill(46, $ulevel = 1000);
my $skill = quest::addskill(47, $ulevel = 1000);
my $skill = quest::addskill(48, $ulevel = 1000);
my $skill = quest::addskill(49, $ulevel = 1000);
my $skill = quest::addskill(50, $ulevel = 1000);
my $skill = quest::addskill(51, $ulevel = 1000);
my $skill = quest::addskill(52, $ulevel = 1000);
my $skill = quest::addskill(53, $ulevel = 1000);
my $skill = quest::addskill(54, $ulevel = 1000);
my $skill = quest::addskill(55, $ulevel = 1000);
my $skill = quest::addskill(56, $ulevel = 1000);
my $skill = quest::addskill(57, $ulevel = 1000);
my $skill = quest::addskill(58, $ulevel = 1000);
my $skill = quest::addskill(59, $ulevel = 1000);
my $skill = quest::addskill(60, $ulevel = 1000);
my $skill = quest::addskill(61, $ulevel = 1000);
my $skill = quest::addskill(62, $ulevel = 1000);
my $skill = quest::addskill(63, $ulevel = 1000);
my $skill = quest::addskill(64, $ulevel = 1000);
my $skill = quest::addskill(65, $ulevel = 1000);
my $skill = quest::addskill(66, $ulevel = 1000);
my $skill = quest::addskill(67, $ulevel = 1000);
my $skill = quest::addskill(68, $ulevel = 1000);
my $skill = quest::addskill(69, $ulevel = 1000);
my $skill = quest::addskill(70, $ulevel = 1000);
my $skill = quest::addskill(71, $ulevel = 1000);
my $skill = quest::addskill(72, $ulevel = 1000);
my $skill = quest::addskill(73, $ulevel = 1000);
my $skill = quest::addskill(74, $ulevel = 1000);
my $skill = quest::addskill(75, $ulevel = 1000);
my $skill = quest::addskill(76, $ulevel = 1000);
}
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
}
plugin::return_items(\%itemcount);
}
Hopefully I can clean this up some on my own. I thank those that helped me throughout this post so far in getting me this far.
Thanks,
Kingmen30264
c0ncrete
02-13-2013, 04:54 AM
in Perl, every time you use the my keyword, you are declaring (creating) the variable that follows within the scope you are in. additionally, every time you use =, you are assigning a value to the left operand.
i don't mean this as an insult, but i would suggest you spend a little time learning some basic programming concepts before continuing further. it will likely be immensely helpful to you to be able to write and run Perl scripts outside of the emulator environment so you can test ideas or debug issues that you may have without having to launch the server or the client whatsoever.
there is some very good material freely available here to get you started:
http://www.perl.org/books/library.html
Kingmen30264
02-16-2013, 07:18 AM
in Perl, every time you use the my keyword, you are declaring (creating) the variable that follows within the scope you are in. additionally, every time you use =, you are assigning a value to the left operand.
i don't mean this as an insult, but i would suggest you spend a little time learning some basic programming concepts before continuing further. it will likely be immensely helpful to you to be able to write and run Perl scripts outside of the emulator environment so you can test ideas or debug issues that you may have without having to launch the server or the client whatsoever.
there is some very good material freely available here to get you started:
http://www.perl.org/books/library.html
You were right c0ncrete, I wasn't understanding what it was that you were referring to when you showed me that script.
Since you have showed me that, I have been reading up on Perl and researching various commands to learn a little more in each "area" and in doing so, I was able to learn a few more "tricks of the trade", if you wanna call it that.
Here is what I got:
foreach my $skill (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76)
{
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
You said that if I learned a little more about it, then I could even test the script without launcher a client, and with that, I did a little research and I found that I can use cmd to test the script(s) I compose with the following command:
perl -wc script.pl
It works in telling me if the syntax is right, and also lists the errors if any are present, but I still trying to find a way to write the results to a text file so I can comb through it as sometimes it scrolls off the screen. Any help on this? (Windows 7 OS)
Thanks for the link(s) to perl, they are extremely helpful.
~Kingmen
P.S. I know you know the command(s) to perl and whatnot, but I am adding this in here in case someone like myself who is new to this can see what I did, and implement it themselves. A lot of the time when I go to search for something, someone will find the answer and not post it. They will only say, "I solved it, thanks!" and not post what they did to solve it.
c0ncrete
02-16-2013, 07:50 AM
http://damienlearnsperl.blogspot.com/2009/01/launch-your-perl-script-from-notepad.html
Kingmen30264
02-22-2013, 08:20 AM
I have been reading the perl book and I got to the part of Hashes, Arrays, Scalars etc and after reading about it I decided to give it a shot.
I have it working, but I just have one issue with it... It makes it into a paragraph format. I am wanting have it in a list format, and it seems the \n doesn't work within an array.
Here is my quest file:
############
#Test Array
#Kingmen
############
sub EVENT_SAY
{
my $content = quest::saylink("content");
@items = (
CHARM => quest::varlink("1118"),
EARONE => quest::varlink("1388"),
HEAD => quest::varlink("1119"),
FACE => quest::varlink("1389"),
EARTWO => quest::varlink("1388"),
NECK => quest::varlink("1384"),
SHOULDER => quest::varlink("1385"),
ARMS => quest::varlink("1264"),
BACK => quest::varlink("1386"),
BRACERONE => quest::varlink("1319"),
BRACERTWO => quest::varlink("1319"),
RANGE => quest::varlink("1373"),
HANDS => quest::varlink("1270"),
PRIMARY => quest::varlink("1372"),
SECONDARY => quest::varlink("1381"),
RINGONE => quest::varlink("1383"),
RINGTWO => quest::varlink("1383"),
CHEST => quest::varlink("1267"),
LEGS => quest::varlink("1266"),
FEET => quest::varlink("1261"),
WAIST => quest::varlink("1387"),
AMMO => quest::varlink("80703")
);
if($text=~/hail/i)
{
plugin::Whisper("Hi $name, how are you doing today?");
plugin::Whisper("Would you like to see what $content I have today?");
}
if($text=~/content/i)
{
$client->Message(315, "===ITEMS===");
$client->Message(315, "@items", "\n");
}
}
Also, here is a picture of what it looks like when I execute the command:
http://img833.imageshack.us/img833/1086/arrayp.jpg (http://imageshack.us/photo/my-images/833/arrayp.jpg/)
http://img833.imageshack.us/img833/1086/arrayp.jpg
I am still reading the Perl book, but I was trying to implement what was shown in real-time vs practice exercises so it would stick a little more. I understand the concept of everything so far, but like I said, I am trying to figure out how to make it list format.
I have tried the following methods so far:
CHARM => quest::varlink("1118")
,
CHARM => quest::varlink("1118"
),
CHARM => quest::varlink("1118
"),
I was hoping one of them would bring it to a new line, but that didn't work.
Also if I do the following, it returns "syntax OK", but it shows no results in EQ.
CHARM => quest::varlink("1118"),
"\n", EARONE => quest::varlink("1388"),
As you can see, I got it working, and it is cleaner that my other "work" lol, but I still have a bit to go before I am able to write something decent.
Thanks for any responses.
~Kingmen
trevius
02-22-2013, 08:28 AM
The client won't allow you to start a new line in the same message (it won't even display multiple spaces next to each other). You just need to do a for each loop through your array and send a message for each entry in the array.
Kingmen30264
02-22-2013, 08:30 AM
Dang. Alright, well I was hoping that I wouldn't have to do that. I suppose that I am going to have to hold off till I get to the part about foreach as I don't want to confuse myself. ~_~
Thanks for the answer Trev.
~Kingmen
Kingmen30264
02-24-2013, 12:41 AM
I was going through the possible $client commands located here (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects), and I noticed one that I was really interested in:
$client -> GetItemInInventory
I have tried making this work in serveral ways, and I just cannot seem to get it. I have searched the forums for the use of this command and it doesn't return any results for me.
When using google to search for any reference to this (eqemu getitemininventory), it returns with the changelog.txt file which I saw the following:
KLS: Added ability to retrieve items from the inventory in perl with $client->GetItemInInventory(slot_id);
I noticed that the command shows (slot_id), but I am a tad confused on how to denote the item that I am wanting it to take.
Here is my script I am working on right now. The entire script works except for the part in black.
######
#Buffer
#Kingmen
######
sub EVENT_SAY
{
my $buffs = quest::saylink("buffs");
my $help = quest::saylink("help");
my $items = quest::saylink("items");
@diamonds = (
Blue_Diamond && quest::varlink("22503"),
Raw_Diamond && quest::varlink("15981"),
Diamond && quest::varlink("10037"),
Flawless_Diamond && quest::varlink("25814")
);
@diamonds1 = (
Blue_Diamond && $client->GetItemInInventory(22503),
Raw_Diamond && $client->GetItemInInventory(10037),
Diamond && $client->GetItemInInventory(25814),
Flawless_Diamond && $client->GetItemInInventory(15981)
);
if($text=~/hail/i)
{
plugin::Whisper("Hi there $name, would you like some $buffs? Also, I am collecting some $items if you want to $help");
}
if($text=~/buffs/i)
{
plugin::Whisper("Enjoy your buffs, $name");
quest::selfcast(1561); #legacy of thorns
quest::selfcast(39); #quickness
quest::selfcast(2570); #kei
quest::selfcast(5415); #Talisman of Wunshi
quest::selfcast(5405); #Talisman of Fortitude
quest::selfcast(5417); #Champion
}
if($text=~/^items$/i)
{{
$client->Message(315, "Yes, I am searching for the follwing items.");
$client->Message(315, "=== ITEMS ===");
}
for my $dia(@diamonds){
$client->Message(315, "$dia");
}}
if($text=~/help/i)
{{
$client->Message(315, "Great. Stand close as I take them.");
}
for my $dia1(@diamonds1){
$client->GetItemInInventory($dia1);
$client->(315, "All Gone.");
}}
}
All I am really wanting this script to do is search the persons' inventory, find the items in question, and take them. I have a bit more that I want to do with this, but for right now I want to get this one part working in full so as to understand how it works, and then I will work on the next part (custom currency [different name instead of current ones], and server automatically crediting the currency to the client. I am sure I can figure this part on my own as I have seen some mention to this within the forums recently [Found Here (http://www.eqemulator.org/forums/showthread.php?t=33661)] which should make it easier for me to do so).
Thanks for any replies,
~Kingmen
c0ncrete
02-24-2013, 01:05 AM
your arrays don't make any sense. what exactly is it you are trying to do there?the method you are trying to use takes a slotID as an argument.
http://www.eqemulator.net/wiki/wikka.php?wakka=DevInventorySlots
Kingmen30264
02-24-2013, 01:18 AM
Right, that is what I was saying. I am looking for a command that will allow me to automatically search the players inventory and then get that item from them without the use of them manually turning in said items.
My arrays I have set up I could probably clean them up a bit more as I have read a bit more on Perl and could maybe make it look more like:
@diamond (
quest::varlink("22503"), #Blue Diamond
quest::varlink("15981") #Raw Diamond
);
This way it eliminates the whole Blue_Diamond ==/&& bit.
Basically what I am wanting to do is on my server create another form of currency and assign it to an NPC with classid=70 (Alternate Currency Merchant). By doing so it will allow me to place items throughout my server that other players will be able to collect, speak to the npc and in turn automatically claim whatever items match that of the list I have composed, thus either returning an item to show their progress, or simply updating thier "credit" with the npc.
I could use the credit system that Akkadius has composed, but I would rather limit the use of it to NPCs that I am going to use to charge players for certain items, or buffs.
But to make a long story short, I am looking for a command that I can use to just take the items from the players' inventory without having them manually turn in say, 100 items, 4 at a time.
Thanks,
~Kingmen
c0ncrete
02-24-2013, 01:19 AM
you're wanting to use something more like this, where @findThese is a list of itemIDs you are looking for and @lookIn is a lost of slotIDs you want to look in.
foreach my $findThis (@findThese) {
foreach my $slotID (@lookIn) {
if ($client->GetItemIDAt($slotID) == $findThis) {
$client->DeleteItemInInventory($slotID);
}
}
}
but then you probably also want to be aware of items in a stack as well.
Kingmen30264
02-24-2013, 01:37 AM
you're wanting to use something more like this, where @findThese is a list of itemIDs you are looking for and @lookIn is a lost of slotIDs you want to look in.
foreach my $findThis (@findThese) {
foreach my $slotID (@lookIn) {
if ($client->GetItemIDAt($slotID) == $findThis) {
$client->DeleteItemInInventory($slotID);
}
}
}
but then you probably also want to be aware of items in a stack as well.
Yeah, I was thinking of adding in $itemcount to one of the lines to account for that.
c0ncrete
02-24-2013, 01:40 AM
i'm not sure how how you would determine the stack size of the item in the current slot. i know how you can find charges, but i'm not entirely certain that is the same thing.
Kingmen30264
02-24-2013, 01:48 AM
i'm not sure how how you would determine the stack size of the item in the current slot. i know how you can find charges, but i'm not entirely certain that is the same thing.
I believe that I can use the "charges" to determine the stack size because when I first started messing with the server, I created a few items to which I place on all characters upon creation.
When I first started this, I had my custom Food and Drink items set at 1 charge each and when I created a character, it only showed 1 of each item. I later changed the stacksize of the item within the database and then changed the charges in start_items table to reflect the new stacksize which upon creating a new character revealed the appropriate stacksize I was intending from the start.
I might have it wrong, I don't know. I am still learning the "ropes" of Perl and database editing, but I am going to try and pair table_names/columns with certain variables till I get one that works.
Thanks c0ncrete,
~Kingmen
sorvani
02-24-2013, 01:47 PM
Stack size and charges are the same thing. Just depends on is the item is marked as stackable or not whether it shows as charges or increases the stack.
Kingmen30264
02-24-2013, 05:55 PM
foreach my $findThis (@findThese) {
foreach my $slotID (@lookIn) {
if ($client->GetItemIDAt($slotID) == $findThis) {
$client->DeleteItemInInventory($slotID);
}
}
}
Thanks for the code c0ncrete it works... however, there is one thing that it is doing, or rather not doing that I am trying to figure out.
The NPC will delete the items, but they aren't removed. In fact what happens is when I go to pick up the stack of items, I get the following:
http://img15.imageshack.us/img15/9199/errortakeitem.png (http://img15.imageshack.us/img15/9199/errortakeitem.png)
Here is my script so you can look at it yourself and tell me if I did something wrong.
This also happens on single items as well.
######
#Buffer
#Kingmen
######
sub EVENT_SAY
{
my $buffs = quest::saylink("buffs");
my $help = quest::saylink("help");
my $items = quest::saylink("items");
@diamonds = (
quest::varlink("22503"), #Blue_Diamond
quest::varlink("15981"), #Raw_Diamond
quest::varlink("10037"), #Diamond
quest::varlink("25814") #Flawless_Diamond
);
#@diamonds1 = (
# GetItemID(22503),
# GetItemID(10037),
# GetItemID(25814),
# GetItemID(15981));
#@slots = (1, 2, 3, 4, 5, 6, 7, 8, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
# 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
# 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302,
# 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
# 322, 323, 324, 325, 326, 327, 328, 329, 330);
if($text=~/hail/i)
{
plugin::Whisper("Hi there $name, would you like some $buffs? Also, I am collecting some $items if you want to $help");
}
if($text=~/buffs/i)
{
plugin::Whisper("Enjoy your buffs, $name");
quest::selfcast(1561); #legacy of thorns
quest::selfcast(39); #quickness
quest::selfcast(2570); #kei
quest::selfcast(5415); #Talisman of Wunshi
quest::selfcast(5405); #Talisman of Fortitude
quest::selfcast(5417); #Champion
}
if($text=~/^items$/i)
{{
$client->Message(315, "Yes, I am searching for the follwing items.");
$client->Message(315, "=== ITEMS ===");
}
for my $dia(@diamonds){
$client->Message(315, "$dia");
}}
if($text=~/help/i)
{{
$client->Message(315, "Great. Stand close as I take them.");
}
{
foreach my $dia1 (22503, 10037, 25814, 15981) {
foreach my $slot (22, 23, 24, 25, 26, 27, 28, 29, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302,
303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
322, 323, 324, 325, 326, 327, 328, 329, 330) {
if ($client->GetItemIDAt($slot) == $dia1) {
$client->DeleteItemInInventory($slot);
}
}
}}}
}
I have arrays @diamonds1 and @slots commented out so they do not interfer with my script right now, and also so my npc will talk to me. I haven't found a way to implement an item search into the array just yet, so I just replaced @finditem with the item numbers I am wanting.
Thanks,
~Kingmen
c0ncrete
02-24-2013, 07:02 PM
http://www.eqemulator.net/wiki/wikka.php?wakka=QuestObjects
these are all of the available parameters
$client->DeleteItemInInventory($slotID, $quantity, $updateClient)
quantity is set to 0 by default, which deletes the entire stack. update client is set to false by default, which probably causes the behavior you are seeing now.
you probably want to change client_update to true (1).
$client->GetItemAt(slotid)->GetCharges()
will show you the stack size
Kingmen30264
03-22-2013, 03:55 PM
I have been working on this script on and off for a bit now when I am not doing something else on my server, however, it appears that I cannot get ONE thing to work in the script that I am wanting.
Here is the script:
#######
#Test Script
#Kingmen
#######
sub EVENT_SAY
{
%sample = ( 1 => [1118, "Charm"],
2 => [1388, "Ear One"],
3 => [1119, "Head"],
4 => [1389, "Face"],
5 => [1388, "Ear Two"],
6 => [1384, "Neck"],
7 => [1385, "Shoulder"],
8 => [1264, "Arms"],
9 => [1386, "Back"],
10 => [1319, "Bracer One"],
11 => [1319, "Bracer Two"],
12 => [1373, "Range"],
13 => [1270, "Hands"],
14 => [1372, "Primary"],
15 => [1381, "Secondary"],
16 => [1383, "Ring One"],
17 => [1383, "Ring Two"],
18 => [1267, "Chest"],
19 => [1266, "Legs"],
20 => [1261, "Feet"],
21 => [1387, "Waist"],
22 => [80703, "Ammo"]
);
my $have = quest::saylink("have");
my $item1 = quest::varlink($sample{1}[0]);
my $slot = $sample{1}[1];
my $one = $sample{0}[1];
#my $two = $sample{1}[2];
my $single = quest::saylink("single");
if($text=~/Hail/i)
{
plugin::Whisper("Hello $name, would you like to see what I $have? Or perhaps you would like view a $single item?");
}
if($text=~/have/i)
{
$client->Message(315, "===ITEMS===");{
foreach my $slots ( keys %sample )
{
$client->Message(315, "$sample{$slots}[1] =-= $sample{$slots}[$item1]");
}
}}
if($text=~/Single/i)
{
$client->Message(315, "===ITEMS===");
$client->Message(315, "$slot =-= $item1");
$client->Message(315, "===========");
}
}
What I can not get working in this script is the Varlink highlighted in Dark Red.
As I stated above, all else in the script works fine (See picture below) except for the item link.
I was originally against posting this for help, but I know that I am missing something stupid, and as I am still learning perl and all of her commands, I figured I would post it for someone to tell me where I am going wrong.
http://i215.photobucket.com/albums/cc160/kingmen30264/Semiworking.png
http://i215.photobucket.com/albums/cc160/kingmen30264/Semiworking.png
A pre-thanks to those that reply.
~Kingmen
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.