1.

Solve : lerning how to do output?

Answer»

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 wellFor 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-)

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 . . .
Ehh..I THINK its probably just me, the tabs dont work well but oh well.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 timesThis 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-) 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


Discussion

No Comment Found