Computing Staff
  • 0

Using Skills In A Batch Rpg Game

  • 0

OK for some reason this code will not even work:

:prace
cls
echo Choose a race.
echo.
echo h)Human
echo e)Elf
echo o)Orc
set /p race=:
if %race% equ h set /a %str% equ 12
if %race% equ e set /a %wis% equ 13
if %race% equ o set /a %con% equ 14
if not %race% equ h goto prace
if not %race% equ e goto prace
if not %race% equ o goto prace

it needs to set str (strength) to 12 when you type h and hit enter
i have allredy set all of the skills to 0 at the start of the batch file.
but when i open it, it flashes “Missing opperator” at the bottom what do i do?

Share

3 Answers

  1. So pick up a real programming language! If you don’t believe me, listen to Raymond Chen, “[N]obody actually likes batch programming. You merely tolerate it.”

    C# is popular enough to have a lot of educational resources available, and its IDE will spoil you. You’ll need Win7/8 for VS 2012, but I think 2010 works with XP. It’s a language actively used by companies, and it’s free.
    http://www.microsoft.com/visualstud…

    Python’s pretty easy, and it has a lot of educational resources available. Its focus is on readability, and making your code readable is an important skill for any programmer. There might be a stronger Linux focus, but so it goes. It’s also free.
    http://www.python.org/getit/

    I’m trying to think up a good third language for newbie programmers, but I’m getting a blank. Web languages add several layers that a student probably doesn’t want to worry with; why learn one language when you can learn CSS, HTML, JavaScript, SQL, and PHP all at once! Besides, I’d avoid PHP just because the free online resources are horrible and will turn you into a horrible programmer. Avoid C, C++, and Objective-C; you should be learning the concepts of programming, not having to watch your memory.

    Honestly, you should probably feel around and pick a language you like and works well for you. What you should do is go and get a good book on programming, and use whatever language that book expects you to use. Just remember knowledge is valuable, so knowledge costs. You might want to check your local library and see if they have any books on the subject.
    http://www.barnesandnoble.com/s/pro…
    http://search.oreilly.com/?q=progra…
    http://www.amazon.com/Best-Sellers-…

    How To Ask Questions The Smart Way

    • 0
  2. Although I agree with the above
    :prace
    cls
    echo Choose a race.
    echo.
    echo h)Human
    echo e)Elf
    echo o)Orc
    set /p race=”:”
    if %race% equ h set /a str=12 && goto next
    if %race% equ e set /a wis=13 && goto next
    if %race% equ o set /a con=14 && goto next
    echo Sorry that is not an option. Please try again
    goto prace
    :next

    it might be helpful to check the syntax on set /a
    http://ss64.com/nt/set.html

    • 0
  3. nickmon what do i do?
    Pick a real language. C# is free and easy. You could even make your game graphical! VBScript is bundled with Windows. Write it as an HTA, and you can even make your game graphical!

    How To Ask Questions The Smart Way

    • 0