Forum

> > Off Topic > help wanted batch file expert
Forums overviewOff Topic overviewLog in to reply

English help wanted batch file expert

7 replies
To the start Previous 1 Next To the start

old help wanted batch file expert

ab6100
User Off Offline

Quote
hi.......

im ab6100
im trying to make a text baced rpg useing batch and im looking for anyone who can help with a problem

what im trying to do is read a varable from another batch file so like

file 1 has the varable %gold%=100
and file 2 needs to know how much %gold% is worth.

ps. i'll post a link on thes thread when its finished

old Re: help wanted batch file expert

Flacko
User Off Offline

Quote
You can call your second file with that value as a parameter.

start yourfile.bat yourvalue

Then from your second file you can access that value by using %1%

old Re: help wanted batch file expert

ab6100
User Off Offline

Quote
@ dark byte thank you

@ Flacko a little bit more info on that would be helpful
i tryed what you sed but i couldnt get it to work : (

old Re: help wanted batch file expert

Flacko
User Off Offline

Quote
File 1:
1
2
@echo off
start file2.bat 5

File 2:
1
echo %1%

Output has written
5


So instead of start file2.bat 5 you can write start file2.bat %gold%

old Re: help wanted batch file expert

ab6100
User Off Offline

Quote
ooohhh...
thank you

ok... now one more question?

how do i permintaly change a varable

like in my script
lvl=1
and i lvl up
how do i save that as lvl=2 with out going into the batchfile?

old Re: help wanted batch file expert

Flacko
User Off Offline

Quote
set lvl=1
set /A lvl=lvl+1>nul

That's how you level up.
The >nul thing just prevents the command from echoing the new value of lvl.
For more info start cmd and type set/?
edited 1×, last 20.07.10 04:15:51 pm

old Re: help wanted batch file expert

ab6100
User Off Offline

Quote
ya but that dosent purmently change the varable in the batch file

Well-- i ofical gave up on this for a wile... but now im up and makeing it agan i put it up when it had 5-10 maps made then ill post map packs.
edited 1×, last 22.01.11 06:46:54 pm
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview