Page 1 of 1

FindSubstance()

Posted: Thu Aug 31, 2006 3:47 am
by innominabile
I have code:

Code: Select all

    // Cerca materiale
    //
    if (consume_bottle)
      bottle := FindSubstance(who.backpack, UOBJ_EMPTY_BOTTLE, 1, 0);
      if (!bottle)
        SendSysMessage(who, "You run out of empty bottles.");
        break;
      endif
    endif

    // Consuma materiale
    //
    if (consume_bottle)
      if (!SubtractAmount(bottle, 1))
        SendSysMessage(who, "Can't consume empty bottles!!");
        break;
      endif
    endif

Why FindSubstance() do not fail while SubtractAmount(bottle, 1) fails?

It say me:
"Can't consume empty bottles!!"

Posted: Thu Aug 31, 2006 8:38 am
by CWO
are you possibly reserving the item anywhere? If so, SubtractAmount fails. If not, try setting SubtractAmount(bottle,1) to a variable and Print() or SendSysMessage() it to see the error.

Posted: Thu Aug 31, 2006 2:26 pm
by innominabile
Uh... I have found the problem.... I think
FindSubstance() return an array :-))))