Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tmphalfmodchoices:=halfmodchoices;
- tmphalfmodchoicenames:=@Left(tmphalfmodchoices;"|");
- tmphalfmodchoiceids:=@Left(@Right(tmphalfmodchoices;"|");"~");
- tmphalfmodchoiceprices:=@Right(@Right(tmphalfmodchoices;"|");"~");
- tmpleftoptions:=leftoptions;
- tmpleftoptionids:=@Left(tmpleftoptions;"~");
- tmpleftoptionprices:=@Right(tmpleftoptions;"~");
- tmpleftmodchoices:=leftmodchoices;
- tmpleftmodchoicenames:=@Left(tmpleftmodchoices;"|");
- tmpleftmodchoiceids:=@Left(@Right(tmpleftmodchoices;"|");"~");
- tmpleftmodchoiceprices:=@Right(@right(tmpleftmodchoices;"|");"~");
- tmprightoptions:=rightoptions;
- tmprightoptionids:=@Left(tmprightoptions;"~");
- tmprightoptionprices:=@Right(tmprightoptions;"~");
- tmprightmodchoices:=rightmodchoices;
- tmprightmodchoicenames:=@Left(tmprightmodchoices;"|");
- tmprightmodchoiceids:=@Left(@Right(tmprightmodchoices;"|");"~");
- tmprightmodchoiceprices:=@Right(@Right(tmprightmodchoices;"|");"~");
- leftPrice:=0;
- @for(i:=1;i<=@Elements(tmpleftoptionids);i:=i+1;
- @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
- @if(tmpleftoptionids[i]=tmphalfmodchoiceids[j];leftPrice:=leftPrice+@TextToNumber(tmphalfmodchoiceprices[j]);"")
- )
- );
- rightPrice:= 0;
- @for(i:=1;i<=@Elements(tmprightoptionids);i:=i+1;
- @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
- @if(tmprightoptionids[i]=tmphalfmodchoiceids[j];rightPrice:=rightPrice+@TextToNumber(tmphalfmodchoiceprices[j]);"")
- )
- );
- winner:="none";
- winner:=@if(leftPrice<rightPrice;"left";winner);
- winner:=@if(rightPrice<leftPrice;"right";winner);
- newleftoptions:="";
- newrightoptions:="";
- @if(winner="none";@do(
- @for(i:=1;i<=@Elements(tmpleftoptions);i:=i+1;
- @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
- @if(tmpleftoptionids[i]=tmphalfmodchoiceids[j];@do(
- newmod:=@Text(tmpleftoptionids[i])+"~"+@Text(tmphalfmodchoiceprices[j]);
- newleftoptions:=@Trim(newleftoptions:newmod)
- );"")
- )
- );
- @for(i:=1;i<=@Elements(tmprightoptions);i:=i+1;
- @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
- @if(tmprightoptionids[i]=tmphalfmodchoiceids[j];@do(
- newmod:=@Text(tmprightoptionids[i])+"~"+@Text(tmphalfmodchoiceprices[j]);
- newrightoptions:=@Trim(newrightoptions:newmod)
- );"")
- )
- );
- FIELD leftmodchoices:=halfmodchoices;
- FIELD rightmodchoices:=halfmodchoices;
- FIELD leftoptions:=newleftoptions;
- FIELD rightoptions:=newrightoptions
- );"");
- @if(winner="left";@do(
- FIELD leftmodchoices:=tmpleftmodchoicenames+"|"+tmpleftmodchoiceids+"~0.00";
- FIELD leftoptions:=tmpleftoptionids+"~0.00"
- );"");
- @if(winner="right";@do(
- FIELD rightmodchoices:=tmprightmodchoicenames+"|"+tmprightmodchoiceids+"~0.00";
- FIELD rightoptions:=tmprightoptionids+"~0.00"
- );"");
- return:=@Text(leftPrice):@Text(rightPrice):winner:newleftoptions:newrightoptions;
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement