program comand line - what is it?

Blitz3D Forums/Blitz3D Beginners Area/program comand line - what is it?

LedgerARC(Posted 2008) [#1]
ok, I'm almost sure that it soemthing to do with making a function into a code that you can use yourself in a game as if it was a command.

What I don't get is how to use it.

I'm sure as soon as I figure out what it is I feel a little stupid, but I guess it's a good idea to learn now instead of later.

Hope I gave you a simple task

Andrew =)


Matty(Posted 2008) [#2]
You can pass parameters to your program and read them in using the commandline$() function. All the commandline$() function does is return the values, as a string, you pass to the program.

How you then act on those values is up to you to program.


LedgerARC(Posted 2008) [#3]
ok, that wasn't exactly what I was looking for, but thaks anyway.

what i'm thinking of is when you go under the program bar, and then there's "program command line..." right on top of "debug enabled?".

it's not a command, unless I'm mistaken.

Andrew =)


GfK(Posted 2008) [#4]
That option in the IDE simply emulates what Matty explained. This enables you to test command line parsing and so on from within the IDE, without having to compile an executable first and mess about running it manually with a commandline.


Ross C(Posted 2008) [#5]
So, what if you send 3 commandline messages to the code, and none of them get read straight away. Do they get queued?


PowerPC603(Posted 2008) [#6]
It acts as if you where to execute your program from the command prompt (like DOS).
If you click on your windows START button and select "Execute...", then enter "cmd".
If your program was called "MyProgram.exe", then the command line parameters are the characters that you enter behind it, like:

MyProgram.exe -option1 -option2 -option3

The string "-option1 -option2 -option3" is the program command line thing you can enter in the IDE.
The CommandLine$() function returns this string, nothing else.
It can be as long as you need.
The above string has actually 3 parameters, but a string is a string, so if you want to read those 3 parameters, you'll have to parse that string to read each parameter individually.

When you use the CommandLine$() function, the given parameters won't be deleted.

Start Blitz and use this program:
Print CommandLine$()
Print CommandLine$()
Print CommandLine$()
Print CommandLine$()

WaitKey()
End

Enter "-option1 -option2 -option3" in the IDE under "Program" -> "Program Command Line" and run the code.


GfK(Posted 2008) [#7]
So, what if you send 3 commandline messages to the code, and none of them get read straight away. Do they get queued?
No.

Nothing happens with the command line unless you specifically want it to. You must parse the result of CommandLine() yourself. It can contain as many parameters as you like, in any order you like, and they can BE anything you like. Just make sure that your code knows what parameters to expect, and what to do when it encounters one.


LedgerARC(Posted 2008) [#8]
Oh I see, I thought it was soemthing completly different :P, and I mostly just wanted to know more about the Blitz interface.

Thanks for all the help, I might be able to use it one day :P.

Andrew =)