English help wanted batch file expert

7 replies
Goto Page
To the start Previous 1 Next To the start
17.07.10 08:05:23 pm
Up
ab6100
User
Offline Off
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
-AB6100 Scripter in tranning
17.07.10 08:25:28 pm
Up
archmage
User
Offline Off
Hm a text based rpg with batch. Never heard of such, but good luck with it. I don't know much in batch except commands, but maybe this will help you.
We must secure the existence of our people and a future for white children. 14/88
17.07.10 09:01:56 pm
Up
Flacko
User
Offline Off
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%
18.07.10 06:56:47 pm
Up
ab6100
User
Offline Off
@ 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 : (
-AB6100 Scripter in tranning
19.07.10 01:10:59 am
Up
Flacko
User
Offline Off
File 1:
Code:
1
2
@echo off
start file2.bat 5


File 2:
Code:
1
echo %1%


Output has written:
5


So instead of start file2.bat 5 you can write start file2.bat %gold%
20.07.10 03:05:16 pm
Up
ab6100
User
Offline Off
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?
-AB6100 Scripter in tranning
20.07.10 03:46:19 pm
Up
Flacko
User
Offline Off
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
22.07.10 09:37:24 pm
Up
ab6100
User
Offline Off
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
-AB6100 Scripter in tranning
To the start Previous 1 Next To the start