I had to write this script to find the first instance of none and replace it with the thing they bought:
function fillCanteen(%client, %powerup)
{
%a = getWord(%client.canteen, 0);
%b = getWord(%client.canteen, 1);
%c = getWord(%client.canteen, 2);
if(%a $= "NONE")
{
%a = %powerup;
}
else if(%b $= "NONE")
{
%b = %powerup;
}
else if(%c $= "NONE")
{
%c = %powerup;
}
%client.canteen = %a SPC %b SPC %c;
}
So now it's
if(%upg $= "Artificial")
{
if(%client.cash < 100)
{
%client.chatMessage("\c3You don't have enough money to buy Artificial Crits!");
%displayMoney = 1;
}
else
{
%client.chatMessage("\c3You bought a single Artificial Crit canteen.");
%client.cash -= 100;
fillCanteen(%client, "CRITS");
}
}
Thanks!