1.

Solve : Some more questions.?

Answer»

1. How would you rig a batch file up to a SERVER?
2. How exactly could you make it multiplayer, with a read write thing? I don't understand that. Please explain.
3. Boolean, can that be done with batch MAYBE using a special command or something?
4. Countdowns and timers, like if I wanted the program to maybe echo "Hi!" for 15 seconds, what would I do?MORE:
1. How could I pick the line out of a .txt document, like maybe the 5th line of a document called "document.txt"?
2. Are there objects in batch, and how exactly can I work them?2b. Maybe someone could try to immitate objects in DOS. I dunno.3. Boolean can perhaps be done with if and 1 and 0 or "true"/"false" string vars.

set a="true"
if a=="true" do xyz

4. What do you mean? Displaying "Hi!" for 15 seconds and then closing the file down or cls, or? Quote from: Treval on March 16, 2010, 12:36:36 PM

2b. Maybe someone could try to immitate objects in DOS. I dunno.

I don't think so. the LANGUAGE almost always has to have support for objects itself; this cannot be added on later; additionally, in order to properly emulate "objects" in batch you would need to have pointers, as well as structures, neither of which are available in batch.

Anyway- if you are trying to create objects in batch or think you need to you probably need a better tool; VBScript and JScript are built into Windows installations by default, and you can also get Perl, Python, and various other languages that fully support objects.

Quote from: Treval on March 16, 2010, 12:38:12 PM
3. Boolean can perhaps be done with if and 1 and 0 or "true"/"false" string vars.

set a="true"
if a=="true" do xyz

Ahh! but they are not true booleans- I think, the OP is explicitly referring to performing boolean arithmetic on them, with or and and and so forth. For example- in most languages flipping a boolean is easy, like:

Code: [Select]c=!c

but- with batch it has to be something like
Code: [Select]if a=="true" set a="false"
if a=="false" set a="true"

of course you could always try to make this easier with subroutines for the various boolean operations.


most of these questions come from treating the command batch language as a full-featured programming language; it WORKS fine at the PROMPT and for batches of commands, as it was designed, but if your batch needs any semi-modern language constructs (such as "objects") then what you are doing is too complex for batch (or your design is too complicated)




Discussion

No Comment Found