Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Enter The Nuke - A Textbased Batch-Game (V1.0.1)

Working on Version 1.0.2 - Publishing on 26.12.2016

[Image: enterthenukeflyer_1_web_qumgx8.jpg]

Copyright/Terms and Conditions.
Spoiler (Click to View)



Version 1.0.1 UPLOADED!
Code@GitHub!

Just played it It's pretty nice for a game written in batch I haven't looked at the code though.
I watched the code and seems pretty cool, I'll try it as soon as possible. Good job man.
(Aug 2, 2015 04:34 AM)Sanch Wrote:  Just played it It's pretty nice for a game written in batch I haven't looked at the code though.

Thx man 😁

(Aug 2, 2015 05:12 AM)Alcatraz_ Wrote:  I watched the code and seems pretty cool, I'll try it as soon as possible. Good job man.

Thx :)
Trust is good, check is better ;)
Looks good some things you should look at. Try using choice instead of user input. The benefit to choice is the user can't select anything but valid responses.

Since you have user input selected, it's much easier to have the user press 1,2,3,or 4 rather than typing out Rusiaa. One other thing since your asking for typed input, you can tell if to ignore the case so you don't have to do the same.
Code
set /p country=Choose your country; USA, Germany, Russia, or Canada:
if '%country%'=='usa' goto enemy1
if '%country%'=='USA' goto enemy1
if '%country%'=='Usa' goto enemy1
if '%country%'=='Russia' goto enemy2
if '%country%'=='russia' goto enemy2
if '%country%'=='canada' goto enemy3
if '%country%'=='Canada' goto enemy3
if '%country%'=='Germany' goto enemy4
if '%country%'=='germany' goto enemy4

can be shortend to
Code
set /p country=Choose your country; USA, Germany, Russia, or Canada:
if /i '%country%'=='usa' goto enemy1
if /i '%country%'=='russia' goto enemy2
if /i '%country%'=='canada' goto enemy3
if /i '%country%'=='germany' goto enemy4

since I brought up choice I'll give you an example. Notice that the %errorlevel% refers to the user's selection so selecting the first item is errorlevel 1.
/C give the list of valid selections, /N says don't display valid selections /M is the message you want to display.
Code
@echo off
echo Type '1' Singleplayer
echo Type '2' two player
echo Type '3' changelog
echo.
choice /c 123 /N /M "Make a selection"
if %errorlevel%==1 echo Singleplayer selected
if %errorlevel%==2 echo Two Player selected
if %errorlevel%==3 echo Changelog selected
pause

fun fact: if you want a yes or no you can leave choice as default. Y or N is the default choices
Code
echo Continue?
choice
if %errorlevel%==1 echo you chose yes
if %errorlevel%==2 echo you chose no

One more thing. Avoid using ping localhost to add delay into your script. Use timeout instead. The benefit here is your not requesting the computer do stuff that is completely unrelated to what you are trying to accomplish. Also, it can be skipped by the user or not depending on the switch you use.

example:
Code
title Loading ...
cls
echo.
echo loading Noobmode ...
timeout 1 /nobreak >nul
echo Noobmode loaded
timeout 1 >nul
goto gameplay

One last thing, though it is a bit advanced, you should look into using functions. In this case you have a long list of commands executed one after the other. The right way to do it in batch as well as any programming/scripting language is to create callable functions to do the work. This way the main loop is short but calls more advanced things to happen.

see below for a short example to wet your appetite.
Code
@echo off
call :hello
pause
exit

:hello
echo Hello World!
rem exit /b returns to where the function was called from.
exit /b

to make it a little more advanced you can add arguments to your functions.
Code
@echo off
set /p word=set the second word:
rem the word after the call is an argument.
call :hello %word%
pause
exit

rem the <word2> isn't necessary but it helps to show you that there is an argument for this.
:hello <word2>
rem %1 refers to the first argument.
set a=%1
echo hello %a%
exit /b
There's no place like ~/
(Aug 2, 2015 09:21 AM)b00st3d Wrote:  See one above...

Thx man for spending time for me :D
The last 3 things were really helpful and i dont knew them :>

Hope we can stay in contact :)


When i programmed it there was a error if i only hat 'russia' and i putted 'Russia' in... so may it works now :)


Searching good Batch programmer.
Contact me via PM for more informations about other projects :)
Just ran the program but there is a sight issue with when your picking a country how would you pick it? as you can't just type it in or click it.
(Aug 2, 2015 05:29 PM)Grinders Wrote:  Just ran the program but there is a sight issue with when your picking a country how would you pick it? as you can't just type it in or click it.

I'll fix it in a minute...


-=SEARCHING FOR TESTER=- Pls contact me with PM
this game is very good thank you bro ^_^
Good effort Heacian :>

And Qwerty.. such fur... cats impressed. :>
(Aug 6, 2015 06:24 AM)annikk.exe Wrote:  Good effort Heacian :>

And Qwerty.. such fur... cats impressed. :>

Thx man :D play well, cats ftw:>
Nice job the game is great
Nice work. I might get into batch soon after I finish learning web dev, and learn from your code.
The patch code is gone :(


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 223 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Python] by Py_DevMay 6, 2025 12:14 PM 4 282 May 6, 2025 12:14 PM
Last Post: Py_Dev
[Shell] by fisica638Oct 30, 2019 11:05 AM 1 536 Oct 30, 2019 11:05 AM
Last Post: Hackoo