Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Using the CLI

Author
Message
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 14th Apr 2009 03:29
Can someone explain how to use the CLI? The user manual is not too helpful. I searched the forum but I could not find any post that explain it usage.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Apr 2009 03:58
prolly a dumb question but wat is the CLI?

There are only 10 kinds of people in the world, those who understand binary and those who dont
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 14th Apr 2009 04:02
i think its the thing it goes to after testing your game.

im new at this
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Apr 2009 04:28
The Command Line Interface (CLI) is actually quite a useful tool. It allows you test out code in real time. It's helpful for debugging and trying out different things.

Let's do a few experiments to see how it works. First, copy this code into DarkEDIT or the standard DB editor:



Now, before launching the program, you may want to print or write down the following tests. Once you have the information, go ahead and run the program and try out these tests:

1. Activate the CLI
Once the program is running, you'll see a make-shift forest on a grid. Move the camera around with the Up/Down arrow keys and steer with the mouse.

Now press ESCAPE

The CLI will open. You'll have noticed that the mouse is moving around the screen as you were steering the camera. Without rewriting code in our source script, we can send a command directly through the CLI to do what we want. In this case, we'll hide the mouse.

Type : hide mouse
Press ENTER

Now Press ESCAPE again

You are back in the forest and you'll see the mouse is hidden. Move around a bit so you can see the prgram is running just fine.

One might use the CLI to test how things would look if they changed something (besides just hiding the mouse). Instead of writing new source, we can do some of the tests while the program is running so on to test 2:

2. Change Your Objects
Press ESCAPE - the CLI window opens
Type the following exactly as you see it in the CLI then press ENTER


Did all of the trees shrink? They should have! You can control objects directly from the CLI and see immediate results. The shrunken trees in their current state don't look so great so let's switch them back. Type the following in the CLI and press ENTER


Instead of typing that whole line a second time with the slight adjustment, you could have pressed the UP key and that will cycle through the previous things typed or the last text message displayed. If you pass the text you are looking for, press the DOWN key. Once you find the command you are looking for, use the LEFT or RIGHT arrow keys to move the cursor to the place on the line you want to change the text. In this case, we want to change the 100 to a 400. If you didn't already, try using the UP and DOWN arrow keys to bring up

and the use the LEFT/RIGHT keys to position the cursor in the correct place to change the line to read:

After you change the line, press ENTER. If you had changed it already, you won't notice any differenc in the forest.

Press ESCAPE to return to the program and move around some more.

When you are done moving around, press ESCAPE to return to the CLI

3. Changing Variables
I created a variable labeled speed# that controls how fast the camera moves forward. See if you can figure out how to change it's value to 10 in the CLI and then return to the program to see if the change worked. The try changing it to 1. Check below for the procedure:



4. Check Values
Sometimes you may want to check the values of variables or other things. We can query with PRINT directly from the CLI to check a value. But because my example is in 3d, a print will return a 2d value that the 3d redraw will wipe out. In this case in order to see our 2d values printed on the screen, we'll have to temporarily turn the 3d refresh off, print our value(s) then turn the 3d refresh back on. Let's check the value of speed# first. By now you should understand how to enter the CLI window and return from it so I'll only type the codes you should be inputting into the CLI:


Return to the program.

Try and use the same process to return the screen fps()

If you did everything like in the previous example, you shouldn't have had any problems.

That wraps up this quick tutorial on the CLI. You can use the CLI pretty much to test anything that you could write in code. However, you are limited to 255 characters on a line as a single command or string of commands.

Also keep in mind that if a value is reset in a loop in your program's source, if you change it in the CLI, the program's loop will just change it back.

Enjoy your day.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Apr 2009 04:38
o, cool, that could be useful, especially in large programs that u dont wana have to re-compile after u change stuff that u may want to change back, like the speed# above

There are only 10 kinds of people in the world, those who understand binary and those who dont
No Time To Code
15
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 14th Apr 2009 05:22
Latch to the rescue again!

Awsome information!!! If I had known this when I first started with DBC it would have saved me a lot of time.

Thanks again.
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 14th Apr 2009 05:47
i did'nt know that thanks @latch

im new at this
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 14th Apr 2009 07:13
I always thought of it as just like the Command Prompt in windows lol

New Site! Check it out \/

Login to post a reply

Server time is: 2024-03-28 23:04:10
Your offset time is: 2024-03-28 23:04:10