Eg replacement of fresh meat on rotten meat.
In stores, I realized how to do, but how I do not know in a backpack.
local $x,$z,$id,$tmp1,$tmp2,$tmp3,$tmp4; $x=getx("unit",1); $z=getz("unit",1); if (this condition is true or false) { $tmp1=count_stored("unit",1,FreshMeatID); //if he has 10 $tmp1=10 $tmp2=4; //the rotted meat count if you want for $tmp2=4 $id=create("item",RottedMeatID,$x,$z,$tmp2); //create the 4 rotted meat at player postion x,z store $id,"unit",1; //store the ID 4 rotted meat in the players backpack $tmp3=$tmp1-$tmp2; //6=10-4 $tmp4=$tmp1-$tmp3; //4=10-6 freestored "unit",1,FreshMeatID,$tmp4; //delete $tmp4...your simply deleting 4, leaving 6 in the backpack }