Jump to content

Function: Mds_Has_Item


Laphers

Recommended Posts

Copied from Mur's announcement

You can now check if user has a specific item or not. The function mds_has_item("item name") returns the number of items the player has (zero if none). Because coins are technically also items, you can also check how much silver or gold someone has. This function will work the same way for upcoming raw material type of items (not planks and such, something else)
Here is sample code:

(locations 1_3x0_1)
@va = mds_has_item("Silver coin");
echo "You have ".@va." Silver coins";

@va = mds_has_item("Mammon's Book");
if(@va>0){
echo "You have the book";
}else{
echo "Go search for Mammon's Book";
}

Link to comment
Share on other sites

  • 1 year later...

[s]By the way, if you search for a "resource" that is unsplittable, such as [i]Water/Fat/Memory Stone/Wiiya[/i] etc, it will return a value of
[color=#000000][color=#0000BB]string[/color][color=#007700]([/color][color=#0000BB]1[/color][color=#007700]) [/color][color=#DD0000]"1"[/color][/color] instead of an integer with the number of items on-hand. Is this a bug?

(I'm guessing not a bug as Resources are not a quantity but a real-ness when in large amounts)[/s]


Resources are counted as normal items now, as described in the original post.

Edited by Maebius
Link to comment
Share on other sites

yeah same guess as yoars, water etc is more like to have "charges" when ya trade ya are just addin/removin those charges, rather than each bein its own item, anyway this can be easily checked, by water ids when ya get more water and such, i bet those never change, idk myself cuz i never had those items called resources, its just wild guesses that sound logical to me :D

Link to comment
Share on other sites

  • 2 weeks later...

The ID can change if you pick up fresh resources (such as dowsing water, harvesting Herbs, and such)

Resources are counted as normal items now, as described in the original post.

Edited by Maebius
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Forum Statistics

    17.5k
    Total Topics
    182.5k
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...