Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::Translate Terraria Copper Into All Money Types v2 ::
- ::Created by RU$$ [https://steamcommunity.com/id/CrypticNight7/] ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- @ECHO OFF
- @setlocal ENABLEDELAYEDEXPANSION
- @GOTO :Start
- :Start
- cls
- set /p "CopperCoinCount=Enter a copper coin amount to convert: "
- cls
- call :CalculateCoins %CopperCoinCount%
- goto :Start
- :CalculateCoins
- set "StartingCopper=%1"
- set "StartingCopperReverse="
- set /a "Copper=0"
- set /a "Silver=0"
- set /a "Gold=0"
- set /a "Platinum=0"
- Rem | Reverse String
- set num=0
- :LOOP0
- call set tmpa=%%StartingCopper:~%num%,1%%%
- set /a "num+=1"
- if defined tmpa (
- set "StartingCopperReverse=%tmpa%%StartingCopperReverse%"
- goto :LOOP0
- )
- Rem | Split Into 2 Chars
- set "Price="
- set "CurrentTypePrice="
- set "MoneyType=0"
- :LOOP1
- if defined StartingCopperReverse (
- Rem | Flip Current Price
- set "CurrentTypePrice=!StartingCopperReverse:~1,1!!StartingCopperReverse:~0,1!"
- Rem | Get Current Money Type (Copper)
- if /I "!MoneyType!" EQU "0" (
- Rem | Check If Total Value Is Not 0
- if /I "!CurrentTypePrice!" NEQ "0" (
- Rem | Check If Value Is Not 00
- if /I "!CurrentTypePrice!" NEQ "00" (
- Rem | Check If Value Starts With 0
- set "FirstChar=!CurrentTypePrice:~0,1!"
- if /I "!FirstChar!" EQU "0" (
- Rem | Set Price With Second Char
- set "Price=!Price!!CurrentTypePrice:~1,1! Copper"
- ) else (
- Rem | Set Price With Both Chars
- set "Price=!Price!!CurrentTypePrice! Copper"
- )
- )
- ) else (
- Rem | No Value Found, Price Is Zero
- set "Price=!Price!0 Copper"
- )
- )
- Rem | Get Current Money Type (Silver)
- if /I "!MoneyType!" EQU "1" (
- Rem | Check If Value Is Not 00
- if /I "!CurrentTypePrice!" NEQ "00" (
- Rem | Check If Value Starts With 0
- set "FirstChar=!CurrentTypePrice:~0,1!"
- if /I "!FirstChar!" EQU "0" (
- Rem | Set Price With Second Char
- set "Price=!CurrentTypePrice:~1,1! Silver !Price!"
- ) else (
- Rem | Set Price With Both Chars
- set "Price=!CurrentTypePrice! Silver !Price!"
- )
- )
- )
- Rem | Get Current Money Type (Gold)
- if /I "!MoneyType!" EQU "2" (
- Rem | Check If Value Is Not 00
- if /I "!CurrentTypePrice!" NEQ "00" (
- Rem | Check If Value Starts With 0
- set "FirstChar=!CurrentTypePrice:~0,1!"
- if /I "!FirstChar!" EQU "0" (
- Rem | Set Price With Second Char
- set "Price=!CurrentTypePrice:~1,1! Gold !Price!"
- ) else (
- Rem | Set Price With Both Chars
- set "Price=!CurrentTypePrice! Gold !Price!"
- )
- )
- )
- Rem | Get Current Money Type (Platinum)
- if /I "!MoneyType!" EQU "3" (
- Rem | Check If Value Is Not 00
- if /I "!CurrentTypePrice!" NEQ "00" (
- Rem | Check If Value Starts With 0
- set "FirstChar=!CurrentTypePrice:~0,1!"
- Rem | Set Price With All Chars
- set "Price=!CurrentTypePrice! Platinum !Price!"
- )
- )
- Rem | Get Platinum Money Type Overspill
- if /I "!MoneyType!" GEQ "4" (
- Rem | Check If Value Is Not 00
- if /I "!CurrentTypePrice!" NEQ "00" (
- Rem | Check If Value Starts With 0
- set "FirstChar=!CurrentTypePrice:~0,1!"
- Rem | Set Price With All Chars
- set "Price=!CurrentTypePrice!!Price!"
- )
- )
- Rem | Progress Counts
- set "StartingCopperReverse=!StartingCopperReverse:~2!"
- set /a "MoneyType+=1"
- goto LOOP1
- )
- Rem | Show Final Result
- Echo !StartingCopper! copper coins converts to: !Price!
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement