Advertisement
Imthedude025

Terraria: Translate Copper Into All Money Types

Apr 27th, 2024
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.62 KB | None | 0 0
  1. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. ::Translate Terraria Copper Into All Money Types v2              ::
  3. ::Created by RU$$ [https://steamcommunity.com/id/CrypticNight7/] ::
  4. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5. @ECHO OFF
  6. @setlocal ENABLEDELAYEDEXPANSION
  7. @GOTO :Start
  8.  
  9. :Start
  10. cls
  11. set /p "CopperCoinCount=Enter a copper coin amount to convert: "
  12. cls
  13. call :CalculateCoins %CopperCoinCount%
  14. goto :Start
  15.  
  16. :CalculateCoins
  17. set "StartingCopper=%1"
  18. set "StartingCopperReverse="
  19. set /a "Copper=0"
  20. set /a "Silver=0"
  21. set /a "Gold=0"
  22. set /a "Platinum=0"
  23.  
  24. Rem | Reverse String
  25. set num=0
  26. :LOOP0
  27. call set tmpa=%%StartingCopper:~%num%,1%%%
  28. set /a "num+=1"
  29. if defined tmpa (
  30.     set "StartingCopperReverse=%tmpa%%StartingCopperReverse%"
  31.     goto :LOOP0
  32. )
  33.  
  34. Rem | Split Into 2 Chars
  35. set "Price="
  36. set "CurrentTypePrice="
  37. set "MoneyType=0"
  38. :LOOP1
  39. if defined StartingCopperReverse (
  40.    Rem | Flip Current Price
  41.     set "CurrentTypePrice=!StartingCopperReverse:~1,1!!StartingCopperReverse:~0,1!"
  42.    
  43.     Rem | Get Current Money Type (Copper)
  44.     if /I "!MoneyType!" EQU "0" (
  45.         Rem | Check If Total Value Is Not 0
  46.         if /I "!CurrentTypePrice!" NEQ "0" (
  47.             Rem | Check If Value Is Not 00
  48.             if /I "!CurrentTypePrice!" NEQ "00" (
  49.                 Rem | Check If Value Starts With 0
  50.                 set "FirstChar=!CurrentTypePrice:~0,1!"
  51.                 if /I "!FirstChar!" EQU "0" (
  52.                     Rem | Set Price With Second Char
  53.                     set "Price=!Price!!CurrentTypePrice:~1,1! Copper"
  54.                 ) else (
  55.                     Rem | Set Price With Both Chars
  56.                     set "Price=!Price!!CurrentTypePrice! Copper"
  57.                 )
  58.             )
  59.         ) else (
  60.             Rem | No Value Found, Price Is Zero
  61.             set "Price=!Price!0 Copper"
  62.         )
  63.     )
  64.     Rem | Get Current Money Type (Silver)
  65.     if /I "!MoneyType!" EQU "1" (
  66.         Rem | Check If Value Is Not 00
  67.         if /I "!CurrentTypePrice!" NEQ "00" (
  68.             Rem | Check If Value Starts With 0
  69.             set "FirstChar=!CurrentTypePrice:~0,1!"
  70.             if /I "!FirstChar!" EQU "0" (
  71.                 Rem | Set Price With Second Char
  72.                 set "Price=!CurrentTypePrice:~1,1! Silver !Price!"
  73.                
  74.             ) else (
  75.                 Rem | Set Price With Both Chars
  76.                 set "Price=!CurrentTypePrice! Silver !Price!"
  77.             )
  78.         )
  79.     )
  80.     Rem | Get Current Money Type (Gold)
  81.     if /I "!MoneyType!" EQU "2" (
  82.         Rem | Check If Value Is Not 00
  83.         if /I "!CurrentTypePrice!" NEQ "00" (
  84.             Rem | Check If Value Starts With 0
  85.             set "FirstChar=!CurrentTypePrice:~0,1!"
  86.             if /I "!FirstChar!" EQU "0" (
  87.                 Rem | Set Price With Second Char
  88.                 set "Price=!CurrentTypePrice:~1,1! Gold !Price!"
  89.                
  90.             ) else (
  91.                 Rem | Set Price With Both Chars
  92.                 set "Price=!CurrentTypePrice! Gold !Price!"
  93.             )
  94.         )
  95.     )
  96.     Rem | Get Current Money Type (Platinum)
  97.     if /I "!MoneyType!" EQU "3" (
  98.         Rem | Check If Value Is Not 00
  99.         if /I "!CurrentTypePrice!" NEQ "00" (
  100.             Rem | Check If Value Starts With 0
  101.             set "FirstChar=!CurrentTypePrice:~0,1!"
  102.             Rem | Set Price With All Chars
  103.             set "Price=!CurrentTypePrice! Platinum !Price!"
  104.         )
  105.     )
  106.     Rem | Get Platinum Money Type Overspill
  107.     if /I "!MoneyType!" GEQ "4" (
  108.         Rem | Check If Value Is Not 00
  109.         if /I "!CurrentTypePrice!" NEQ "00" (
  110.             Rem | Check If Value Starts With 0
  111.             set "FirstChar=!CurrentTypePrice:~0,1!"
  112.             Rem | Set Price With All Chars
  113.             set "Price=!CurrentTypePrice!!Price!"
  114.         )
  115.     )
  116.    Rem | Progress Counts
  117.     set "StartingCopperReverse=!StartingCopperReverse:~2!"
  118.     set /a "MoneyType+=1"
  119.     goto LOOP1
  120. )
  121.  
  122. Rem | Show Final Result
  123. Echo !StartingCopper! copper coins converts to: !Price!
  124. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement