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

Author Topic: lerning how to do output  (Read 5353 times)

0 Members and 1 Guest are viewing this topic.

Ädamas

    Topic Starter


    Beginner

    Thanked: 1
    lerning how to do output
    « on: July 15, 2009, 04:12:17 AM »
    i have a programs that saves it's information as editable files and i want to know how to output info to a txt file repeatably.one of the tasks i am trying to do is to output
    Code: [Select]

    Planet
    Name "test part"
    Radius 0.25
    Mass 0
    Position %corrx%,%corry%,%corrz%
    Velocity 0,0,0
    Locked 0
    HasRings 0
    Orientation 1,1,6
    Color 255,0,0
    LightSource 0

    to the end of a save file.i want the values of %corrx%,%corry% and %corrz% to go up by a certain amount each time it loops until they reach a certain value.they only problem is that i get "ECHO IS OFF." on blank lines (which i need between each planet) and that the indents of some of the lines are tabs.BTW can you give me a few tips as to how to set up my own reapt output batch files because i have a few other programs that save stuff to editable files as well
    you're just jealous because the voices talk to me, and not you.

    macdad-



      Expert

      Thanked: 40
      Re: lerning how to do output
      « Reply #1 on: July 15, 2009, 06:43:04 AM »
      For the blank lines try this(use a period right after echo for a good refrence line):
      Code: [Select]
      echo. >> output.txtTabs aren't possible in Batch so multiple spaces will have to be used:
      Code: [Select]
      echo.     Name     "test part">>output.txt
      I'll try to whip up a script for it


      Hope this helps
      ,Nick(macdad-)

      If you dont know DOS, you dont know Windows...

      Thats why Bill Gates created the Windows NT Family.

      devcom



        Apprentice

        Thanked: 37
        Re: lerning how to do output
        « Reply #2 on: July 15, 2009, 08:40:45 AM »
        @mac
        here i used tabs

        Code: [Select]
        @echo off
        echo.1 test
        echo.Test sdasd
        echo.qwerty1 1
        pause

        output

        1       test
        Test    sdasd
        qwerty1 1
        Press any key to continue . . .
        Download: Choice.exe

        macdad-



          Expert

          Thanked: 40
          Re: lerning how to do output
          « Reply #3 on: July 16, 2009, 04:28:44 PM »
          Ehh..I think its probably just me, the tabs dont work well but oh well.
          If you dont know DOS, you dont know Windows...

          Thats why Bill Gates created the Windows NT Family.

          Ädamas

            Topic Starter


            Beginner

            Thanked: 1
            Re: lerning how to do output
            « Reply #4 on: July 17, 2009, 03:24:30 AM »
            i can now get it to come out half right but i cant figure out how to get it to loop a certain amount of times
            you're just jealous because the voices talk to me, and not you.

            macdad-



              Expert

              Thanked: 40
              Re: lerning how to do output
              « Reply #5 on: July 18, 2009, 08:56:06 AM »
              This is what I have so far:
              Code: [Select]
              @echo off
              echo.Planet Catalog > output.txt
              for %%a in (Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto) do (
               echo. >> output.txt
               echo.Planet >> output.txt
               echo. Name "%%a" >> output.txt
               if %%a equ Mercury echo. Radius     9 >> output.txt
               if %%a equ Venus echo. Radius     2 >> output.txt
               if %%a equ Earth echo. Radius     5 >> output.txt
               if %%a equ Mars echo. Radius     456 >> output.txt
               if %%a equ Jupiter echo. Radius     4 >> output.txt
               if %%a equ Uranus echo. Radius     45 >> output.txt
               if %%a equ Neptune echo. Radius     4 >> output.txt
               if %%a equ Pluto echo. Radius     5 >> output.txt
              )
              echo done
              pause

              The radius numbers are just examples, and the Coordinate Loop for each planet's coordinates is going to have to be done one by one.

              ,Nick(macdad-)
              If you dont know DOS, you dont know Windows...

              Thats why Bill Gates created the Windows NT Family.

              devcom



                Apprentice

                Thanked: 37
                Re: lerning how to do output
                « Reply #6 on: July 18, 2009, 11:06:06 AM »
                Quote
                i want the values of %corrx%,%corry% and %corrz% to go up by a certain amount each time it loops until they reach a certain value

                Code: [Select]
                @echo off

                set maxx=10
                set maxy=35c
                set maxz=30

                set addx=1
                set addy=6
                set addz=3

                set skipx=0
                set skipy=0
                set skipz=0

                :LOOP
                if not %skipx% equ 1 (
                set /a corx+=%addx%
                )

                if not %skipy% equ 1 (
                set /a cory+=%addy%
                )

                if not %skipz% equ 1 (
                set /a corz+=%addz%
                )

                if %corx% geq %maxx% set skipx=1
                if %cory% geq %maxy% set skipy=1
                if %corz% geq %maxz% set skipz=1

                echo.X = %corx% Y = %cory% Z = %corz%

                if %skipx% equ 1 if %skipy% equ 1 if %skipz% equ 1 goto FIN
                goto LOOP

                :FIN
                pause

                output
                Code: [Select]
                X = 1   Y = 6   Z = 3
                X = 2   Y = 12  Z = 6
                X = 3   Y = 18  Z = 9
                X = 4   Y = 24  Z = 12
                X = 5   Y = 30  Z = 15
                X = 6   Y = 36  Z = 18
                X = 7   Y = 36  Z = 21
                X = 8   Y = 36  Z = 24
                X = 9   Y = 36  Z = 27
                X = 10  Y = 36  Z = 30
                Press any key to continue . . .

                post code here so we can see whats wrong
                Download: Choice.exe