• Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

Draw a box

Assaultz

Member
m0X6gQC.png




CODE :

[HIDE]@echo off&& setlocal&& cls
REM Draws a rectangle with X1, Y1, Width and Height specified by inputs
set "x=%1"&& set "y=%2"&& set "w=%3"&& set "h=%4"

REM Place blank lines above
set /a yBefore=%y% - 1
for /l %%a in (1,1,%yBefore%) do (echo.)

REM Create rectangle components
set /a xRemaining=%x%-1
set wRemaining=%w%
:topLineGen
if NOT %xRemaining% == 0 set /a xRemaining-=1&& set "topLine=%topLine% "&& goto :topLineGen
set "topLine=%topLine%#"&& set /a wRemaining-=1
if NOT %wRemaining% == 0 goto :topLineGen

REM Render top line
echo %topLine%

REM Create middle line
set xRemaining=%x%
set /a wRemaining=%w%-2
:midLinePreGen
if %xRemaining% GTR 1 set /a xRemaining-=1&& set "midLine=%midLine% "&& goto :midLinePreGen
set "midLine=%midLine%#"
:midLineGen
if %wRemaining% GTR 0 set /a wRemaining-=1&& set "midLine=%midLine% "&& goto :midLineGen
if %w% GTR 1 set "midLine=%midLine%#"

REM Render middle lines
set /a midLinesRemaining=%h%-2
:renderMidLines
if %midLinesRemaining% GTR 0 echo %midLine%&& set /a midLinesRemaining-=1&& goto :renderMidLines

REM If the height is greater than 1, render a bottom line (we can re-use %topLine% variable)
if %h% GTR 1 echo %topLine%
endlocal
exit /b
[/HIDE]

Enjoy :P
 
General chit-chat
Help Users
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    Omar-_- is our newest member. Welcome!
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    lilmonster3 is our newest member. Welcome!
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    765rdchy5rfvbj5edcvj4ed is our newest member. Welcome!
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    wilson sales is our newest member. Welcome!
  • Chat Bot:
    riggv is our newest member. Welcome!
  • Chat Bot:
    ripthors is our newest member. Welcome!
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    modmonkey is our newest member. Welcome!
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    ZynxDEX is our newest member. Welcome!
  • Chat Bot:
    ZynxDEX has started a new thread called "Console ID" in Console ID's.
  • Chat Bot:
    keplerland is our newest member. Welcome!
      Chat Bot: keplerland is our newest member. Welcome!
      Back
      Top