L_sure:
if ( countitem(7828) )// valor
getitem 522, countitem(7828);
else if ( countitem(7829) )// bravery
getitem 522, countitem(7829);
delitem 7828,1;
delitem 7829,1;
close;
If it has 7828 it deletes and closes . But if it has 7829 the window deletes gets stuck .