Hi
I need a hand regarding this shop table.
Adding and cancelling items works fine but there does seem to be a problem.
You start off with 10 Elfers (money).
I'll try and explain the problem.
It's to do with once the Elfers in the label (bottom) get down to 0 (after buying items) and let's say you decide to cancel all the items and Elfers are again at 10, when you check-out you are told you have 0 Elfers left when you should have 10! Therefore when you re open the shop you can't buy.
Could someone take a look at the scripts and pull them apart and hopefully see any problem areas with advice to correct.
Here is draft shop:

Rep Exec Always
Code: AGS
Baskets BUY button:
Code: AGS
Baskets Cancel button:
Code: AGS
Many thanks
I need a hand regarding this shop table.
Adding and cancelling items works fine but there does seem to be a problem.
You start off with 10 Elfers (money).
I'll try and explain the problem.
It's to do with once the Elfers in the label (bottom) get down to 0 (after buying items) and let's say you decide to cancel all the items and Elfers are again at 10, when you check-out you are told you have 0 Elfers left when you should have 10! Therefore when you re open the shop you can't buy.
Could someone take a look at the scripts and pull them apart and hopefully see any problem areas with advice to correct.
Here is draft shop:

Rep Exec Always
}
// SHOP
//ARROWS
LarrowsQ.Text = String.Format("%d", arrows);
Larrowsprice.Text = String.Format("%d", arrows *6);
//BASKETS
LbasketsQ.Text = String.Format("%d", baskets);
Lbasketsprice.Text = String.Format("%d", baskets *2);
//KNIVES
LknivesQ.Text = String.Format("%d", knives);
Lknivesprice.Text = String.Format("%d", knives *4);
//ROPES
LropesQ.Text = String.Format("%d", ropes);
Lropesprice.Text = String.Format("%d", ropes *5);
//TORCH
LtorchQ.Text = String.Format("%d", torch);
Ltorchprice.Text = String.Format("%d", torch *3);
//GRAPPLE
LgrappleQ.Text = String.Format("%d", grapple);
Lgrapprice.Text = String.Format("%d", grapple *10);
//TOTAL PRICING
LTotalPrice.Text = String.Format("%d", arrows *6 + baskets *2 + knives *4 + ropes *5 + torch *3 + grapple *10);
totalcost=arrows *6 + baskets *2 + knives *4 + ropes *5 + torch *3 + grapple * 10;
Lelfers.Text = String.Format("%d", Elfers);
// STOP COUNT IF OVER 10
if (Elfers >= 10)
{
Elfers= 10;
Lelfers.Text = String.Format("%d", Elfers);
}
// STOP COUNT IF OVER 10
if (totalcost >= 10)
{
totalcost= 10;
}
if (Elfers <= 0)
{
Elfers= 0;
}
}
Baskets BUY button:
function Bbuy2_OnClick(GUIControl *control, MouseButton button)
{
if (Elfers < 2)
{
Display("You do not have enough Elfers!");
}
else
{
baskets=(baskets+1);
Elfers=(Elfers -2);
}
}
Baskets Cancel button:
function Bcancel2_OnClick(GUIControl *control, MouseButton button)
{
basketsQ=(baskets-1);
Elfers=(Elfers +2);
if(baskets>0)
{
baskets = (baskets-1); // This could also be done with 'arrows--;' or 'arrows-=1;'
}
else if (baskets <= 0)
{
totalcost=0;
Elfers= -1;
}
}
Many thanks