『楼 主』:
[原创]全角字符地图编辑器(批处理)
纯cmd批处理制作
用来绘制全角文本图形
在绘制过程中:
按F1取得帮助
可以随时存盘,顺序地读取关级文件
可以随时添加画笔,选择画笔
可以上下左右翻页
可以选择连续画或者画点的状态
用数字直接修改步进单位,即方向键可以实现一次跳转N行或N列
可以方便地设置用在游戏中的机关数据,并为数据选择坐标提供了方便操作
可以使用填充功能,把当前连续的字符填充为画笔中的字符
可以使用字符转换功能,把与当前字符相同的点全部替换为画笔中的字符
可以使用多次恢复操作
@goto :begin
e 100 cd 16 86 c4 b4 02 cd 10 b4 4C CD 21
g
:begin
@echo off
set a=str= ■∷▓☆★大⊙♀△▲;bj=1;file=hdt;等=call :tczh^
;m=1;n=1;fn=0;b2=1;b3=2;b4=3;b5=4;b6=5;b7=6;b8=7;b9=8^
;Esc=exit/b;Ins=goto :m_ins;del=goto :m_del;paup=goto :m_paup;pado=goto :m_pado^
;f10=call :m_save;back=goto :m_back;home=goto :m_home;End=goto m_end^
;r23=字符表:空!str:~,10! 状态:!zt! 画笔:!zf!!ddb! 当前:!bac!!ddq! 步进:!bj! 帮助键F1 ^
;r24= 按 键:XASDFGHJKL;坐标:当前!n!.!m! 左上!n0!.!m0! 右下!n9!,!m9! ^
;r25=最大边界:!nz!.!mz! 机关:!$jg! ^
;r改写=移动;r移动=改写;zf=■^
;zt=移动;改写=!zf!;移动=!bac!^
;help=!cr!!cr! F1本帮助 F4上一文件 F6下一文件 F10保存 Esc退出 回车刷屏!cr!!cr! 方向移动绘图坐标 空格转换状态^
Up/Down/Home/End上/下/左/右 翻页!cr!!cr! Ins加入一个绘图字符,直接回车则把当前字符作为画笔 !cr!^
Del把当前绘图字符提出放到字符表最后(字符表移位)!cr!!cr!^
Tab键为当前点加入机关设置项,以#号开头,保存在图形数据的后面!cr!!cr!^
按=号进入填充/转换,当前字符==》画笔字符!cr!!cr!^
Backspace恢复操作, 数字键选择步进单位!cr!!cr! 用对应的按键选择画笔,!cr!^
并且在改写状态移动坐标自动绘图,在移动状态则按一个键画一个点!cr!
set %a:;=&set %
set "空格=set zt=^^!r!zt!^^!
set cr=^
&set bac=
set/a n0=0,n9=21,m0=-1
set "Ent=set cls=cls^&if .!zt! equ .设置 goto :eof
set "f6=endlocal^&set /a fn+=1^&goto :restart
set "f4=endlocal^&set /a fn-=1^&goto :restart
set "f1=cls^^^&echo !help!^^^&pause
set "Tab=goto :m_Tab
::各字符分别存为变量
pushd "%~dp0"
chcp 437 >nul
graftabl 936 >nul
::c72=上;c80=下;c75=左;c77=右;
set @@=i15=Tab;i28=Ent;i14=back;i59=f1;i62=f4;i68=f10;i64=f6;i82=ins;i83=Del;i1=Esc^
;i13=等;i73=Paup;i81=Pado;i57=空格;i71=Home;i79=End;c72=n-;c75=m-;c80=n+;c77=m+
set %@@:;=&set %
set $a= &set $d=空
set /p file=输入文件名前缀:
for %%a in ("%file%") do set file=%%~na
set k45=!!
set cls=cls
:restart
setlocal enabledelayedexpansion
for /l %%a in (0,1,9) do (set kh=!kh! )
if exist !file!!fn!.txt goto :m_open
:d_loop
if !mz! lss 38 set mz=38
for /l %%a in (0,1,9) do (set k3%%a=!str:~%%a,1!)
set zf=!str:~,1!
title 批处理版画图 文件:!file!!fn!.txt
:loop
(set bac=!m%n%.%m%!&set m!n!.!m!=⊕
if !n! geq !n9! set /a n0=n-21,n9=n
if !n0! lss 0 set /a n0=0,n9=21
if !n! lss !n0! set /a n0=n,n9=n+21
if !m! geq !m9! set /a m0=m-38,m9=m
if !m0! lss 0 set /a m0=0,m9=38
if !m! lss !m0! set /a m0=m,m9=m+38
if "!m0!!m9!" neq "%m0%%m9%" (
set ebs=
for /l %%b in (!m0!,1,!m9!) do (
set "ebs=!ebs!^!@%%b^!^^^!$a^!@%%b^!^^^!
)
)
set ebuf=
for /l %%a in (!n0!,1,!n9!) do (
for %%c in ("!ebs:@=m%%a.!") do (
for %%d in ("%%~c") do (set ebuf=!ebuf!%%~d:!cr!)
)
)
set m!n!.!m!=!bac!&set ddq=!$d%bac%!&set ddb=!$d%zf%!
set $jg=!#%n%.%m%!
%cls%
set /p=!ebuf!%r23%!cr!%r24%!cr!%r25%<nul
set cls=
>nul debug <%~nx0
)
set err=%errorlevel%
set in=!i%err%! !err!
if defined c%err% goto :lrpd 上下左右
if defined k%err% goto :keyc 选择写入
if defined i%err% goto :cont 功能键
if defined b%err% set bj=!b%err%!
goto :loop
:keyc 画笔选择处理
set var=!k%err%!
set zf=%var%
if "!zt!" equ "移动" (set cone=!var!)
goto :loop
:cont 功能键处理
set comm=!i%err%!
set comm=!%comm%!
set comm=%comm%
%comm%
goto :loop
:lrpd 方向键处理过程
set var=!c%err%:~,1!
for /l %%a in (1,1,!bj!) do (call :lrpd_sub)
goto :loop
:lrpd_sub 方向子过程
(
if "!zt!" equ "改写" (set m!n!.!m!=%zf%) else (if defined cone set m!n!.!m!=%cone%)
set cone=
if !m%n%.%m%! neq !bac! set c_z=!n!.!m!=!bac!@!c_z:~,4096!
set /a !c%err%!=1
if !%var%! lss 0 set !var!=0
if !%var%! gtr !%var%z! set !var!z=!%var%!
)
set bac=!m%n%.%m%!&goto :eof
:m_back 恢复
if defined c_z (
set var=%c_z:@=&rem %
if !var! equ !c_z! set c_z=&goto :loop
set c_z=!c_z:*@=!
if "!var:~,2!" equ "zh" (set bac=!var:~2,1!&set zf=!var:~3,1!&call :unzh) else (
if "!var:~,2!" equ "tc" (
for /f "tokens=2-5 delims=." %%a in ("!var!") do set/a n=%%a,m=%%b&set bac=%%c&set zf=%%d
call :fill
)else (set m!var!)
)
)
goto :loop
:m_del
if "%zf%" neq "" (
set str=!str:%zf%=!%zf%
set zf=!str:~,1!
goto :d_loop
)
goto :loop
:m_ins
set var=
set /p var=输入一个全角字符:
if not defined var set var=!bac!
set str=!var:~,1!!str:%var%=!
goto :d_loop
:m_paup
set/a n-=20,n0-=20,n9-=20
if !n! leq 0 set /a n=0
goto :m_pas
:m_pado
set/a n+=20,n0+=20,n9+=20
if !n9! gtr !nz! set /a n=nz,n9=nz
:m_pas
set zt=移动
set cls=cls
goto :loop
:m_Home
set/a m-=28,m0-=28,m9-=28
if !m! lss 0 set /a m=0
goto :m_pas
:m_End
set/a m+=28,m0+=28,m9+=28
if !m9! gtr !mz! set /a m=mz,m9=mz
goto :m_pas
:m_save 保存文件
setlocal enabledelayedexpansion
set ebs=
for /l %%b in (0,1,!mz!) do (
set "ebs=!ebs!^!@%%b^!^^^!$a^!@%%b^!^^^!
)
(for /l %%a in (0,1,!nz!) do (
for %%c in ("!ebs:@=m%%a.!") do for %%d in ("%%~c") do (set ebuf=%%~d)
set ebuf=!ebuf: = !
for %%c in ("1!ebuf!") do set ebuf=%%~nxc
set ebuf=!ebuf: = !
echo;!ebuf:~1!
)
set # 2>nul
)> !file!!fn!.txt
endlocal&goto :eof
:m_open 打开文件
set n=0
for /f "tokens=1* delims=:" %%j in ('findstr /n .* !file!!fn!.txt') do (
set _str=%%k
if defined _str (if "!_str:~,1!" equ "#" (set !_str!) else (
set /a z=8180,x=0
for /l %%a in (1,1,14) do (set/a "y=(z-x)/2+x"
for %%b in (!y!) do if "!_str:~%%b,1!" equ "" (set/a z=y) else (set/a x=y)
)
if !m! lss !y! set m=!y!
for /l %%l in (0,1,!y!) do (
for %%m in ("!_str:~%%l,1!") do (
if "!str:%%~m=!" equ "!str!" set str=%%~m!str!
set m!n!.%%l=%%~m
)
))
set/a n+=1
)
)
set /a "mz=m,nz=n,n%%=14+4,m%%=22+6"
goto :d_loop
:m_Tab 设置机关功能
::set #n.m=#k@ #t@(内容) [信息]
set var=
echo !cr!!cr!方法:@代表将要输入坐标,输入空格后回车清除机关,直接回车不改变
set/p var=原机关:!#%n%.%m%!!cr!设置为:
if defined var if "!var!" equ " " (set #!n!.!m!=) else (set vara=&goto :aadr)
goto :loop
:aadr 为设置的机关描述添加坐标
set vara=!vara!%var:@=&rem %
set var=%var:*@=%&if "%var%" equ "!var!" (set #!n!.!m!=!vara!&goto :loop)
setlocal enabledelayedexpansion
set zt=设置
set r设置=设置
set r25=正在设置: @!var!
call :loop
endlocal&set vara=!vara!%n%.%m%
goto :aadr
:tczh 填充/转换
if "!bac!" equ "!zf!" goto :eof
set /p in=[1.填充 2.转换]:
if "!in!" equ "1" set m!n!.!m!=!zf!&set c_z=tc.!n!.!m!.!zf!.!bac!@!c_z:~,4096!&goto :fill
if "!in!" equ "2" (
set c_z=zh!zf!!bac!@!c_z:~,4096!
:unzh
for /l %%a in (0,1,!nz!) do for /l %%b in (0,1,!mz!) do (if "!m%%a.%%b!" equ "!bac!" set m%%a.%%b=!zf!)
)
goto :eof
:fill
if !caen! gtr 300 set cbuf=!n!.!m! !cbuf!&goto :eof
set /a vn=n-1,vm=m-1,xn=n+1,xm=m+1,caen+=1
for %%a in (!vn!.!m! !n!.!vm! !n!.!xm! !xn!.!m!) do (
if "!m%%a!" equ "!bac!" (
set m%%a=!zf!
for /f "tokens=1,2 delims=." %%b in ("%%a") do (
if %%b geq 0 if %%b leq !nz! if %%c geq 0 if %%c leq !mz! set/a n=%%b,m=%%c&call :fill
)
)
)
set/a caen-=1
if !caen! leq 1 if defined cbuf (
set cbuf=
for %%a in (%cbuf%) do (for /f "tokens=1,2 delims=." %%b in ("%%a") do (
if %%b geq 0 if %%b leq !nz! if %%c geq 0 if %%c leq !mz! set/a n=%%b,m=%%c&call :fill
) )
)
goto :eof [ Last edited by netbenton on 2009-9-13 at 11:45 ]
|