Board logo

标题: 第一次用WBAT写的自制综合光盘游戏主菜单:,与大家共勉 [打印本页]

作者: GOTOmsdos     时间: 2005-4-13 00:00    标题: 第一次用WBAT写的自制综合光盘游戏主菜单:,与大家共勉
第一次用WBAT写的自制综合光盘游戏主菜单:,与大家共勉
(可直接用光盘启动后自动运行,解决了WBAT程序好象不能在光盘运行,天汇与鼠标冲突,仙剑奇侠传只允许内存32MB之内等等问题.不用硬盘,自动把光盘游戏复制到内存盘玩,非常流畅,玩完可再回游戏主菜单.经多次测试,最后成功!)
@ECHO OFF
PROMPT $P$G
path a:\
tw32 /np >nul
ctmouse /u >nul
ctmouse /n >nul
cls
wbat box @%0:sound
if errorlevel 2 goto start
set blaster=a220 i5 d1 h5 p330
set sbpci=z:\sound
xcopy %romcd%\sound z:\sound\ /e /s
z:\sound\sbinit
goto start
:sound "您要加载声卡驱动吗?"
本光盘配有通用的 Sound Blaster (创新) 声卡驱动文件
如果您电脑的声卡兼容创新,一般会成功加载驱动,但如果
不兼容并强制加载驱动,很可能不成功甚至出现死机或噪音
等现象。如不清楚,建议查看一下您的声卡说明书。

:
:studio
木鸢工作室 羊城苑
2003-2005 Copyright TM reserved
:
:ls " 想玩哪一个? "














:
:query "您知道内存容量吗?"
要玩这个游戏,程序需要知道您的
电脑的内存容量来调整到适合游戏
运行的内存限度否则可能无法运行。

:
:mem "内存多大?"
32
64
96
128
160
192
224
256
288
320
352
384
416
448
480
512
:
:start
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "寻趣乐园等您好久了!" 继续...
if errorlevel 100 goto nogame
set ?=0
:ask
wbat box 游戏选单,不想玩了
if errorlevel 100 goto nogame
if errorlevel 2 goto nogame
rem if errorlevel 1 go on
:game
call w.bat box 4,12 @%0:ls #%?%+1
if errorlevel 100 goto nogame
if "%wbat%"=="f" goto pal
if "%wbat%"=="g" goto playcd
if "%wbat%"=="i" goto playcd
:play
wbat cls
xcopy %romcd%\%wbat% z:\%wbat%\ /e /s
cd\%wbat%
call play.bat
cd\wbat
goto start
:playcd
%romcd%
cd\%wbat%
call play.bat
z:
cd\wbat
goto start
:pal
wbat box 5,10 (cyan on brown) @%0:query
if errorlevel 100 goto game
if errorlevel 3 goto game
if errorlevel 2 goto play
call w.bat list 20,65 @%0:mem
if errorlevel 100 goto pal
if "%wbat%"=="32" goto 32
set memmb=%wbat%
goto term
:32
wbat cls
xcopy %romcd%\f z:\f\ /e /s
cd\f
call play.bat
cd\wbat
goto start

:nogame
wbat box DOS,重启,关机
if errorlevel 100 goto ask
if errorlevel 3 goto off
if errorlevel 2 goto reboot
goto final
:reboot
reboot
<img src="images/smilies/face-surprise.png" align="absmiddle" border="0">ff
off
:term
againram.bat
:final
wbat cls


作者: Wengier     时间: 2005-4-14 00:00
看了上面的文件,有幾個問題想提一下。一是關於聲卡驅動,其實SBINIT衹支持創新的SB PCI 16/128/512和SB Audigy聲卡,對於創新的其它聲卡,如PCI的SB PCI 64V、SB Live!等等,以及ISA的所有聲卡均不支持(當然,至於其它非創新的聲卡就更不用說了)。所以我總覺得“本光盘配有通用的创新声卡驱动文件”這句話好像有點說不過去,應該改一下才好。再就是關於“內存多大”的問題,其實我覺得並沒有必要問這個問題,而是應該用程序去自動檢測才好,比如我上次在論壇寫的那段批處理文件(那個批處理文件我在我的幾臺電腦上已試過,可以通過它來直接運行仙劍,而不用任何用戶乾預)。如果問這個問題的話一是麻煩,二是很多用戶買電腦並不一定知道自己的電腦的內存有多大(他們衹管能用就行,才不管硬件的具體參數呢),三是上面的列表中的數字很不全,容易造成問題(比如我的兩臺舊電腦都是48MB內存,就沒辦法選了)。如果用程序來自動檢測內存大小的話,則這些問題全都解決了,而且兼容性和通用性更強。最後謝謝您的分享,希望繼續努力使得它更加完善!

作者: GOTOmsdos     时间: 2005-4-21 00:00
谢谢关注! 我再考虑一下..
又加了一些功能: 比如,进入之前加了以登记入园形式的暗藏进入游戏的秘密通道选项,如果选的不对就进不了了...
保存游戏,(其中包括自己做的简易浏览器,供查看目录,,创建多层带间隔的长名目录),正在增加图形修改游戏进度...修改SKYROADS已成功...
下面帖出,供大家参考:
.主程序:
@ECHO OFF
PROMPT $P$G
path a:\
tw32 /np &gt;nul
ctmouse /u &gt;nul
ctmouse /n &gt;nul
lh doslfn
cls
rem :drv
rem get z "%cdrom1%" /w1
rem set takecd=%get%
rem get #e "C:,D:,E:,F:,G:,H:,I:,J:,K:,L:,M:,N:,,P:,Q:,R:,S:,T:,U:,V:,W:,X:,Y:" ''''%takecd%''''
rem set takedrv=%get%
set barpos=0
set saveyn=0
set name=
set year=
set book=
set stat=
set core=
set score=
set salary=
set gamedir=0
wbat box @%0:sound
cls
if errorlevel 2 goto test
set blaster=a220 i5 d1 h5 p330
set sbpci=z:\sound
xcopy %romcd%\sound z:\sound\ /e /s /y
z:\sound\sbinit
cls
if errorlevel 1 wbat box 加载失败!
goto test
:sound "您要加载声卡驱动吗?"
本光盘配有通用的 Sound Blaster (创新) 声卡驱动文件
如果您电脑的声卡兼容创新,一般会成功加载驱动,但如果
不兼容并强制加载驱动,很可能不成功甚至出现死机或噪音
等现象。如不清楚,建议查看一下您的声卡说明书。

:
:studio
~木鸢工作室~ 羊城苑
2003-2005 Copyright TM reserved
:
:reg "寻趣园面试台"
江湖绰号? (必填)
闯荡几个春秋了? (必填)
著作有几本了? 统计员论文有几篇了?

~核心~期刊论文有几篇了?

平均学生评分多少?
有~房~吗?
薪俸多高啊?
有~车~吗?
平时喜欢干啥?
看闲书
看电视
上网闲逛
~电脑游戏~玩疯了
逛街
到哥们儿那坐坐 ~佳人~伺候?
孑然一身?
:
:ls " 想玩哪一个? "














:
:query "您知道内存容量吗?"
要玩这个游戏,程序需要知道您的
电脑的内存容量来调整到适合游戏
运行的限度,否则可能无法运行。

:
:mem "内存多大?"
32
64
96
128
160
192
224
256
288
320
352
384
416
448
480
512
:
:fore "您将要在内存盘中玩"
现在已把该游戏从光盘复制到了内存盘,运行游戏期间您可以保存游戏进度
但重启电脑后就被清空,所以,如果在重启后要从保存的进度继续玩,就要
在结束该游戏后把它保存到硬盘(或其他介质),以后再运行本光盘选择从硬
盘运行该游戏(当然,您也可用其他方式运行保存的游戏)。
在您退出游戏后会出现询问您是否保存游戏的对话框。

:
:cheat "自欺欺人对话框"
track1 track16
track2 track17
track3 track18

track4 track19
track5 track20
track6 track21

track7 track22
track8 track23
track9 track24
track10 track25
track11 track26
track12 track27

track13 track28
track14 track29
track15 track30

:
:_save "保存游戏"
您可以改变下面的默认保存路径
我要保存到:

保存后我要试运行保存的游戏

:
:last


:
:test
call w.bat box 2,30 @%0:reg
if errorlevel 100 goto flee
if not "%name%"=="" if not "%year%"=="" if "%wrb%"=="2" goto start
wbat box 对不起,您面试没通过!再试试?
goto test
:flee
wbat box "想逃跑?" 逃吧,重来
if errorlevel 2 goto test
:_flee
wbat box DOS,重启,关机
if errorlevel 100 goto _flee
if errorlevel 3 off
if errorlevel 2 reboot
goto final
:start
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "寻趣园等您好久了!" 继续...
if errorlevel 100 goto nogame
:ask
wbat box 游戏选单,不想玩了
if errorlevel 100 goto nogame
if errorlevel 2 goto nogame
rem if errorlevel 1 go on
:game
call w.bat box 4,12 @%0:ls #%barpos%+1
set barpos=%?%
set oldgame=%gamedir%
if %wbat%==a set gamedir=skyroads
if %wbat%==b set gamedir=speedcar
if %wbat%==c set gamedir=wolf3d
if %wbat%==d set gamedir=doom
if %wbat%==e set gamedir=swda
if %wbat%==f set gamedir=pal
if %wbat%==g set gamedir=legend
if %wbat%==h set gamedir=sanguo
if %wbat%==i set gamedir=xiangqi
if %wbat%==j set gamedir=siguo
if %wbat%==k set gamedir=shoutan
if %wbat%==l set gamedir=huarong
if %wbat%==m set gamedir=test
if %wbat%==n set gamedir=car
if errorlevel 100 goto ask
if "%wbat%"=="f" goto pal
if "%wbat%"=="g" goto playcd
if "%wbat%"=="i" goto playcd
:play
wbat cls
if exist z:\%oldgame%\play.bat deltree /y z:\%oldgame% &gt;nul
xcopy %romcd%\%gamedir% z:\%gamedir%\ /e /s /y
wbat box @%0:fore
:seecheat
cd\%gamedir%
call play.bat
if "%run%"=="fail" wbat box 运行失败!
set run=
if not "%gamedir%"=="skyroads" goto played
cd\wbat
wbat box "要不劳而获吗?" 要,不要
if errorlevel 2 goto played
:zero
call prevar
:allmod
call w.bat box @%0:cheat
if errorlevel 4 goto played
if errorlevel 3 goto modgame
if errorlevel 2 goto zero
call allcheat
goto allmod
:modgame
call crackarg
wbat box "要重新运行游戏,看一下不劳而获的结果吗?" 看一下,不想看
if errorlevel 2 goto played
goto seecheat
:played
cd\wbat
if %saveyn%==%gamedir% goto start
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "保存该游戏吗?" 不保存,保 存
if errorlevel 100 goto start
if errorlevel 2 goto asksave
goto start
:asksave
rem set savedrv=c
set savedir=d:\%gamedir%
:savebox
wbat cls ! text 24,2 (red on blue) @%0:studio
call w.bat fix box @%0:_save
if errorlevel 100 goto start
if errorlevel 4 goto start
if errorlevel 3 goto chkput
if errorlevel 2 goto explore
wbat cls
if exist drive.txt del drive.txt
call finddisk.bat C: D: E: F: G: H: I: J: K: L: M: N: P: Q: R: S: T: U: V: W: X:
goto savebox
:explore
call miniexpl.bat
goto savebox

:chkput
rem wbat cls ! text 24,2 (red on blue) @%0:studio
get z "%savedir%" 1 &gt;nul
if "%get%"=="" goto two
if "%get%"==":" goto two
if "%get%"==":\" goto two
get z "%savedir%" 1 /w2 &gt;nul
if "%get%"==":\" goto copygame
wbat cls ! text 24,2 (red on blue) @%0:studio ! box 输入非法!
goto savebox
:two
get z "%savedir%" /w1
set savedir=%get%:

:copygame
wbat cls ! text 24,2 (red on blue) @%0:studio ! box "要显示待创建的文件夹吗?" yes,no
if errorlevel 2 goto chkdir
wbat box %savedir%
:chkdir
echo %savedir%|find "%gamedir%"&gt;nul
if errorlevel 1 goto gamename
set enddir=%savedir%
goto dirmake
:gamename
set enddir=%savedir%\%gamedir%

:dirmake
call multidir.bat
:tocopy
wbat cls
copy z:\%gamedir% "%enddir%" /y
if not exist %enddir%\play.bat goto savefail
echo %enddir%|find "swda" &gt;nul
if errorlevel 1 goto saveok

for %%a in (ba rx save vc) do md "%enddir%\%%a"
for %%a in (ba rx save vc) do copy z:\%gamedir%\%%a "%enddir%\%%a" /y
for %%a in (ba\ba49.rsk rx\ri079.rix save\save.zaq vc\sp135.voc) do if not exist %enddir%\%%a goto savefail

goto saveok
wbat cls ! text 24,2 (red on blue) @%0:studio
:savefail
wbat box 保存失败!
goto savebox
:saveok
set saveyn=%gamedir%
if "%wcb1%"=="0" goto start
get z "%enddir%" /w1 &gt;nul
%get%:
cd "%enddir%"
call play.bat
if "%run%"=="fail" wbat box 试运行失败!
set run=
z:
cd\wbat
goto start
:playcd
%romcd%
cd\%wbat%
call play.bat
z:
cd\wbat
goto start
:pal
wbat box 5,10 (cyan on brown) @%0:query
if errorlevel 100 goto game
if errorlevel 3 goto game
if errorlevel 2 goto play
call w.bat list 20,65 @%0:mem
if errorlevel 100 goto pal
if "%wbat%"=="32" goto 32
set memmb=%wbat%
goto term
:32
wbat cls
xcopy %romcd%\f z:\f\ /e /s /y
cd\f
call play.bat
cd\wbat
goto start

:nogame
wbat box (black on brown) @%0:last
if errorlevel 100 goto ask
if errorlevel 3 off
if errorlevel 2 reboot
goto final
:term
againram.bat
:final
wbat cls
被调用的:MINIEXPL.BAT (自制小浏览器)
FINDDISK.BAT 扫描驱动器
.......
....
@echo off
:loop
if "%1"=="" goto end
dir %1\ /w/ad | find "%1" &gt;nul
if not errorlevel 1 echo %1&gt;&gt;drive.txt
shift
goto loop
:end

MULTIDIR.BAT 创建多层长名目录
@echo off
set lfn=%enddir%
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto final
md "%lfn%"
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto final
:start
set pos=
set fore=%lfn%
set ahead=
:toleft
get # "%fore%" ''''\'''' /x
set pos=%get%
get z "%lfn%" %pos%
set ahead=%get%
get r "-" %pos% /w1
get z "%fore%" /w%get%
set fore=%get%
get z "%fore%" 1
dir "%fore%" /w/ad|find /i "%get%"
if not errorlevel 1 goto toright
goto toleft

:toright
if "%ahead%"=="" goto end
get # "%ahead%" ''''\''''
if "%get%"=="0" goto last
get r "+" %pos% /w%get%
set pos=%get%
get r "-" %pos% /w1
get z "%lfn%" /w%get%
set fore=%get%
get z "%lfn%" %pos%
set ahead=%get%

get z "%fore%" 1
dir "%fore%" /w/ad|find /i "%get%"
if not errorlevel 1 goto toright

md "%fore%"
goto toright
:last
md "%lfn%"

:end
get z "%lfn%" 1
dir "%lfn%" /w/ad|find /i "%get%"
if not errorlevel 1 goto ok
wbat box "folder creation FAIL !" retry,back
if errorlevel 2 goto final
goto start
<img src="images/smilies/face-surprise.png" align="absmiddle" border="0">k
wbat box "folder creation SUCCEEDED !" continue...
:final
修改小游戏进度:
@echo off
if exist crack del crack
echo n z:\skyroads\skyroads.cfg&gt;&gt;crack
echo l0&gt;&gt;crack
if "%1"=="" goto end
echo e 6 %1 00&gt;&gt;crack
set get=6
shift
:crack
if "%1"=="" goto end
get r "+" $%get% /w2 /h
echo e %get% %1 00&gt;&gt;crack
shift
goto crack
:end
echo rcx&gt;&gt;crack
echo 42&gt;&gt;crack
echo w0&gt;&gt;crack
echo q&gt;&gt;crack
debug&lt;crack
del crack



@echo off
crack %t1% %t2% %t3% %t4% %t5% %t6% %t7% %t8% %t9% %t10% %t11% %t12% %t13% %t14% %t15% %t16% %t17% %t18% %t19% %t20% %t21% %t22% %t23% %t24% %t25% %t26% %t27% %t28% %t29% %t30%
@echo off
for %%a in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do set t%%a=7


作者: GOTOmsdos     时间: 2005-4-21 00:00
最近做上面的东东,发现DOS好象不能嵌套多层变量,加了COMMAND /C 也没大用,顶多多显示一层比如, 有%VAR%=10,把VAR赋给%1,,,, 就不能用%%1%来取到10, 同理,SET VAR2=VAR, %%VAR%%也不能取到10,也就是说,如果想用另一个变量同时取到某个变量名本身及其值! 这样就不方便了,比如,我上边的修改游戏成绩:有很多对值,一对值就是两个项目(用变量描述,比如T1表示第一号赛道,%T1%表示通过的次数),加起来就是60变量!但通过一个%1解决不了.如下:把T1 T2 T3...用SHIFT赋给%1, 用%%1%取到值,但不能嵌套用FOR %%A IN (1 2 3 ....) DO CALL XXX T%%A %T%%A% 也不能嵌套所以,害的我要列出60个变量!!??

作者: GOTOmsdos     时间: 2005-4-21 00:00
发现XCOPY XXCOPY不支持带间隔的长文件名? 但COPY却可以! 不过不能复制子目录
怪不怪!
XCOPY16可以,也可以复制子目录,但好象可能出错
那个 ACOPY 也不行!
总的感觉,这个问题难解决,不知道有没有完满的程序?

作者: GOTOmsdos     时间: 2005-4-21 00:00
与上相关的另一个问题:好象 WBAT的输入区域 INPUT AREA没有序号吧? 害的我要再用变量.

作者: 9zhmke     时间: 2005-5-12 00:00
没用过WBAT,感觉功能太少了,还不如NDOS,以前我也发布过一个批处理做的菜单,应该比你这个要智能些吧。

作者: GOTOmsdos     时间: 2005-5-12 00:00
NDOS ?传上来试试

作者: 9zhmke     时间: 2005-5-12 00:00
已上传到这里: http://old.9zz.net/tmp/ndos.rar 里面有个game.bat 就是以前做的菜单,供你参考注:这个game.bat 要和NDOS的目录描述配合使用,给目录改上名字后自动调用。

作者: defrag     时间: 2005-7-9 00:00



用qb

str1$=environ$("变量名"<img src="images/smilies/face-wink.png" align="absmiddle" border="0">

environ("变量名=值"<img src="images/smilies/face-wink.png" align="absmiddle" border="0">

作者: 不得不爱     时间: 2005-12-8 11:33
ndos不支持FAT32呀