FindSubstance()

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
innominabile
Adept Poster
Posts: 85
Joined: Wed Aug 30, 2006 5:24 pm

FindSubstance()

Post 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!!"
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
innominabile
Adept Poster
Posts: 85
Joined: Wed Aug 30, 2006 5:24 pm

Post by innominabile »

Uh... I have found the problem.... I think
FindSubstance() return an array :-))))
Post Reply