0

なぜこれが機能するのですか?

set /a num = %random% %% 5 + 1

if %num% == 1 set map=cs_assault
if %num% == 2 set map=cs_italy
if %num% == 3 set map=cs_office
if %num% == 4 set map=de_aztec
if %num% == 5 set map=de_bank

srcds -game csgo -port 27016 -console +game_type 0 +game_mode 0 +mapgroup mg_casual +map %map%

しかし、これはそうではありませんか?

set /a num = %random% %% 5 + 1

if %num% == 1 set map = cs_assault
if %num% == 2 set map = cs_italy
if %num% == 3 set map = cs_office
if %num% == 4 set map = de_aztec
if %num% == 5 set map = de_bank

srcds -game csgo -port 27016 -console +game_type 0 +game_mode 0 +mapgroup mg_casual +map %map%

私はこれに頭を悩ませているようには見えません。

4

1 に答える 1

2

2番目の例は、「map」ではなく「map」という変数を作成し、
「de_mapname」ではなく「de_mapname」という値を作成しているためです。

だからあなたが変わるとしたら

srcds -game csgo -port 27016 -console +game_type 0 +game_mode 0 +mapgroup mg_casual +map %map%

srcds -game csgo -port 27016 -console +game_type 0 +game_mode 0 +mapgroup mg_casual +map %map %

それ以外の場合は機能しますが、変数はありませんmap

于 2013-02-10T00:19:05.163 に答える