Hi all,
I’m practicing working on extensions through some personal edits to UnsignedArduino’s fantastic Inventory extension and I’m having an issue in defining blocks.
Currently the string parameter in the snippet below always shows as a var block on the Makecode Blocks Playground. Any idea what I’m doing wrong here?
/**
* change the quantity of a chosen item in the toolbar.
* @item_name: The name of the item that we want to change the quantity of.
* @value: How much we want to change the quantity of the item by.
*/
//% block="change quantity of %item_name in toolbar by %value"
//% weight=35
//% group="Toolbar"
public change_item_quantity_by(item_name: string, value: number): void {
let selected_item = this.get_item_by_name(item_name)
if (selected_item) {
selected_item.quantity += value;
if (selected_item.quantity < 0) {
selected_item.quantity = 0;
}
this.update();
}
}