This version works. Tested it with Eli's store. I've added some debug elements to it to post info to the Feedback screen via SendMessageToPC, which you'll want to remove in the final version.
void StoreOpen(object oMerch, object oNPC, int nMarkUp, int nMarkDown, int nSkill) {
SendMessageToPC(oNPC, "PC's Persuade = " + IntToString(nSkill));
SendMessageToPC(oNPC, "nBonusMarkUp = " + IntToString(nMarkUp));
OpenStore(oMerch, oNPC, nMarkUp, nMarkDown);
}
void main(){
object oPC = GetFirstPC();
int nPersuade;
int nPersuadeAdj;
AssignCommand(GetFirstPC(), ClearAllEffects());
nPersuade = GetSkillRank(SKILL_PERSUADE, oPC);
if (nPersuade > 0 && nPersuade <= 17)
{
nPersuadeAdj = nPersuade - 10;
}
else if (nPersuade > 17 && nPersuade <= 30)
{
nPersuadeAdj = (2 * nPersuade) - 27;
}
else if (nPersuade > 30)
{
nPersuadeAdj = 33;
}
else
{
nPersuadeAdj = -10;
}
DelayCommand(0.1, StoreOpen(GetObjectByTag("kas_czerkastore", 0), oPC, (nPersuadeAdj * -1), 0, nPersuade));
}
Declaring the skill has been moved to after the ClearAllEffects, since I presume you are trying to remove buffs first.