You are not logged in.

#1 31 Dec 2013 20:30

einstein1969
Member
From: Italy
Registered: 29 Dec 2013
Posts: 25

Text mode effect!

Hi to all,

Post your effect!

Mine:


Title: Double reverse rainbow 01
External command: Debug.exe, Findstr.exe
SO: Developed on windows 7 32bit. Tested on Windows 7 32bit


@echo off & setlocal EnableDelayedExpansion & Goto :Init_System

:Main

  mode 80,43

  cls

  call :color_sdown 07 " ...... " 04 "°±²Û" 4C "°±²Û" CE "°±²Û" EA "°±²Û" A2 "°±²Û" 21 "°±²Û" 15 "°±²Û" 50 "°±²Û"
  call :color_sdown 07 " " 50 "Û²±°" 15 "Û²±°" 21 "Û²±°" A2 "Û²±°" EA "Û²±°" CE "Û²±°" 4C "Û²±°" 04 "Û²±°"
  rem call :color_sdown 07 " " 04 "°±²Û" 4C "°±²Û" CE "°±²Û" EA "°±²Û" A2 "°±²Û" 21 "°±²Û" 15 "°±²Û" 50 "°±²Û"

  <nul set /p "=......!CR!"

  For /L %%i in (1,1,42) do call :scroll_down

  For /L %%j in (1,1,42) do call :scroll_down_lr

  <nul set /p "=.                               By Einstein1969!CR!"
  call :scroll_down
  <nul set /p "=.                                              !CR!"

  For /L %%i in (1,1,20) do call :scroll_down

  pause>nul

Goto :EndMain

:color_sdown
  
    (echo %~2\..\'
    ) > $$$.color.txt && findstr /a:%~1 /f:$$$.color.txt "."

    call :scroll_down

    Shift
    Shift

    If ""=="%~1" Goto :Eof

   goto :color_sdown

:scroll_down

(echo m b800:0000 l 2000 b800:00a0
 echo q
)|debug>nul

goto :eof

:scroll_down_lr

(echo m b800:0050 l 50 b800:004e
 echo m b800:0000 l 4e b800:0002
 echo m b800:0000 l 2000 b800:00a0
 echo q
)|debug>nul

goto :eof


:Init_system

  for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a")

  for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
 
  <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%" > "'"

Goto :Main

:EndMain
  :: Clearing all garbage
  del '
Goto :Eof

10o0j6q.png

einstein1969

Offline

#2 01 Jan 2014 03:55

Aacini
Member
Registered: 05 Dec 2012
Posts: 149

Re: Text mode effect!

This is my favorite "effect"!

Title: Mandelbrot Set
External command: ColorChar.exe; however, the Batch file itself generate it, so you just need to copy the Batch file below.
Tested on Windows 8 64bits

For a detailed explanation on the Mandelbrot Set fractal graphic, see this post.

@if (@CodeSection == @Batch) @then


@echo off

rem Mandelbrot Set graphic in text mode
rem Antonio Perez Ayala

setlocal EnableDelayedExpansion

rem Working values: maximum screen coordinates and iteration level
set /A maxX=0, maxY=0, maxLevel=26, digits=4, one=1
for /L %%i in (1,1,%digits%) do set one=!one!0
for /F "skip=2 tokens=2" %%a in ('mode con') do (
   if !maxY! equ 0 ( set /A maxY=%%a-2
   ) else if !maxX! equ 0 ( set /A maxX=%%a-1
   )
)

rem Define "graphic" characters
if /I "%1" equ "COLOR" (
   if not exist ColorChar.exe call :ExtractBinaryFile ColorChar.exe
   set  showChars= Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û   Û
   set  showChars=219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219 219
   set showColors= 1   2   3   4   5   6   7   8   9   A   B   C   D   D   E   E   E   E   F   F   F   F   F   F   F   F
   set showChar[0]=32
   set showColor[0]=0
   set i=0
   for %%c in (!showColors!) do (
       set /A i+=1
       set showColor[!i!]=%%c
   )
) else (
   set showChars=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
   set "showChar[0]= "
   set /A maxX-=1
)
set i=0
for %%c in (%showChars%) do (
    set /A i+=1
    set showChar[!i!]=%%c
)

rem Horizontal range: in 4:3 screen use range=3 (-1,2), in 16:9 screen use range=4 (-1.5,2.5)
call :IntAsFP   xLeft=-1.5000
call :IntAsFP  xRight= 2.5000
call :IntAsFP    yTop= 1.1250
call :IntAsFP yBottom=-1.1250

rem Draw the Mandelbrot Set
cls
set /A xStep=(xRight-xLeft)/maxX, yStep=(yBottom-yTop)/maxY, yPos=yTop-yStep, four=4*one
for /L %%y in (0,1,%maxY%) do (
   set /A yPos+=yStep, xPos=xLeft-xStep
   set line=
   for /L %%x in (0,1,%maxX%) do (
      set /A xPos+=xStep, xIter=xPos, yIter=yPos, xSquare=xIter*xIter/one, ySquare=yIter*yIter/one, root=xSquare+ySquare, level=0
      for /L %%i in (1,1,%maxLevel%) do if !level! equ 0 (
         if !root! lss %four% (
            set /A yIter=2*xIter*yIter/one-yPos, xIter=xSquare-ySquare-xPos, xSquare=xIter*xIter/one, ySquare=yIter*yIter/one, root=xSquare+ySquare
         ) else (
            set level=%%i
         )
      )
      for %%l in (!level!) do if /I "%1" equ "COLOR" (
         set line=!line! /!showColor[%%l]! !showChar[%%l]!
      ) else (
         set line=!line!!showChar[%%l]!
      )
   )
   if /I "%1" equ "COLOR" (
      ColorChar !line!
   ) else (
      echo !line!
   )
)
pause
goto :EOF


:IntAsFP Int=FP
set FP=%2
set %1=!FP:.=!
exit /B


rem ExtractBinaryFile from hexadecimal digits placed in a "resource" in this .bat file
:ExtractBinaryFile filename.ext
setlocal EnableDelayedExpansion
set "start="
set "end="
for /F "tokens=1,3 delims=:=>" %%a in ('findstr /N /B "</*resource" "%~F0"') do (
   if not defined start (
      if "%%~b" equ "%~1" set start=%%a
   ) else if not defined end set end=%%a
)
(for /F "skip=%start% tokens=1* delims=:" %%a in ('findstr /N "^" "%~F0"') do (
   if "%%a" == "%end%" goto decodeHexFile
   echo %%b
)) > "%1.hex"
:decodeHexFile
< "%1.hex" Cscript //nologo //E:JScript "%~F0" "%1"
del "%1.hex"
exit /B


<resource id="ColorChar.exe">
4d5a900003[3]04[3]ffff[2]b8[7]40[35]b0[3]0e1fba0e00b409cd21b8014ccd21546869732070726f6772616d2063616e6e6f74206265207275
6e20696e20444f53206d6f64652e0d0d0a24[7]55b5b8fd11d4d6ae11d4d6ae11d4d6ae9fcbc5ae18d4d6aeedf4c4ae13d4d6ae5269636811d4d6ae
[8]5045[2]4c0103009a3ec352[8]e0000f010b01050c0004[3]04[7]10[3]10[3]20[4]40[2]10[3]02[2]04[7]04[8]40[3]04[6]03[5]10[2]10
[4]10[2]10[6]10[11]1c20[2]28[84]20[2]1c[27]2e74657874[3]9202[3]10[3]04[3]04[14]20[2]602e7264617461[2]ea[4]20[3]02[3]08[14]
40[2]402e64617461[3]20[4]30[3]02[3]0a[14]40[2]c0[480]e806[3]50e86302[2]558bec81c4f4fbfffffc6af5e85e02[2]8945fc6800304000
ff75fce84802[2]8dbdfcfbffff89bdf8fbffffe80302[2]e82202[2]8a064684c00f845b01[2]3c2f75672bbdf8fbffff74168d85f4fbffff5057ff
b5f8fbffffff75fce87401[2]8bbdf8fbffff8a064684c00f842801[2]2c303c0976082c073c0f76022c208a264684e40f840f01[2]80fc20741286
c42c303c0976082c073c0f76022c20d51066a316304000eb853c2275208a064684c00f84e1[3]3c227405880747ebec8a06463c2274f4e961ffffff
3c300f82c4[3]3c390f87bc[3]e8d9[3]3c2a74083c5874043c7875278adc468a06463c300f829d[3]3c390f8795[3]e8b2[3]0fb6cc8ac3f3aae919
ffffff80fc20737780fc09751f8b0d0430400003cf2b8df8fbffff83e10783e908f7d9b020f3aae9f0feffff2bbdf8fbffff7418508d85f4fbffff50
57ffb5f8fbffffff75fce877[3]588bbdf8fbffff88276a008d85f4fbffff506a01ffb5f8fbffffff75fce8f2[3]6800304000ff75fce8d9[3]e99d
feffff882747e995feffff2bbdf8fbffff74168d85f4fbffff5057ffb5f8fbffffff75fce81d[3]33c0c9c3240f8ae08a06463c30720c3c3977082c
30d50a8ae0ebed4ec3558bec6a00ff7514ff7510ff750cff7508e887[3]8b4d10578b7d0c66a116304000f366ab8b0d04304000ff751451ff7510ff
750cff7508e865[3]5f6800304000ff7508e845[3]c9c21000[13xcc]e847[3]8bf08a06463c2275098a06463c2275f9eb0c8a06463c20740484c075
f54ec38a06463c2074f94ec3ccff2514204000ff2500204000ff2504204000ff2508204000ff250c204000ff25102040[367]6e20[2]8c20[2]9c20[2]
ac20[2]ca20[2]6020[6]4420[10]dc20[3]20[22]6e20[2]8c20[2]9c20[2]ac20[2]ca20[2]6020[6]9b004578697450726f6365737300f500476574
436f6e736f6c6553637265656e427566666572496e666f[2]6a0147657453746448616e646c65[2]ee025772697465436f6e736f6c654100f202577269
7465436f6e736f6c654f757470757441747472696275746500e600476574436f6d6d616e644c696e6541006b65726e656c33322e646c6c[302]07[489]
</resource>


@end


// Convert Ascii hexadecimal digits from Stdin to a binary string
var count, byte, output = "";
while ( !WScript.Stdin.AtEndOfStream ) {
   var input = WScript.Stdin.ReadLine();
   for ( var index = 0; index < input.length; ) {
      if ( input.charAt(index) == '[' ) {
         for ( count = ++index; input.charAt(index) != 'x' &&
                                input.charAt(index) != ']' ; index++ ) ;
         count = parseInt(input.slice(count,index++));
         if ( input.charAt(index-1) == 'x' ) {
            byte = String.fromCharCode(parseInt(input.substr(index,2),16));
            index += 3;
         } else {
            byte = String.fromCharCode(0);
         }
         for ( var i = 1; i <= count; i++ ) output += byte;
      } else {
         output += String.fromCharCode(parseInt(input.substr(index,2),16));
         index += 2;
      }
   }
}

// Write the binary string to the output file
var ado = WScript.CreateObject("ADODB.Stream");
ado.Type = 2;  // adTypeText = 2
ado.CharSet = "iso-8859-1";  // right code page for output (no adjustments)
ado.Open();
ado.WriteText(output);
ado.SaveToFile(WScript.Arguments(0),2); // adSaveCreateOverWrite = 2
ado.Close();

cD8nRU2.png

NOTE: Remember that the command-line window must have the same number of lines/columns in both window and buffer sizes, as described in this post.

Antonio

Last edited by Aacini (01 Jan 2014 04:06)

Offline

#3 01 Jan 2014 19:17

Evanator
Member
Registered: 02 Aug 2013
Posts: 36

Re: Text mode effect!

Why do you make me feel like I don't have any clue what I'm talking about?

Offline

#4 05 Jan 2014 06:27

Aacini
Member
Registered: 05 Dec 2012
Posts: 149

Re: Text mode effect!

Title: Color Gradient
External command: ColorChar.exe, embedded in the Batch file itself
Tested on Windows 8 - 64bit

@if (@CodeSection == @Batch) @then


@echo off
setlocal EnableDelayedExpansion

if not exist ColorChar.exe call :ExtractBinaryFile ColorChar.exe

set hexa=0 1 2 3 4 5 6 7 8 9 A B C D E F

mode con cols=80 lines=30
cls
echo/
echo                               Color Gradient by Aacini
echo/
echo/
echo                         Foreground Color @ 100 %% (Ascii 219)
echo              %hexa: =%     %hexa: =%     %hexa: =%
set line=/7 "        "
for /L %%i in (1,1,3) do (
   set line=!line! /7 "     "
   for %%c in (%hexa%) do (
      set line=!line! /%%c 219
   )
)   
ColorChar %line% 13 10
echo/
echo/
echo                           F o r e g r o u n d   C o l o r   @
echo            12.5 %% (Ascii 176)     25 %% (Ascii 177)     50 %% (Ascii 178)
echo              %hexa: =%     %hexa: =%     %hexa: =%
for %%b in (%hexa%) do (
   if %%b equ 0 (
      set line="Background %%b "
   ) else if %%b equ 1 (
      set line="     Color %%b "
   ) else (
      set line="           %%b "
   )
   for %%f in (%hexa%) do (
      set line=!line! /%%b%%f 176
   )
   set line=!line! /7 "   %%b "
   for %%f in (%hexa%) do (
      set line=!line! /%%b%%f 177
   )
   set line=!line! /7 "   %%b "
   for %%f in (%hexa%) do (
      set line=!line! /%%b%%f 178
   )
   ColorChar !line! 13 10
)
echo/
pause > NUL
goto :EOF


rem ExtractBinaryFile from hexadecimal digits placed in a "resource" in this .bat file
:ExtractBinaryFile filename.ext
setlocal EnableDelayedExpansion
set "start="
set "end="
for /F "tokens=1,3 delims=:=>" %%a in ('findstr /N /B "</*resource" "%~F0"') do (
   if not defined start (
      if "%%~b" equ "%~1" set start=%%a
   ) else if not defined end set end=%%a
)
(for /F "skip=%start% tokens=1* delims=:" %%a in ('findstr /N "^" "%~F0"') do (
   if "%%a" == "%end%" goto decodeHexFile
   echo %%b
)) > "%1.hex"
:decodeHexFile
< "%1.hex" Cscript //nologo //E:JScript "%~F0" "%1"
del "%1.hex"
exit /B


<resource id="ColorChar.exe">
4d5a900003[3]04[3]ffff[2]b8[7]40[35]b0[3]0e1fba0e00b409cd21b8014ccd21546869732070726f6772616d2063616e6e6f74206265207275
6e20696e20444f53206d6f64652e0d0d0a24[7]55b5b8fd11d4d6ae11d4d6ae11d4d6ae9fcbc5ae18d4d6aeedf4c4ae13d4d6ae5269636811d4d6ae
[8]5045[2]4c0103009a3ec352[8]e0000f010b01050c0004[3]04[7]10[3]10[3]20[4]40[2]10[3]02[2]04[7]04[8]40[3]04[6]03[5]10[2]10
[4]10[2]10[6]10[11]1c20[2]28[84]20[2]1c[27]2e74657874[3]9202[3]10[3]04[3]04[14]20[2]602e7264617461[2]ea[4]20[3]02[3]08[14]
40[2]402e64617461[3]20[4]30[3]02[3]0a[14]40[2]c0[480]e806[3]50e86302[2]558bec81c4f4fbfffffc6af5e85e02[2]8945fc6800304000
ff75fce84802[2]8dbdfcfbffff89bdf8fbffffe80302[2]e82202[2]8a064684c00f845b01[2]3c2f75672bbdf8fbffff74168d85f4fbffff5057ff
b5f8fbffffff75fce87401[2]8bbdf8fbffff8a064684c00f842801[2]2c303c0976082c073c0f76022c208a264684e40f840f01[2]80fc20741286
c42c303c0976082c073c0f76022c20d51066a316304000eb853c2275208a064684c00f84e1[3]3c227405880747ebec8a06463c2274f4e961ffffff
3c300f82c4[3]3c390f87bc[3]e8d9[3]3c2a74083c5874043c7875278adc468a06463c300f829d[3]3c390f8795[3]e8b2[3]0fb6cc8ac3f3aae919
ffffff80fc20737780fc09751f8b0d0430400003cf2b8df8fbffff83e10783e908f7d9b020f3aae9f0feffff2bbdf8fbffff7418508d85f4fbffff50
57ffb5f8fbffffff75fce877[3]588bbdf8fbffff88276a008d85f4fbffff506a01ffb5f8fbffffff75fce8f2[3]6800304000ff75fce8d9[3]e99d
feffff882747e995feffff2bbdf8fbffff74168d85f4fbffff5057ffb5f8fbffffff75fce81d[3]33c0c9c3240f8ae08a06463c30720c3c3977082c
30d50a8ae0ebed4ec3558bec6a00ff7514ff7510ff750cff7508e887[3]8b4d10578b7d0c66a116304000f366ab8b0d04304000ff751451ff7510ff
750cff7508e865[3]5f6800304000ff7508e845[3]c9c21000[13xcc]e847[3]8bf08a06463c2275098a06463c2275f9eb0c8a06463c20740484c075
f54ec38a06463c2074f94ec3ccff2514204000ff2500204000ff2504204000ff2508204000ff250c204000ff25102040[367]6e20[2]8c20[2]9c20[2]
ac20[2]ca20[2]6020[6]4420[10]dc20[3]20[22]6e20[2]8c20[2]9c20[2]ac20[2]ca20[2]6020[6]9b004578697450726f6365737300f500476574
436f6e736f6c6553637265656e427566666572496e666f[2]6a0147657453746448616e646c65[2]ee025772697465436f6e736f6c654100f202577269
7465436f6e736f6c654f757470757441747472696275746500e600476574436f6d6d616e644c696e6541006b65726e656c33322e646c6c[302]07[489]
</resource>


@end


// Convert Ascii hexadecimal digits from Stdin to a binary string
var count, byte, output = "";
while ( !WScript.Stdin.AtEndOfStream ) {
   var input = WScript.Stdin.ReadLine();
   for ( var index = 0; index < input.length; ) {
      if ( input.charAt(index) == '[' ) {
         for ( count = ++index; input.charAt(index) != 'x' &&
                                input.charAt(index) != ']' ; index++ ) ;
         count = parseInt(input.slice(count,index++));
         if ( input.charAt(index-1) == 'x' ) {
            byte = String.fromCharCode(parseInt(input.substr(index,2),16));
            index += 3;
         } else {
            byte = String.fromCharCode(0);
         }
         for ( var i = 1; i <= count; i++ ) output += byte;
      } else {
         output += String.fromCharCode(parseInt(input.substr(index,2),16));
         index += 2;
      }
   }
}

// Write the binary string to the output file
var ado = WScript.CreateObject("ADODB.Stream");
ado.Type = 2;  // adTypeText = 2
ado.CharSet = "iso-8859-1";  // right code page for output (no adjustments)
ado.Open();
ado.WriteText(output);
ado.SaveToFile(WScript.Arguments(0),2); // adSaveCreateOverWrite = 2
ado.Close();

br5AYGO.png

Offline

Board footer

Powered by