Jump to content

Function: mds_get_resource_count()


Recommended Posts

  • Root Admin

array mds_get_resource_count()

Returns an associative array with the resources a user has in their inventory and the count.

The returned format is:

array(42) {
  'Aromatic herbs' =>
  'Basic Iron Ingot' =>
  'Bones' =>
  'Branches' =>
  'Bushies' =>
  'Clay' =>

If the user has no resources this will return an empty array. The keys are the resource name and the value is the number of resources.


Link to comment
Share on other sites

A quick example how to loop through the associative array and get all the values displayed


@vb = mds_get_resource_count();

//@vb is the associative array you get from the function
//in the foreach loop we go through @vb
//with @vk we assign the k.ey of @vb so in this case the name of the resource
//@vv is the va.lue to @vk

foreach (@vb as @vk => @vv) {
    echo "Resource: @vk, Amount: @vv<br>";


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.

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.

  • Forum Statistics

    Total Topics
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

  • Create New...