Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #16  
Old 02-16-2013, 07:50 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

http://damienlearnsperl.blogspot.com...m-notepad.html
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #17  
Old 02-22-2013, 08:20 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

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:

Code:
############
#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

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:

Code:
CHARM => quest::varlink("1118")
,
Code:
CHARM => quest::varlink("1118"
),
Code:
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.
Code:
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
Reply With Quote
  #18  
Old 02-22-2013, 08:28 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #19  
Old 02-22-2013, 08:30 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

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
Reply With Quote
  #20  
Old 02-24-2013, 12:41 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default GetItemInInventory

I was going through the possible $client commands located here, and I noticed one that I was really interested in:

Code:
$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:

Code:
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.

Code:
######
#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] which should make it easier for me to do so).

Thanks for any replies,
~Kingmen
Reply With Quote
  #21  
Old 02-24-2013, 01:05 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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...InventorySlots
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #22  
Old 02-24-2013, 01:18 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

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:

Code:
@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
Reply With Quote
  #23  
Old 02-24-2013, 01:19 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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.

Code:
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.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #24  
Old 02-24-2013, 01:37 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

Quote:
Originally Posted by c0ncrete View Post
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.

Code:
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.
Reply With Quote
  #25  
Old 02-24-2013, 01:40 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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 muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #26  
Old 02-24-2013, 01:48 AM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

Quote:
Originally Posted by c0ncrete View Post
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
Reply With Quote
  #27  
Old 02-24-2013, 01:47 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

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.
Reply With Quote
  #28  
Old 02-24-2013, 05:55 PM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default

Quote:
Originally Posted by c0ncrete View Post

Code:
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:
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.

Code:
######
#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
Reply With Quote
  #29  
Old 02-24-2013, 07:02 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

http://www.eqemulator.net/wiki/wikka...a=QuestObjects

these are all of the available parameters

Code:
$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).

Code:
$client->GetItemAt(slotid)->GetCharges()
will show you the stack size
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #30  
Old 03-22-2013, 03:55 PM
Kingmen30264
Hill Giant
 
Join Date: Sep 2006
Posts: 112
Default Almost Working

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:
Code:
#######
#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/c...emiworking.png

A pre-thanks to those that reply.
~Kingmen
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:22 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3