07-24-2023, 10:13 AM
As long as I know, some special characters can be displayed if you echo them using "". I'm simply stuck on the code, trying to figure out where I can change for this to work. I can't see the problem. Code from [here][1].
What i need is a special code that can do write animations for me, and then exit. Just like that. I've copied the code from [there][1], modified so it could be called using `typewriter.bat "text" "charsnum-1"`, like `typewriter "Hello" 4`. Though I don't *really* understand Batch Hybrids, and, even knowing how to interpret code, I can't see where the symbols are getting stuck at.
To reproduce my problem: `typewriter.bat "Hello?" 5`
Code:
@if (@CodeSection == @Batch) @then
@echo off
setlocal
color 70
set charnuu=%2
call :split chars %1
:begin
for %%i in (%chars%) do call :type "%%~i"
exit /b
goto begin
:split <var_to_set> <str>
setlocal enabledelayedexpansion
set "line="
set "str=%~2"
for /L %%I in (0,1,%charnuu%) do set line=!line! "!str:~%%I,1!"
endlocal & set "%~1=%line%"
goto :EOF
:type <char>
cscript /nologo /e:JScript "%~f0" "%~1"
goto :EOF
@end
// end batch / begin JScript chimera
function pause() { WSH.Sleep(Math.random() * 50 + 50); }
function odds(num) { return !(Math.round(Math.random() * num) % num) }
pause();
if (odds(300)) WSH.Echo('');
if (!odds(400)) WSH.StdOut.Write(WSH.Arguments(0));
This code isn't showing common symbols or even the basic ones, like `?`. Maybe I am too tired to see it. Help me.
[1]:
What i need is a special code that can do write animations for me, and then exit. Just like that. I've copied the code from [there][1], modified so it could be called using `typewriter.bat "text" "charsnum-1"`, like `typewriter "Hello" 4`. Though I don't *really* understand Batch Hybrids, and, even knowing how to interpret code, I can't see where the symbols are getting stuck at.
To reproduce my problem: `typewriter.bat "Hello?" 5`
Code:
@if (@CodeSection == @Batch) @then
@echo off
setlocal
color 70
set charnuu=%2
call :split chars %1
:begin
for %%i in (%chars%) do call :type "%%~i"
exit /b
goto begin
:split <var_to_set> <str>
setlocal enabledelayedexpansion
set "line="
set "str=%~2"
for /L %%I in (0,1,%charnuu%) do set line=!line! "!str:~%%I,1!"
endlocal & set "%~1=%line%"
goto :EOF
:type <char>
cscript /nologo /e:JScript "%~f0" "%~1"
goto :EOF
@end
// end batch / begin JScript chimera
function pause() { WSH.Sleep(Math.random() * 50 + 50); }
function odds(num) { return !(Math.round(Math.random() * num) % num) }
pause();
if (odds(300)) WSH.Echo('');
if (!odds(400)) WSH.StdOut.Write(WSH.Arguments(0));
This code isn't showing common symbols or even the basic ones, like `?`. Maybe I am too tired to see it. Help me.
[1]:
[To see links please register here]