Dispenser.GetItem
Skip to content
mnscript
DispenserItem Dispenser.GetItem(string) 

Description ​

Finds a DispenserItem of the given name.

Arguments ​

string - The name of the item to look for.

Returns ​

DispenserItem - DispenserItem which was found. Use DispenserItem.GetAmount to know if there are any in storage.

Example ​

msc
using Peripheral;
using Console;
using Application;
using Util;

Dispenser dispenser = Peripheral.GetConnectedDispenser();

if(dispenser.IsValid() == false){
    // If the dispenser was not found, quit.
    Application.Exit();
}

// Searches for glocks in the dispenser.
// To find the item name of a weapon, right click copy the weapon in Q menu Weapons Tab.
DispenserItem glocks = dispenser.GetItem("vguns_glockp80");
number numberOfGlocks = glocks.GetAmount();

Console.WriteLine("The dispenser has "..Util.ToString(numberOfGlocks).." Glocks");