.BAT文件故障Minecraft效果发生器

时间:2014-11-13 23:40:42

标签: windows batch-file windows-7 command

我的代码是


    @echo off
    color a
    title Minecraft Effect Generator
    mode con: cols=114 lines=40
    :1
    cls
    echo -----------------------------------------------------------------------------------------------------------------
    echo                                            Minecraft Effect Generator
    echo -----------------------------------------------------------------------------------------------------------------
    echo /effect "USERNAME" "EFFECT ID" "TIME LASTS" "LEVEL"
    echo [ E  ] EXIT           - EXIT THE MINECRAFT EFFECT GENERATOR
    set /p "MCUsername=Username: "
    IF MCUsername==e exit
    IF MCUsername==E exit
    :2
    cls
    echo -----------------------------------------------------------------------------------------------------------------
    echo                                            Minecraft Effect Generator
    echo -----------------------------------------------------------------------------------------------------------------
    echo /effect %MCUsername% "EFFECT" "TIME" "LEVEL"
    echo [ 1  ] SPEED           - RUN FASTER  BY 20% EACH LEVEL
    echo [ 2  ] SLOWNESS        - RUN SLOWER  BY 15% EACH LEVEL
    echo [ 3  ] HASTE           - MINE FASTER BY 20% EACH LEVEL
    echo [ 4  ] MINING FATIGUE  - MINE SLOWER BY 20% EACH LEVEL
    echo [ 5  ] STRENGTH        - HIT HARDER  BY 130% EACH LEVEL
    echo [ 6  ] INSTANT HEALTH  - PLAYER GETS 4 ()() HEALTH . UNDEAD MOBS TAKE 6 ()()() DAMAGE -- DOUBLES BY EACH LEVEL
    echo [ 7  ] INSTANT DAMAGE  - PLAYER TAKES 6 ()()() HEALTH . UNDEAD MOBS TAKE 6 ()()() DAMAGE -- DOUBLES BY EACH LEVEL
    echo [ 8  ] JUMP BOOST      - JUMP HIGHER 1/2 BLOCK . REDUCES FALL DAMAGE BY 1 ( DAMAGE ON LEVEL 1 
    echo [ 9  ] NAUSEA          - WOBBLES AND WARPS THE SCREEN . LEVEL DOES NOT EFFECT THIS EFFECT
    echo [ 10 ] REGENERATION    - REGENERATE 1 HEART ( PER 50 TICKS . EACH LEVEL CUTS THE TIME IN HALF (ROUNDED)
    echo [ 11 ] RESISTANCE      - RESIST BY 20% EACH LEVEL
    echo [ 12 ] FIRE RESISTANCE - IMMUNITY
    echo [ 13 ] WATER BREATHING - PREVENTS AIR BAR FROM DECREASING WHILE UNDERWATER . SLIGHTLY INCREASES SIGHT UNDER WATER
    echo [ 14 ] INVISIBLILTY    - MAKES PLAYER DISAPPEAR . MOBS WILL NOT ATTACK PLAYER / MOB UNLESS TOUCHED
    echo [ 15 ] BLINDNESS       - PLAYER SEES BLACK FOG . PREVENTS SPRINTING AND CRITICAL HITS . LEVEL DOES NOT EFFECT
    echo [ 16 ] NIGHT VISION    - INCREASES LIGHT LEVEL TO PLAYER TO 15 EVERYWHERE . DOES NOT AFFECT OTHER PLAYERS / MOBS
    echo [ 17 ] HUNGER          - ADDS 0.025 FOOD EXHAUSTION PER TICK EACH LEVEL
    echo [ 18 ] WEAKNESS        - MINUS 0.5 DAMAGE DEALT EACH LEVEL
    echo [ 19 ] POISON          - DEALS 1 ( DAMAGE EVERY 25 TICKS UNTIL PLAYER HAS 1 HEART LEFT . EA LV CUTS TIME IN HALF
    echo [ 20 ] WITHER          - DEALS 1 ( DAMAGE EVERY 40 TICKS AND CAN KILL PLAYERS / MOBS . EA LV CUTS TIME IN HALF
    echo [ 21 ] HEALTH BOOST    - ADDS 4 ()() BASE HEALTH PER LEVEL AND VANISHES WHEN EFFECT ENDS
    echo [ 22 ] ABSORBATION     - ADDS 4 ()() NON REGENERATEABLE HEALTH PER LEVEL AND VANISHES WHEN EFFECT ENDS
    echo [ 23 ] SATURATION      - REGENERATES 1 FOOD PER LEVEL
    echo [ E  ] EXIT           - EXIT THE MINECRAFT EFFECT GENERATOR
    set /p "effect=Effect ID: "
    IF effect==e exit
    IF effect==E exit
    :3
    cls
    echo ----------------------------------------------------------------------------------------------------------------
    echo                                            Minecraft Effect Generator
    echo ----------------------------------------------------------------------------------------------------------------
    echo /effect %MCUsername% %effect% "TIME" "LEVEL"
    echo [ U  ] UNLIMITED TIME - NEVER-ENDING EFFECT
    echo.
    echo [ E  ] EXIT           - EXIT THE MINECRAFT EFFECT GENERATOR
    set /p "time=Time: "
    IF time==e exit
    IF time==E exit
    IF time==u set /a "time=100000"
    IF time==U set /a "time=100000"
    :3
    cls
    echo ----------------------------------------------------------------------------------------------------------------
    echo                                            Minecraft Effect Generator
    echo ----------------------------------------------------------------------------------------------------------------
    echo /effect %MCUsername% %effect% %time% "LEVEL"
    echo LEVEL IS 1 - 255
    echo [ E  ] EXIT           - EXIT THE MINECRAFT EFFECT GENERATOR
    set /p "level=Time: "
    IF level==e exit
    IF level==E exit
    :end
    cls
    echo ----------------------------------------------------------------------------------------------------------------
    echo                                            Minecraft Effect Generator
    echo ----------------------------------------------------------------------------------------------------------------
    echo YOUR COMMAND IS:
    echo /effect %MCUsername% %effect% %time% %level%
    echo TYPE THIS INTO YOUR CHAT TO WORK
    echo [ C  ] COPY TO CLIPBOARD
    echo [ B  ] GO BACK AND TRY AGAIN
    echo.
    echo [ E  ] EXIT
    set /p "end=>"
    IF end==e exit
    IF end==E exit
    IF end==c echo /effect %MCUsername% %effect% %time% %level%| clip $goto end
    IF end==C echo /effect %MCUsername% %effect% %time% %level%| clip &goto end
    IF end==b goto 1
    IF end==B goto 1
    goto end
基本上它会生成一个命令。它似乎在:end出现故障。输入似乎不起作用。我怎样才能解决这个问题?我的电脑是不工作还是代码闪闪发光? 顺便说一句:我正在运行Windows 7 x64
感谢您阅读本文!

1 个答案:

答案 0 :(得分:1)

你有很多错误。

首先显而易见的是,您有两个标签:3,但这与您提出的问题无关。

IF end==e exit
IF end==E exit

end永远不能等于e。您需要end %end%内容 - 在整个代码中重复出现类似问题。

if语句允许/i开关使比较不区分大小写。

IF /i "%end%"=="e" exit

就足够了。注意参数是“引用的”。这为某些输入字符提供了一些保护(因为输入是cmd未经审查的),这可能导致cmd出现问题 - 例如hello there等输入。此方案改善输入处理,但它 防弹。