EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Quest to see if client is wearing any equipment (https://www.eqemulator.org/forums/showthread.php?t=24472)

kedra 02-25-2008 06:44 AM

Quest to see if client is wearing any equipment
 
The subject says it all. I'm looking for the most effective way to check a client's inventory (worn items only) to see if he is wearing any item in any slot.

Basically, I want an NPC to be able to determine if the player has any equipped gear.

Any suggestions?

AndMetal 02-25-2008 07:44 AM

Using this as a reference, I would imagine you could use the following command:

Code:

$client->GetItemIDAt(slot_id)
You would then need a loop to test each possible visible slot, which would be 0 through 21. This should do what you're looking for (although I haven't tested it):

Code:

sub EVENT_SAY {
        if ($text=~/i'm a noob/i) {
                my $s_id;        #slot_id that will be looked at, defined in the for loop
                my $ii = 0;        #how many total items you have in your inventory
                for ($s_id = 0; $s_id <= 21; $s_id++) {        #look at just visible slots 0-21
                        if ($client->GetItemIDAt($s_id) != 0) {
                                $ii++;
                        }
                }
                if ($ii > 0) {
                        quest::say("If you were a noob, then how did you get $ii pieces of armor?");
                } elseif ($ii == 0) {
                        quest::say("Yes. Yes, you are certainly a noob. A very naked noob.");
                        quest::emote("sees you cutting diamonds.");
        }
}

To be honest, I'm not even sure if you have to define the variables at the beginning (so that they're only for the script), but it should prevent them from carrying over to the next call of the script (I think).

kedra 02-25-2008 08:24 AM

Perfect, Andmetal, that's exactly what I needed. I had tried using
Quote:

$client->GetItemIDAt(slot_id)
last night, but I was passing it the slot id in the wrong format.

Thanks tons. ;)


All times are GMT -4. The time now is 10:25 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.