Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1.  
  2. tmphalfmodchoices:=halfmodchoices;
  3. tmphalfmodchoicenames:=@Left(tmphalfmodchoices;"|");
  4. tmphalfmodchoiceids:=@Left(@Right(tmphalfmodchoices;"|");"~");
  5. tmphalfmodchoiceprices:=@Right(@Right(tmphalfmodchoices;"|");"~");
  6.  
  7. tmpleftoptions:=leftoptions;
  8. tmpleftoptionids:=@Left(tmpleftoptions;"~");
  9. tmpleftoptionprices:=@Right(tmpleftoptions;"~");
  10. tmpleftmodchoices:=leftmodchoices;
  11. tmpleftmodchoicenames:=@Left(tmpleftmodchoices;"|");
  12. tmpleftmodchoiceids:=@Left(@Right(tmpleftmodchoices;"|");"~");
  13. tmpleftmodchoiceprices:=@Right(@right(tmpleftmodchoices;"|");"~");
  14.  
  15. tmprightoptions:=rightoptions;
  16. tmprightoptionids:=@Left(tmprightoptions;"~");
  17. tmprightoptionprices:=@Right(tmprightoptions;"~");
  18. tmprightmodchoices:=rightmodchoices;
  19. tmprightmodchoicenames:=@Left(tmprightmodchoices;"|");
  20. tmprightmodchoiceids:=@Left(@Right(tmprightmodchoices;"|");"~");
  21. tmprightmodchoiceprices:=@Right(@Right(tmprightmodchoices;"|");"~");
  22.  
  23. leftPrice:=0;
  24. @for(i:=1;i<=@Elements(tmpleftoptionids);i:=i+1;
  25. @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
  26. @if(tmpleftoptionids[i]=tmphalfmodchoiceids[j];leftPrice:=leftPrice+@TextToNumber(tmphalfmodchoiceprices[j]);"")
  27. )
  28. );
  29. rightPrice:= 0;
  30. @for(i:=1;i<=@Elements(tmprightoptionids);i:=i+1;
  31. @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
  32. @if(tmprightoptionids[i]=tmphalfmodchoiceids[j];rightPrice:=rightPrice+@TextToNumber(tmphalfmodchoiceprices[j]);"")
  33. )
  34. );
  35.  
  36. winner:="none";
  37. winner:=@if(leftPrice<rightPrice;"left";winner);
  38. winner:=@if(rightPrice<leftPrice;"right";winner);
  39.  
  40. newleftoptions:="";
  41. newrightoptions:="";
  42. @if(winner="none";@do(
  43. @for(i:=1;i<=@Elements(tmpleftoptions);i:=i+1;
  44. @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
  45. @if(tmpleftoptionids[i]=tmphalfmodchoiceids[j];@do(
  46. newmod:=@Text(tmpleftoptionids[i])+"~"+@Text(tmphalfmodchoiceprices[j]);
  47. newleftoptions:=@Trim(newleftoptions:newmod)
  48. );"")
  49. )
  50. );
  51. @for(i:=1;i<=@Elements(tmprightoptions);i:=i+1;
  52. @for(j:=1;j<=@Elements(tmphalfmodchoiceids);j:=j+1;
  53. @if(tmprightoptionids[i]=tmphalfmodchoiceids[j];@do(
  54. newmod:=@Text(tmprightoptionids[i])+"~"+@Text(tmphalfmodchoiceprices[j]);
  55. newrightoptions:=@Trim(newrightoptions:newmod)
  56. );"")
  57. )
  58. );
  59. FIELD leftmodchoices:=halfmodchoices;
  60. FIELD rightmodchoices:=halfmodchoices;
  61. FIELD leftoptions:=newleftoptions;
  62. FIELD rightoptions:=newrightoptions
  63. );"");
  64. @if(winner="left";@do(
  65. FIELD leftmodchoices:=tmpleftmodchoicenames+"|"+tmpleftmodchoiceids+"~0.00";
  66. FIELD leftoptions:=tmpleftoptionids+"~0.00"
  67. );"");
  68. @if(winner="right";@do(
  69. FIELD rightmodchoices:=tmprightmodchoicenames+"|"+tmprightmodchoiceids+"~0.00";
  70. FIELD rightoptions:=tmprightoptionids+"~0.00"
  71. );"");
  72. return:=@Text(leftPrice):@Text(rightPrice):winner:newleftoptions:newrightoptions;
  73. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement