ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Grandewd on September 13, 2013, 04:06:09 PM

Title: Differentiating between an item in hand or in backpack
Post by: Grandewd on September 13, 2013, 04:06:09 PM
I need to know if my char is holding an item or if that item is simply in his backpack.
For instance:

Code: [Select]
finditem %someitem #CHARID
will find %someitem in my hand if it's there, but also in my backpack if it's in the top level.
The item is a spellbook and will ALWAYS be in one or the other of those 2 places. If it's in his hand, I need to drop it with event macro 24 2. But, if it's in his backpack - I need to ignore it.

How can I tell where my %someitem currently is?

I suppose I could see if it's in his backpack with:

Code: [Select]
finditem %someitem C_ , #backpackID
and then act accordingly, but is this the only way to tell if it's in his hand or not???

 :(
Title: Re: Differentiating between an item in hand or in backpack
Post by: 12TimesOver on September 13, 2013, 04:56:05 PM
First find the item then, if it exists, find it in the backpack. If it doesn't exist then it's in the hand?

Code: [Select]
finditem %someitem #CHARID
if #findkind = -1
   set %InHand #FALSE
else
   {
   finditem %someitem C_ , #backpacked
   if #findkind = -1
      set %InHand #TRUE
   else
      set %InHand #FALSE
   }

Or something like that. I'm kind of tired right now.
      
Title: Re: Differentiating between an item in hand or in backpack
Post by: dxrom on September 13, 2013, 05:42:11 PM
Or in Stealth you can just compare ObjAtLayer(RHandLayer) or ObjAtLayer(LHandLayer).

Like for my combat skill trainer.

Code: [Select]
if GetSkillValue('Swordsmanship') < 100 then
    begin
      if (GetType(ObjAtLayer(RHandLayer)) = 0) then
      begin
        UseObject(PullBAG);
        wait(500);
        if (GetQuantity(FindTypeEx(wep,$FFFF,Backpack,false)) = 0) then
        begin
          MoveItem(FindTypeEx(wep,$FFFF,PullBAG,false),1,Backpack,0,0,0);
          wait(500);
          Equip(RHandLayer, FindItem);
        end;
        Equip(RHandLayer, FindItem);
      end;
    end;

(GetType(ObjAtLayer(RHandLayer)) = 0) checks the Right Hand, if it has nothing equipped (the item broke from training) then it proceeds.
Title: Re: Differentiating between an item in hand or in backpack
Post by: Grandewd on September 13, 2013, 05:54:15 PM
First find the item then, if it exists, find it in the backpack. If it doesn't exist then it's in the hand?

Code: [Select]
finditem %someitem #CHARID
if #findkind = -1
   set %InHand #FALSE
else
   {
   finditem %someitem C_ , #backpacked
   if #findkind = -1
      set %InHand #TRUE
   else
      set %InHand #FALSE
   }

Or something like that. I'm kind of tired right now.  

Yea, that's pretty much where I headed after thinking more on it.  I'm checking #charID first to see if it's anywhere, if it is then on to #backpackID to see if it's there, then on from there.

But, thx for the input...
Title: Re: Differentiating between an item in hand or in backpack
Post by: Grandewd on September 13, 2013, 05:56:33 PM

@dxrom:  Yea, the more I see regarding Stealth, the more resolved I am to begin it... Being able to actually see directly what is in either hand is really nice....  :)