我一直在爲自己製作一個項目,它可以批量生成一個網格,可以通過批處理遊戲等方式訪問和更改特定點以獲得更好的圖形。在最終輸出時多行批處理文件打印中的奇怪錯誤
@echo off
setlocal ENABLEDELAYEDEXPANSION
!x!
:::::::::::
:: ALIAS ::
:::::::::::
:@alias
set x=exit/b
goto:@main
!x!
:::::::::::
:: MAIN ::
:::::::::::
:@main
call:$Canvas _canvas 16 16 .
set px=%~1
set py=%~2
set _canvas_point[!px!][!py!]=#
!_canvas#draw!
!x!
:::::::::::
::OBJECTS::
:::::::::::
:@objects
!x!
:$Canvas
set this=%~1
set /a !this!_width=%~2
set /a !this!_height=%~3
set !this!_default_char=%~4
set !this!#draw=call:#$canvas_proto_draw !this!
for /L %%i in (1, 1, !%this%_height!) do (
for /L %%j in (1, 1, !%this%_width!) do (
set !this!_point[%%j][%%i]=!%this%_default_char!
set !this!_row[%%i]=!%this%_row[%%i]!!%this%_point[%%j][%%i]!
)
)
!x!
:#$Canvas_proto_draw
set this=%~1
for /L %%i in (1, 1, !%this%_height!) do (
for /L %%j in (1, 1, !%this%_width!) do (
set !this!_row[%%i]=!%this%_row[%%i]!!%this%_point[%%j][%%i]!
)
)
for /L %%i in (1, 1, !%this%_height!) do (
echo !%this%_row[%%i]!
)
!x!
我的問題:給它1, 1
會導致點出了通過頂行大致半山腰。我不知道爲什麼會發生這種情況,需要幫助。我梳理了echo的所有輸出,並且_canvas_point[1][1]
的值在更新上的值爲#
。
這裏是輸出:
C:\Home>canvas 1 1
................#...............
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
C:\Home>
Here是一種以具有@echo on
快速事物的輸出引擎收錄鏈接: 是的,這是在批處理文件 面向對象編程一個微弱的嘗試是的,我知道其他語言對這種事情更好,我只是想用批處理文件來做 是的,我有奇怪的文體選擇與名稱和標籤等。這樣我就可以更好地閱讀它,看到標籤用於goto位置和功能標籤。
謝謝,尋求幫助。我明白,這種方法沒有多大意義,但謝謝你的幫助:) – Bmofa