I am yet again stumped

I have a string to show total credits on a text panel
string credit = 10000;
text credit_txt
{
pos_x = 774;
pos_y = 305;
layer = 2;
font lcars2_font;
string = credit;
layer = 1;
}
So far so good, it shows up were i want

However when i select a ship i need that to go down so i did the following.
var credits = 10000;
function tile_event()
{
if (bmapno ==1)
{
credits = - 2000;
ent_create(ship_b1, my.x, ship_function); // create / place ship at my.x?
}
if (bmapno ==2)
{
ent_create(ship_b2, my.x, ship_function); // create / place ship at my.x?
}
if (bmapno ==3)
{
ent_create(ship_b3, my.x, ship_function); // create / place ship at my.x?
}
}
Now i have tried to change credits to the string credits_txt but get a read only error.
I am stuck as i cannot figure out how to get that 10g number to go down
