|
zzybq
初级用户
 
积分 36
发帖 22
注册 2009-9-12 来自 厦门
状态 离线
|
『楼 主』:
[讨论]游戏脚本的写法
使用 LLM 解释/回答一下
小弟想写一个游戏的脚本,不知道从那开始。请高手指点,应该从哪些方面入手,大体的步骤是什么?谢谢
Little brother wants to write a game script, don't know where to start. Please ask the expert for guidance, which aspects should start with, what is the general step? Thanks
|
|
2009-9-18 22:22 |
|
|
zzybq
初级用户
 
积分 36
发帖 22
注册 2009-9-12 来自 厦门
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
自己顶一个,请高手指点一下
Bump it myself, please ask the experts for guidance
|
|
2009-9-18 23:05 |
|
|
sl543001
中级用户
  
积分 499
发帖 225
注册 2008-12-30
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
@ECHO OFF
COLOR F2
TITLE SYBN#
setlocal ENABLEDELAYEDEXPANSION
mode con cols=35 lines=10
SET M=●&SET N=○&SET K=·
: BEGAIN
SET WZ=22&SET XX=%M%&SET XZ=%M%&SET WIN=%K%&SET XZ2=%N%&set sl=0
for /l %%a in (-20,1,59) do (
SET K%%a=%K%
)
: xz
if %sl% gtr 8 set WIN=没有人&goto win
CALL :XX
IF %XZ% == %M% (
CALL :LZ
) ELSE (
CALL :LZ
)
CALL :YZ
IF %P% == ERR GOTO XZ
SET XZ3=%XZ%
SET XZ=%XZ2%
SET XZ2=%XZ3%
IF NOT %WIN% == %K% GOTO WIN
GOTO XZ
: WIN
CLS
call :XX
ECHO %win%胜利!
PAUSE
GOTO BEGAIN
:LZ
SET /P P=%XZ%:
IF "%P%" == "" SET LZ=22
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,3) do (
if %p% == %%a%%b SET LZ=%P%&set wz=%p%&goto :eof
)
)
if "%p%" == "cmd" %p%
if %p% == "0" GOTO BEGAIN
if %p% == 1 SET LZ=31&set wz=31&goto :eof
if %p% == 2 SET LZ=32&set wz=32&goto :eof
if %p% == 3 SET LZ=33&set wz=33&goto :eof
if %p% == 4 SET LZ=21&set wz=21&goto :eof
if %p% == 5 SET LZ=22&set wz=22&goto :eof
if %p% == 6 SET LZ=23&set wz=23&goto :eof
if %p% == 7 SET LZ=11&set wz=11&goto :eof
if %p% == 8 SET LZ=12&set wz=12&goto :eof
if %p% == 9 SET LZ=13&set wz=13&goto :eof
set lz=22
GOTO :EOF
:YZ
SET P=0
set q=!K%LZ%!
IF NOT %q% == %K% SET P=ERR&GOTO :EOF
set /a sl=sl+1
SET K%LZ%=%XZ%
call :yz2 1
call :yz2 9
call :yz2 10
call :yz2 11
goto :eof
:yz2
set o=%1
SET /A P1=LZ-2*o&SET /A P2=LZ-1*o&SET /A P3=LZ&SET /A P4=LZ+1*o&SET /A P5=LZ+2*o
set q=!K%p1%!!K%p2%!!K%p3%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
set q=!K%p2%!!K%p3%!!K%p4%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
set q=!K%p3%!!K%p4%!!K%p5%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
GOTO :EOF
:XX
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,4) do (
set H%%b%%a=─
set S%%a%%b=│
)
)
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,3) do (
set /a a=%%a+1&set /a b=%%b+1
IF %WZ% == %%a%%b SET H%%a%%b=━&SET H!a!%%b=━&SET S%%a%%b=┃&SET S%%a!b!=┃
)
)
CLS
ECHO ┌%H11%┬%H12%┬%H13%┐ 可以直接输入坐标
ECHO %S11%%K11%%S12%%K12%%S13%%K13%%S14% 左上为11,右下为33
ECHO ├%H21%┼%H22%┼%H23%┤ 也可以按照小键盘的
ECHO %S21%%K21%%S22%%K22%%S23%%K23%%S24% 数字排列顺序控制
ECHO ├%H31%┼%H32%┼%H33%┤ 输入0从新开局
ECHO %S31%%K31%%S32%%K32%%S33%%K33%%S34% 输入无效则从新输入
ECHO └%H41%┴%H42%┴%H43%┘ QQ:354324773
GOTO :EOF
@ECHO OFF
COLOR F2
TITLE SYBN#
setlocal ENABLEDELAYEDEXPANSION
mode con cols=35 lines=10
SET M=●&SET N=○&SET K=·
:BEGAIN
SET WZ=22&SET XX=%M%&SET XZ=%M%&SET WIN=%K%&SET XZ2=%N%&set sl=0
for /l %%a in (-20,1,59) do (
SET K%%a=%K%
)
:xz
if %sl% gtr 8 set WIN=Nobody&goto win
CALL :XX
IF %XZ% == %M% (
CALL :LZ
) ELSE (
CALL :LZ
)
CALL :YZ
IF %P% == ERR GOTO XZ
SET XZ3=%XZ%
SET XZ=%XZ2%
SET XZ2=%XZ3%
IF NOT %WIN% == %K% GOTO WIN
GOTO XZ
:WIN
CLS
call :XX
ECHO %win%Wins!
PAUSE
GOTO BEGAIN
:LZ
SET /P P=%XZ%:
IF "%P%" == "" SET LZ=22
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,3) do (
if %p% == %%a%%b SET LZ=%P%&set wz=%p%&goto :eof
)
)
if "%p%" == "cmd" %p%
if %p% == "0" GOTO BEGAIN
if %p% == 1 SET LZ=31&set wz=31&goto :eof
if %p% == 2 SET LZ=32&set wz=32&goto :eof
if %p% == 3 SET LZ=33&set wz=33&goto :eof
if %p% == 4 SET LZ=21&set wz=21&goto :eof
if %p% == 5 SET LZ=22&set wz=22&goto :eof
if %p% == 6 SET LZ=23&set wz=23&goto :eof
if %p% == 7 SET LZ=11&set wz=11&goto :eof
if %p% == 8 SET LZ=12&set wz=12&goto :eof
if %p% == 9 SET LZ=13&set wz=13&goto :eof
set lz=22
GOTO :EOF
:YZ
SET P=0
set q=!K%LZ%!
IF NOT %q% == %K% SET P=ERR&GOTO :EOF
set /a sl=sl+1
SET K%LZ%=%XZ%
call :yz2 1
call :yz2 9
call :yz2 10
call :yz2 11
goto :eof
:yz2
set o=%1
SET /A P1=LZ-2*o&SET /A P2=LZ-1*o&SET /A P3=LZ&SET /A P4=LZ+1*o&SET /A P5=LZ+2*o
set q=!K%p1%!!K%p2%!!K%p3%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
set q=!K%p2%!!K%p3%!!K%p4%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
set q=!K%p3%!!K%p4%!!K%p5%!
if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF
GOTO :EOF
:XX
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,4) do (
set H%%b%%a=─
set S%%a%%b=│
)
)
for /l %%a in (1,1,3) do (
for /l %%b in (1,1,3) do (
set /a a=%%a+1&set /a b=%%b+1
IF %WZ% == %%a%%b SET H%%a%%b=━&SET H!a!%%b=━&SET S%%a%%b=┃&SET S%%a!b!=┃
)
)
CLS
ECHO ┌%H11%┬%H12%┬%H13%┐ Can directly enter coordinates
ECHO %S11%%K11%%S12%%K12%%S13%%K13%%S14% Upper left is 11, lower right is 33
ECHO ├%H21%┼%H22%┼%H23%┤ Also can follow the numeric keypad
ECHO %S21%%K21%%S22%%K22%%S23%%K23%%S24% number arrangement control
ECHO ├%H31%┼%H32%┼%H33%┤ Enter 0 to start over
ECHO %S31%%K31%%S32%%K32%%S33%%K33%%S34% Invalid input will enter again
ECHO └%H41%┴%H42%┴%H43%┘ QQ:354324773
GOTO :EOF
|
|
2009-9-30 20:37 |
|
|
kirov
版主
        Pfc.YangZJ
积分 412
发帖 223
注册 2008-12-31 来自 上海杨浦
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
这个貌似是批处理室的范畴吧?
This seems to be within the scope of the batch processing room, right?
|

以牙还牙,加倍奉还。
----BH4EAW 杨志杰
Blog:我的blog |
|
2009-9-30 22:22 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
3楼的玩起来可以窝~
大改的话可以缩的
It's fun to play on the 3rd floor~ If it's a major modification, it can be made more compact.
|

综合型编程论坛
我的作品索引 |
|
2009-10-1 09:41 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
本来看了这个帖想做一个跑车越过障碍游戏的
只做了一部分,看到屏幕一直闪,我就没什么兴趣了
@echo off
if "%1"=="go" (goto :input) else (start %~s0 go)
mode con cols=20 lines=15
title running~ &setlocal enabledelayedexpansion
for /l %%a in (1,1,12) do (set way%%a=## ##)
for /l %%a in (1,3,12) do (set way%%a=!way%%a:#= !)
set wayb1=%way2%
set wayb2=%way1%
set wayb3=%way2%
set "che7=oiio"
set "che8= ## "
set "che9=O##O"
set /a fa=13
:la
set /a fb=fa-1,act=0
for /l %%a in (%fa%,1,12) do (set /a act+=1 &set ln!act!=!way%%a!)
for /l %%b in (1,1,%fb%) do (set /a act+=1 &set ln!act!=!way%%b!)
::
for %%a in (7,8,9) do (set ln%%a=!ln%%a:~0,4!!che%%a!!ln%%a:~8!)
ping -n 1 127.1>nul
cls
for /l %%a in (1,1,12) do (echo, ║!ln%%a!║)
if %fa% gtr 1 (set /a fa-=1) else (set /a fa=12)
set /a cut=fa,new=cut%%3+1
set way%cut%=!wayb%new%!
goto :la
:input
mode con cols=20 lines=3
set /p inp="输入:"
Last edited by 523066680 on 2009-10-1 at 09:47 ]
I originally wanted to make a game where a sports car jumps over obstacles after seeing this post. I only did part of it, and since the screen kept flashing, I lost interest.
@echo off
if "%1"=="go" (goto :input) else (start %~s0 go)
mode con cols=20 lines=15
title running~ &setlocal enabledelayedexpansion
for /l %%a in (1,1,12) do (set way%%a=## ##)
for /l %%a in (1,3,12) do (set way%%a=!way%%a:#= !)
set wayb1=%way2%
set wayb2=%way1%
set wayb3=%way2%
set "che7=oiio"
set "che8= ## "
set "che9=O##O"
set /a fa=13
:la
set /a fb=fa-1,act=0
for /l %%a in (%fa%,1,12) do (set /a act+=1 &set ln!act!=!way%%a!)
for /l %%b in (1,1,%fb%) do (set /a act+=1 &set ln!act!=!way%%b!)
::
for %%a in (7,8,9) do (set ln%%a=!ln%%a:~0,4!!che%%a!!ln%%a:~8!)
ping -n 1 127.1>nul
cls
for /l %%a in (1,1,12) do (echo, ║!ln%%a!║)
if %fa% gtr 1 (set /a fa-=1) else (set /a fa=12)
set /a cut=fa,new=cut%%3+1
set way%cut%=!wayb%new%!
goto :la
:input
mode con cols=20 lines=3
set /p inp="输入:"
Last edited by 523066680 on 2009-10-1 at 09:47 ]
|

综合型编程论坛
我的作品索引 |
|
2009-10-1 09:43 |
|
|
sl543001
中级用户
  
积分 499
发帖 225
注册 2008-12-30
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
俺发的井字游戏没有AI
不是俺没有写,而是还在写,目前的AI就是按自己的水平,正在研究更好的AI算法!
The Tic - Tac - Toe game I posted doesn't have an AI. It's not that I didn't write it, but that I'm still writing it. The current AI is based on my own level, and I'm researching better AI algorithms!
|
|
2009-10-1 09:57 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
额额 额额……
偶很难想像 井字的,一般做到绝就是双方平手了
除非本机先下,我记得是有个两条路的路线,先占了那个点就可以了。
但是做到绝的话就是平手了。so……
Last edited by 523066680 on 2009-10-1 at 10:03 ]
Uh-huh Uh-huh……
I can hardly imagine that for Tic-Tac-Toe, generally the best result is a draw between the two sides.
Unless the local machine goes first, I remember there is a route with two paths, and if you occupy that point first, it's okay.
But achieving the best result means a draw. So……
Last edited by 523066680 on 2009-10-1 at 10:03 ]
|

综合型编程论坛
我的作品索引 |
|
2009-10-1 09:58 |
|
|
sl543001
中级用户
  
积分 499
发帖 225
注册 2008-12-30
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
我是利用穷举法,那两条路,以及所有夹角线全部考虑进去了!
现在研究的是让脚本像算象棋一样,计算所有可能后输出结果,貌似有点复杂!
===========================================
关于赛车:由于脚本运算速度低下,必须想办法提高
可以考虑输出txt文本然后TYPE,但估计效果不太好
还可以吧n行输出的内容存放到同一个变量里,一次性echo(利用行尾添加^符号给变量赋值多行文本)
最后,最好的建议是把画面倒过来,也就是车从上向下开,这样每次只要输出一行,但要把游戏里的车尽量放到title中
I have considered all those two paths and all the angle lines using the brute-force method!
Now the research is about making the script calculate like playing chess, calculating all possibilities and then outputting the result. It seems a bit complicated!
===========================================
Regarding the racing game: Since the script operation speed is low, we must find a way to improve it.
We can consider outputting a txt text and then TYPE, but it is estimated that the effect is not very good.
We can also store the content output by n lines into the same variable, and echo it all at once (using the ^ symbol at the end of the line to assign multiple lines of text to the variable).
Finally, the best suggestion is to invert the screen, that is, the car drives from top to bottom. In this way, only one line needs to be output each time, but the car in the game should be placed in the title as much as possible.
|
|
2009-10-1 10:11 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
想仔细哦,路可以这样,但是车子本身的位置……
而且最终目的是为了车子可移动,刷屏是必然了,刷屏不好,不做了。
Think carefully, the path can be like this, but the position of the car itself... And the ultimate goal is to make the car movable,刷屏 is inevitable,刷屏 is not good, not doing it.
|

综合型编程论坛
我的作品索引 |
|
2009-10-1 10:44 |
|
|
sl543001
中级用户
  
积分 499
发帖 225
注册 2008-12-30
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
吧cmd窗口调小试试,比如20*20字节,窗口小刷屏应该会快点
Try making the cmd window smaller, for example 20*20 bytes. A smaller window should make screen refreshing faster.
|
|
2009-10-1 11:44 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
|
2009-10-1 12:22 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
而是想办法重新把光标回到1.1后
哇你叫我们看整个1000字符大的数据……
非Cls怎么回到坐标1.1后,说下。
额 我看了一下你后面的说明,是不是 用 str储存了整个屏幕的信息
然后一个echo就可以了?
Last edited by 523066680 on 2009-10-1 at 15:20 ]
But trying to find a way to get the cursor back to position 1,1 again
Wow, you want us to look at 1000 characters of data...
How to get back to coordinate 1,1 without using Cls, please explain.
Uh, I looked at your subsequent explanation, did you store the entire screen information in str, and then just an echo would work?
Last edited by 523066680 on 2009-10-1 at 15:20 ]
|

综合型编程论坛
我的作品索引 |
|
2009-10-1 15:18 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
|
2009-10-1 23:08 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
|
2009-10-2 09:34 |
|