所以我創建有很多變量的比賽,但我希望用戶既可以限制進入和/或到了一定地點或面積取決於設置的變量。
調用批處理和檢查值:批處理文件總是崩潰,但腳本似乎還好
我有,你可以去寫上去的所有地方,但出於某種原因,似乎是我無法識別某些語法錯誤。下面是一個例子,但是我在整個遊戲中有很多細微的變化,這取決於你已經殺死了什麼實體或者你在哪裏設置了你的家鄉。
我得到一個錯誤信息,但該程序關閉的方式太快了,我看它說什麼。我試圖錄制「崩潰」,並放慢了視頻速度,但圖像質量並不是最好的。 「spawn0不被識別」的東西,我假設它與語法有關。
有幾個變量檢查器可以工作,比如在允許你進入城堡之前檢查你的角色等級(見下面)。
set /p cit1=
if %cit1% EQU 1 GOTO citadellvlcheck
if %cit1% EQU 2 GOTO SAVE_GAME_FILES_Masafkel
GOTO CIT_WARN
:citadellvlcheck
if %curlvl% LSS 50 GOTO citadellvlreq
if %curlvl% GEQ 50 GOTO entercitadel
:citadellvlreq
@echo off
color 0F
cls
echo.
echo You must be level 50 or higher to enter the citadel.
pause > nul
GOTO MasafkelMenu-XC
但因爲我不能產卵檢查工作,或MasafkelMenu-XC作爲一個用戶登錄到遊戲中工作,儘快,它瞬間崩潰。創建用戶也是如此。你設置你的用戶名,密碼,遊戲內電子郵件(以防萬一你忘記了密碼),性別甚至物種;但之後立即崩潰,甚至沒有創建字符批處理文件。以下是一些例子。
:SpawnCheck
@echo off
Title Adrynia
Color 0F
cls
call %name1%.bat
if %spawn%=spawn0 GOTO SpawnMenu0
if %spawn%=spawn1 GOTO SpawnMenu0
if %spawn%=spawn2 GOTO SpawnMenu0
if %spawn%=spawn3 GOTO SpawnMenu0
if %spawn%=spawn4 GOTO SpawnMenu0
if %spawn%=spawn5 GOTO SpawnMenu0
if %spawn%=spawn6 GOTO SpawnMenu0
if %spawn%=spawn7 GOTO SpawnMenu0
if %spawn%=spawn8 GOTO SpawnMenu0
if %spawn%=spawn9 GOTO SpawnMenu0
if %spawn%=Groylle GOTO GroylleMenu
if %spawn%=Meprophia GOTO MeprophiaMenu
if %spawn%=HermitHut GOTO HermitHutMenu
if %spawn%=Masafkel GOTO MasafkelMenu-XC
if %spawn%=Crounver GOTO CrounverMenu
if %spawn%=Bobeindahl GOTO BobeindahlMenu
if %spawn%=Krontay GOTO KrontayMenu
if %spawn%=Slinguss GOTO SlingussMenu
if %spawn%=Tichyster GOTO TichysterMenu
if %spawn%=Houjing GOTO HoujingMenu
if %spawn%=flat1 GOTO FlatMenu1
if %spawn%=flat2 GOTO FlatMenu2
if %spawn%=flat3 GOTO FlatMenu3
if %spawn%=flat4 GOTO FlatMenu4
if %spawn%=flat5 GOTO FlatMenu5
if %spawn%=flat6 GOTO FlatMenu6
if %spawn%=flat7 GOTO FlatMenu7
if %spawn%=flat8 GOTO FlatMenu8
if %spawn%=flat9 GOTO FlatMenu9
if %spawn%=flat10 GOTO FlatMenu10
if %spawn%=house1 GOTO HouseMenu1
if %spawn%=house2 GOTO HouseMenu2
if %spawn%=house3 GOTO HouseMenu3
if %spawn%=house4 GOTO HouseMenu4
if %spawn%=house5 GOTO HouseMenu5
if %spawn%=house6 GOTO HouseMenu6
if %spawn%=house7 GOTO HouseMenu7
if %spawn%=house8 GOTO HouseMenu8
if %spawn%=house9 GOTO HouseMenu9
if %spawn%=house10 GOTO HouseMenu10
GOTO Error
:MasafkelMenu-XC
@echo off
color 0f
cls
call %name1%.bat
if %Criunthma%=0 GOTO MasafkelMenu
if %Criunthma%=1 GOTO Masafkel-CD
GOTO Error
如果無法做到在批處理文件中這樣的事那就這樣吧,但是如果有可能,我想至少給我最好的嘗試。
所以,比遊戲是一個基於文本的遊戲以外,玩家使用他/她的想象力,以創造遊戲世界的美好感覺在他們身邊,因此希望提升遊戲體驗;我也喜歡用這個遊戲來學習新技能的編碼和測試批處理腳本和我的小,但批量MS-DOS和批處理腳本的逐漸增加知識的侷限性。
現在,當我在cmd中運行一些測試時,顯示如下:「Artemis.bat」不被識別爲內部或外部命令,可操作程序或批處理文件。 = spawn0在這個時候是意外的。無論您選擇用戶名是什麼,這都出現了,但是,當它自己運行時,它僅表示「= spawn0此時不是預期的」。
我不明白%spawnpoint%= spawn0無法被識別,或者可能是意想不到的,因爲字符在創建時得到了一個指定的後備點(在:CHAR_DATA)當你第一次創建一個字符時:CHAR_DATA指定您產卵名爲「spawnpoint;但如果你設置了家鄉,或買一個房子或者一個單位,那麼你的重生將被設置爲城鎮或房子/平代替,所以,當你開始遊戲,你將開始在
:CHAR_DATA
set acc1g=0
set acc1m=Open
set acc2g=0
set acc2m=Open
set acc3g=0
set acc3m=Open
set acc4g=0
set acc4m=Open
set acc5g=0
set acc5m=Open
set cost=
set cost1=
set gcho=
set echo=
set e2cho=
set e1=
set armour=30
set origarmour=30
set Cyrax=0
set Fregwin=0
set Zeschka=0
set Agnorr=0
set Grehln=0
set Meiqa=0
set Lothin=0
set Skatha=0
set Triffyn=0
set Glieza=0
set Areya=0
set Exin=0
set Yewvar=0
set Smuggler=0
set Qwaen=0
set Oracle=0
set Antharr=0
set Cadell=0
set Rhyghan=0
set Helori=0
set Chaerron=0
set Cyntheyrr=0
set Mureh=0
set Llaellyn=0
set Bechim=0
set Brathach=0
set Albreqi=0
set Tausir=0
set Mivrailoksh=0
set Khaen=0
set Criunthma=0
set Vunada=0
set VT=0
set VC=G
set ls1=0
set killcount=0
set ttlbosskill=0
set ttlmonstkill=0
set ttlkills=0
set goodness=0
set evilness=0
set morality=neutral
set ls2=0
set la1=0
set la2=0
set orighp=100
set hp=100
set origsp=25
set sp=25
set armtype=None
set swordtype=Your
set skind=hand
set buyword1=hi
set buyword2=hi
set curlvl=1
set aan=a
set bankqharri=0
set destination=SAVE_GAME_FILES1
set destination2=SAVE_GAME_FILES1
set swordchoice=Nothing
set swordchoice2=Nothing
set swordchoice3=Nothing
set swordexist=Nothing
set rent=0
set sprice=0
set armchoice=No
set armchoice2=Amour
set aprice=0
set playerxp=0
set xpuntil=1000
set origxp=0
set money=0
set platos=0
set lovana=0
set credits=0
set key=0
set dmge=10
set origdmge=10
set dr=0
set spawn=spawn0
set rests=0
set sleep=100
set rochtain=0
set beer=0
set wine=0
set spirits=0
set naeprahv=0
set drunk=0
set ID=0
set day=42
set week=5
set month=12
set year=73734
set status=alive
set gmail=0
set hbone=0
set dhide=0
set rtab=0
set food=0
set cigarette=0
set seaweed=0
set weedcig=0
set rfood=0
set bait=0
set ea=None
set potion=0
set copperingot=0
set ironingot=0
set steelingot=0
set bronzeingot=0
set brassingot=0
set tiningot=0
set silveringot=0
set goldingot=0
set zincingot=0
set manganeseingot=0
set aluminiumingot=0
set chromiumingot=0
set nickelingot=0
set refinedcopper=0
set refinediron=0
set refinedtin=0
set refinedsilver=0
set refinedgold=0
set refinedzinc=0
set refinedmanganese=0
set refinedaluminium=0
set refinedsilicon=0
set refinedchromium=0
set refinednickel=0
set seed=0
set bow=0
set fur=0
set gem=0
set log=0
set wood=0
set copperore=0
set ironore=0
set tinore=0
set silverore=0
set goldore=0
set zincore=0
set manganeseore=0
set aluminiumore=0
set siliconore=0
set chromiumore=0
set nickelore=0
set morb=0
set arm1=0
set arm2=0
set arm3=0
set arm4=0
set arm5=0
set arm6=0
set arm7=0
set arm8=0
set arm9=0
set arm10=0
set arm11=0
set arm12=0
set ma1=0
set ma2=0
set ma3=0
set ma4=0
set ma5=0
set ma6=0
set ma7=0
set ma8=0
set ma9=0
set ma10=0
set ms1=0
set ms2=0
set ms3=0
set ms4=0
set ms5=0
set ms6=0
set ms7=0
set ms8=0
set ms9=0
set ms10=0
set sword1=0
set sword2=0
set sword3=0
set sword4=0
set sword5=0
set sword6=0
set sword7=0
set sword8=0
set sword9=0
set sword10=0
set sword11=0
set sword12=0
set axxx=0
set pgmail=300
set phbone=550
set pdhide=750
set prtab=250
set ppotion=200
set pfood=100
set pingot=473
set pseed=150
set prfood=100
set pbait=2
set pfur=200
set pore=500
set plog=275
set pgem=500
set pbow=713
set pmorb=15000
set Woodcuttinglvl=1
set Woodcuttingxpremain=5000
set Woodcuttingxpgain=20
set Woodcuttingcurxp=0
set Woodcuttingxpleft=5000
set Cooklvl=1
set Cookxpremain=5000
set Cookxpgain=50
set Cookcurxp=0
set Cookxpleft=5000
set Fishinglvl=1
set Fishingxpremain=5000
set Fishingxpgain=50
set Fishingcurxp=0
set Fishingxpleft=5000
set Mininglvl=1
set Miningxpremain=5000
set Miningxpgain=50
set Miningcurxp=0
set Miningxpleft=100
set Smeltinglvl=1
set Smeltingxpremain=5000
set Smeltingxpgain=50
set Smeltingcurxp=0
set Smeltingxpleft=5000
set Thievinglvl=1
set Thievingxpremain=10000
set Thievingxpgain=25
set Thievingcurxp=0
set Thievingxpleft=10000
set ttllvl=13
set prestige=0
set maxprestige=NO
GOTO SpawnCheck
您的產卵。以上是用於設置字符日誌文件,下面的代碼是用來保存當前正在使用的字符日誌文件中的當前變量。
:SAVE_GAME_FILES1
(
echo set username1=%username1%
echo set password1=%password1%
echo set mailver=%mailver%
echo set species=%species%
:CHAR_DATA
echo set acc1g=%acc1g%
echo set acc1m=%acc1m%
echo set acc2g=%acc2g%
echo set acc2m=%acc2m%
echo set acc3g=%acc3g%
echo set acc3m=%acc3m%
echo set acc4g=%acc4g%
echo set acc4m=%acc4m%
echo set acc5g=%acc5g%
echo set acc5m=%acc5m%
echo set cost1=%cost1%
echo set cost=%cost%
echo set gcho=%gcho%
echo set echo=%echo%
echo set e2cho=%e2cho%
echo set e1=%e1%
echo set armour=%armour%
echo set origarmour=%origarmour%
echo set Cyrax=%Cyrax%
echo set Fregwin=%Fregwin%
echo set Zeschka=%Zeschka%
echo set Agnorr=%Agnorr%
echo set Grehln=%Grehln%
echo set Meiqa=%Meiqa%
echo set Lothin=%Lothin%
echo set Skatha=%Skatha%
echo set Triffyn=%Triffyn%
echo set Glieza=%Glieza%
echo set Areya=%Areya%
echo set Exin=%Exin%
echo set Yewvar=%Yewvar%
echo set Smuggler=%Smuggler%
echo set Qwaen=%Qwaen%
echo set Oracle=%Oracle%
echo set Antharr=%Antharr%
echo set Cadell=%Cadell%
echo set Rhyghan=%Rhyghan%
echo set Helori=%Helori%
echo set Chaerron=%Chaerron%
echo set Cyntheyrr=%Cyntheyrr%
echo set Mureh=%Mureh%
echo set Llaellyn=%Llaellyn%
echo set Bechim=%Bechim%
echo set Brathach=%Brathach%
echo set Albreqi=%Albreqi%
echo set Tausir=%Tausir%
echo set Mivrailoksh=%Mivrailoksh%
echo set Khaen=%Khaen%
echo set Criunthma=%Criunthma%
echo set Vunada=%Vunada%
echo set VT=%VT%
echo set VC=%VC%
echo set ls1=%ls1%
echo set killcount=%killcount%
echo set ttlbosskill=%ttlbosskill%
echo set ttlmonstkill=%ttlmonstkill%
echo set ttlkills=%ttlkills%
echo set goodness=%goodness%
echo set evilness=%evilness%
echo set morality=%morality%
echo set ls2=%ls2%
echo set la1=%la1%
echo set la2=%la2%
echo set orighp=%orighp%
echo set hp=%hp%
echo set origsp=%origsp%
echo set sp=%sp%
echo set armtype=%armtype%
echo set swordtype=%swordtype%
echo set skind=%skind%
echo set buyword1=%buyword1%
echo set buyword2=%buyword2%
echo set curlvl=%curlvl%
echo set aan=%aan%
echo set bankqharri=%bankqharri%
echo set destination=SAVE_GAME_FILES1
echo set destination2=SAVE_GAME_FILES1
echo set swordchoice=Nothing
echo set swordchoice2=Nothing
echo set swordchoice3=Nothing
echo set swordexist=Nothing
echo set rent=%rent%
echo set sprice=%sprice%
echo set armchoice=%armchoice%
echo set armchoice2=%armchoice2%
echo set aprice=%aprice%
echo set playerxp=0
echo set xpuntil=1000
echo set origxp=%origxp%
echo set money=%money%
echo set platos=%platos%
echo set lovana=%lovana%
echo set ruflarii=%ruflarii%
echo set credits=%credits%
echo set key=%key%
echo set dmge=%dmge%
echo set origdmge=%origdmge%
echo set dr=%dr%
echo set spawn=%spawn%
echo set rests=%rests%
echo set sleep=%sleep%
echo set rochtain=%rochtain%
echo set beer=%beer%
echo set wine=%wine%
echo set spirits=%spirits%
echo set naeprahv=%naeprahv%
echo set drunk=%drunk%
echo set ID=%ID%
echo set day=%week%
echo set week=%week%
echo set month=%month%
echo set year=%year%
echo set status=%status%
echo set gmail=%gmail%
echo set hbone=%hbone%
echo set dhide=%dhide%
echo set rtab=%rtab%
echo set food=%food%
echo set cigarette=%cigarette%
echo set seaweed=%seaweed%
echo set weedcig=%weedcig%
echo set rfood=%rfood%
echo set bait=%bait%
echo set ea=%ea%
echo set potion=%potion%
echo set copperingot=%copperingot%
echo set ironingot=%ironingot%
echo set steelingot=%steelingot%
echo set bronzeingot=%bronzeingot%
echo set brassingot=%brassingot%
echo set tiningot=%tiningot%
echo set silveringot=%silveringot%
echo set goldingot=%goldingot%
echo set zincingot=%zincingot%
echo set manganeseingot=%manganeseingot%
echo set aluminiumingot=%aluminiumingot%
echo set chromiumingot=%chromiumingot%
echo set nickelingot=%nickelingot%
echo set refinedcopper=%refinedcopper%
echo set refinediron=%refinediron%
echo set refinedtin=%refinedtin%
echo set refinedsilver=%refinedsilver%
echo set refinedgold=%refinedgold%
echo set refinedzinc=%refinedzinc%
echo set refinedmanganese=%refinedmanganese%
echo set refinedaluminium=%refinedaluminium%
echo set refinedsilicon=%refinedsilicon%
echo set refinedchromium=%refinedchromium%
echo set refinednickel=%refinednickel%
echo set seed=%seed%
echo set bow=%bow%
echo set fur=%fur%
echo set gem=%gem%
echo set log=%log%
echo set wood=%wood%
echo set copperore=%copperore%
echo set ironore=%ironore%
echo set tinore=%tinore%
echo set silverore=%silverore%
echo set goldore=%goldore%
echo set zincore=%zincore%
echo set manganeseore=%manganeseore%
echo set aluminiumore=%aluminiumore%
echo set siliconore=%siliconore%
echo set chromiumore=%chromiumore%
echo set nickelore=%nickelore%
echo set morb=%morb%
echo set arm1=%arm1%
echo set arm2=%arm2%
echo set arm3=%arm3%
echo set arm4=%arm4%
echo set arm5=%arm5%
echo set arm6=%arm6%
echo set arm7=%arm7%
echo set arm8=%arm8%
echo set arm9=%arm9%
echo set arm10=%arm10%
echo set arm11=%arm11%
echo set arm12=%arm12%
echo set ma1=%ma1%
echo set ma2=%ma2%
echo set ma3=%ma3%
echo set ma4=%ma4%
echo set ma5=%ma5%
echo set ma6=%ma6%
echo set ma7=%ma7%
echo set ma8=%ma8%
echo set ma9=%ma9%
echo set ma10=%ma10%
echo set ms1=%ms1%
echo set ms2=%ms2%
echo set ms3=%ms3%
echo set ms4=%ms4%
echo set ms5=%ms5%
echo set ms6=%ms6%
echo set ms7=%ms7%
echo set ms8=%ms8%
echo set ms9=%ms9%
echo set ms10=%ms10%
echo set sword1=%sword1%
echo set sword2=%sword2%
echo set sword3=%sword3%
echo set sword4=%sword4%
echo set sword5=%sword5%
echo set sword6=%sword6%
echo set sword7=%sword7%
echo set sword8=%sword8%
echo set sword9=%sword9%
echo set sword10=%sword10%
echo set sword11=%sword11%
echo set sword12=%sword12%
echo set axxx=%axxx%
echo set pgmail=%pgmail%
echo set phbone=%phbone%
echo set pdhide=%pdhide%
echo set prtab=%prtab%
echo set ppotion=%ppotion%
echo set pingot=%pingot%
echo set pfood=%pfood%
echo set prfood=%prfood%
echo set pbait=%pbait%
echo set pseed=%pseed%
echo set pfur=%pfur%
echo set pore=%pore%
echo set pbow=%pbow%
echo set plog=%plog%
echo set pgem=%pgem%
echo set pmorb=%pmorb%
echo set Woodcuttinglvl=%Woodcuttinglvl%
echo set Woodcuttingxpremain=%Woodcuttingxpremain%
echo set Woodcuttingxpgain=%Woodcuttingxpgain%
echo set Woodcuttingcurxp=%Woodcuttingcurxp%
echo set Woodcuttingxpleft=%woodcuttingxpleft%
echo set Cooklvl=%Cooklvl%
echo set Cookxpremain=%Cookxpremain%
echo set Cookxpgain=%Cookxpgain%
echo set Cookcurxp=%Cookcurxp%
echo set Cookxpleft=%Cookxpleft%
echo set Fishinglvl=%Fishinglvl%
echo set Fishingxpremain=%Fishingxpremain%
echo set Fishingxpgain=%Fishingxpgain%
echo set Fishingcurxp=%Fishingcurxp%
echo set Fishingxpleft=%Fishingxpleft%
echo set Mininglvl=%Mininglvl%
echo set Miningxpremain=%Miningxpremain%
echo set Miningxpgain=%Miningxpgain%
echo set Miningcurxp=%Miningcurxp%
echo set Miningxpleft=%Miningxpleft%
echo set Smeltinglvl=%Smeltinglvl%
echo set Smeltingxpremain=%Smeltingxpremain%
echo set Smeltingxpgain=%Smeltingxpgain%
echo set Smeltingcurxp=%Smeltingcurxp%
echo set Smeltingxpleft=%Smeltingxpleft%
echo set Thievinglvl=%Thievinglvl%
echo set Thievingxpremain=%Thievingxpremain%
echo set Thievingxpgain=%Thievingxpgain%
echo set Thievingcurxp=%Thievingcurxp%
echo set Thievingxpleft=%Thievingxpleft%
echo set ttllvl=%ttllvl%
echo set prestige=%prest%
echo set maxprestige=%maxprest%
)>%username1%.bat
GOTO SpawnCheck
在節中的記錄似乎是罰款,但爲了以防萬一,下面是該代碼。
:login
cls
set /p name1="Username: "
if not exist "%name1%.bat" (
echo.
echo That is not a valid Username.
timeout /T 3 > nul
GOTO entergame1
)
set /p pass1="Password: "
call %name1%.bat
if %password1% NEQ %pass1% (
echo.
echo That is not a valid Password, please enter your in-game email.
timeout /T 3 > nul
GOTO emailver
)
GOTO SAVE_GAME_FILES1
:emailver
cls
echo.
set /p mailver="In-game Email: "
call %name1%.bat
if %mailver% NEQ %mailver% (
echo.
echo That is not a valid in-game email address.
timeout /T 3 > nul
cls
GOTO entergame1
)
GOTO SAVE_GAME_FILES1
字符生成器部分也似乎是功能性的,但只要它進入:SpawnCheck崩潰。
:createuser
@echo off
Title Adrynia
color 0F
cls
echo.
echo What would you like your Username to be?
set /p username1=
set v1f=0
:checkforspaces
set x=!v1f!
set Letter%v1f%=!username1:~%x%,1!
if "!Letter%v1f%!" EQU " " (
echo.
echo.
echo Sorry, you cant use spaces in your Username.
pause > nul
GOTO createuser
)
if NOT "!Letter%v1f%!" EQU "" (
set /a v1f=%v1f%+1
GOTO checkforspaces
)
echo.
echo What would you like your Password to be?
set /p password1=
echo.
echo What would you like your in-game email to be? (This will be used as secondary login/verification option).
set /a rpc=1
set /p mailver=
GOTO choosespecies2
:choosespecies2
@echo off
Title Adrynia
color 0F
cls
echo.
echo What species would you like to be?
echo.
echo 1) Adrynian
echo 2) Bryniskan
echo 3) Cruvoshnian
echo 4) Gangloidian
echo 5) Human
echo 6) Hybrid
echo 7) Sehyapov
echo.
set /p input=
if %input% EQU 1 set species=Adrynian && GOTO CHAR_DATA
if %input% EQU 2 set species=Bryniskan && GOTO CHAR_DATA
if %input% EQU 3 set species=Cruvoshnian && GOTO CHAR_DATA
if %input% EQU 4 set species=Gangloidian && GOTO CHAR_DATA
if %input% EQU 5 set species=Human && GOTO CHAR_DATA
if %input% EQU 6 set species=Hybrid && GOTO CHAR_DATA
if %input% EQU 7 set species=Sehyapov && GOTO CHAR_DATA
GOTO choosespecies2
目前,只有在發生錯誤的地方是:SpawnCheck和:Masafkel-XC,但我一直在代碼的其他部分顯示,以防萬一有任何其他的錯誤,可能會導致我目前的問題。
我明白批量腳本編碼是一種古老形式 - 特別是對於RPG風格的遊戲 - 但任何幫助或更正,和/或信息,爲什麼這可能是這樣的,將不勝感激。謝謝。
你將不得不張貼在「崩潰」一些細節你得到一個錯誤信息?你有任何可以檢查的日誌文件嗎?我建議批處理可能不是最好的語言。你有沒有考慮過HTA? https://en.wikipedia.org/wiki/HTML_Application這是一個古老的技術,但至少你有一個用戶界面。 –
...比添加一些jQuery,你有一個大片。這裏有一個圖書館看起來優化RPG的:http://www.jqueryrain.com/2015/12/rpg-js-rpg-2d-browser-with-html5-canvas/ –
謝謝。我確實收到一條錯誤消息,但程序過快關閉,無法閱讀它所說的內容。我試圖錄制「崩潰」,並放慢了視頻速度,但圖像質量並不是最好的。 「spawn0不被識別」的東西,我假設它與語法有關。不幸的是,我沒有任何日誌文件。 至於批量怎麼可能不是最好的編碼語言......是的,我知道,並且明白它是非常古老的,但我的遊戲圍繞着它是一個批處理遊戲的事實。 –