Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Scripting Help2  (Read 2855 times)

0 Members and 1 Guest are viewing this topic.

wowmaniac123

    Topic Starter


    Rookie

    Scripting Help2
    « on: December 22, 2009, 10:26:12 PM »
    Im trying to create a game in batch. I am beginning to get worried since many of my scripts seem to not be working. Can cmd break?
    Quote
    @echo off
    pause
    if exist Level.txt. goto cash
    echo 1.0>Level.txt
    :cash
    if exist Cash.txt. goto eng
    echo 500>Cash.txt
    :eng
    if exist Energy1.txt. goto eng2
    echo 10>Energy1.txt
    :eng2
    if exist Energy2.txt. goto exp
    echo 10>Energy2.txt
    :exp
    if exist exp1.txt. goto exp2
    echo 0.0>exp1.txt
    :exp2
    if exist exp2.txt. goto start
    echo 10>exp2.txt
    :start
    set /p Lev= <Level.txt
    set /p Cash= <Cash.txt
    set /p eng1= <Energy1.txt
    set /p eng2= <Energy2.txt
    set /p exp1= <exp1.txt
    set /p exp2= <exp2.txt
    cls
    echo Level %Lev%
    echo Experience %exp1% / %exp2%
    echo Money %Cash%
    echo Energy %eng1% / %eng2%
    echo Zach Wars
    echo ---------
    pause
    :Jobs
    cls
    echo Level %Lev%
    echo Experience %exp1% / %exp2%
    echo Money %Cash%
    echo Energy %eng1% / %eng2%
    echo Zach Wars
    echo ---------
    echo   Jobs
    echo.
    echo Mugging Job. 1 Exp. 200 Dollars. -1 Energy. Press 1 to Perform Job.
    set /p Job=
    if %Job%==1 goto mug
    echo This is an incorrect Selection
    pause
    goto Jobs
    :mug
    if %eng1%>0 goto mug1
    echo Not enough energy to perform Job
    pause
    goto Jobs
    :mug1
    echo %eng1%-1>Energy1.txt
    echo %Cash%+200>Cash.txt
    echo %exp1%+1>exp1.txt
    echo Job Completed
    pause
    if %exp1%>%exp2% goto lvup
    goto Jobs
    :lvup
    set Lev=%Lev%+1
    set exp1=0
    set exp2=%exp2%+1
    set eng1=%eng2%
    set eng2=%eng2%+1
    echo Congrats! You have leveled up!
    pause
    goto Jobs

    ghostdog74



      Specialist

      Thanked: 27
      Re: Scripting Help2
      « Reply #1 on: December 22, 2009, 11:16:24 PM »
      batch is not really used for creating games or programming in general.

      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Scripting Help2
      « Reply #2 on: December 23, 2009, 06:47:12 AM »
      When adding or subtracting integers in batch, use SET /A. Example:

      set /a varname+=1
      set /a var2=%varname%^2/40
      You can use brackets, as you normally would. Note:
      +=addition
      -=subtraction
      *=multiplication
      /=division
      ^=exponent
      ?=roots. I don't know this one.
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      Salmon Trout

      • Guest
      Re: Scripting Help2
      « Reply #3 on: December 23, 2009, 07:47:59 AM »

      ?=roots. I don't know this one.

      Don't know where you got that from. According to the SET help, viewed by typing SET /? at the prompt they are

      Code: [Select]
          ()                  - grouping
          ! ~ -               - unary operators
          * / %               - arithmetic operators
          + -                 - arithmetic operators
          << >>               - logical shift
          &                   - bitwise and
          ^                   - bitwise exclusive or
          |                   - bitwise or
          = *= /= %= += -=    - assignment
            &= ^= |= <<= >>=
          ,                   - expression separator


      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Scripting Help2
      « Reply #4 on: December 23, 2009, 09:13:41 AM »
      Don't know where you got that from. According to the SET help, viewed by typing SET /? at the prompt they are

      I put the question mark because I didn't know.
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.