Of course there is.
function GameConnection::buyItem(%this, %item, %quantity) {
%bananaCost = 10;
%appleCost = 5;
if(%item == 0) { // banana
if(%this.wallet >= %bananaCost * %quantity) {
%this.wallet -= %bananaCost * %quantity;
%this.bananas += %quantity;
}
}
if(%item == 1) { // apple
if(%this.wallet >= %appleCost * %quantity) {
%this.wallet -= %appleCost * %quantity;
%this.apples += %quantity;
}
}
}
registerOutputEvent("GameConnection", "buyItem", "list Banana 0 Apple 1" TAB "int 1 100 1", 0);