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 / Character Question

Author
Message
iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 26th Jan 2009 03:34
Why does adding a semicolon to this program,



like this,



create different results?

mi keety tot mi gramer?

(My kitty taught me grammer.)
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Jan 2009 03:52
By using a semicolon at the end of a printable text, you are telling DB that you want the next print to take place right after it. It effectively sets the cursor there, so that when you simply use print by itself again the text prints there.

Without having the semicolon there, DB moves the cursor down to the next line so that the next printing take place there.

I prefer to use the 'text' statement myself instead of using 'print'.

iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 26th Jan 2009 04:28
So it's like a really short command? What else does it do?

mi keety tot mi gramer?

(My kitty taught me grammer.)
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Jan 2009 04:56
You can string together different things with it:


LB

iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 26th Jan 2009 14:52
So what it really does is tell DarkBASIC that the next command should take place right after the first one? Including putting the cursor right after the previous text? Or does all it do just change the position of the cursor? Does it work with other commands?

mi keety tot mi gramer?

(My kitty taught me grammer.)
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Jan 2009 15:25
It only sets the position of the cursor to right after whatever is printed. It only works with 'print' and will not work with the 'text' command. I do not know any other command that directly works with this. What is it that you are trying to do?

iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th Jan 2009 15:28
I'm just curious. I'm one of those "Have to Know How and Why" people when it comes to programming.

mi keety tot mi gramer?

(My kitty taught me grammer.)
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 27th Jan 2009 23:06 Edited at: 27th Jan 2009 23:08
Oh, by the way, when you have the


Two things:

First of all, using

won't get any input.

Using something like

will check that immediate input to see if it was a space (btw, haven't tested, hope it works)

Second, using

Will leave a piece of your memory (small, but it still is) gone.
This is because gosub expects to see a
to have it come back, where goto just goes to the label

Use something more like



or


To save memory and some brainrackingness.

Good luck!

~QJ
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Jan 2009 15:38 Edited at: 28th Jan 2009 15:39
Quirkyjim
Quote: "First of all, using
if 1 = spacekey()
won't get any input."

Actually, it does. It is unusual how the iron programmer did it, but the code actually does work. Pressing the SPACEBAR does indeed exit the program.

Quote: "Using something like
if inkey$() = " ""

That does work, but why not just use the built in 'spacekey()' command?

Quote: "Use something more like
goto quit

quit:
end"

There is great division among coders as to whether or not to use goto. I do not want to get into an in-depth debate about it, but you could easily code this so that a goto is unneeded. Like this:



iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 28th Jan 2009 16:03
About the "1 = spacekey()" part, that's how it says to use it in the syntax. I used to use "spacekey() = 1" but for no apparent reason I switched to the way I currently use.

Is exit another command for end or something?

mi keety tot mi gramer?

(My kitty taught me grammer.)
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 28th Jan 2009 16:30
Exit lets you escape loops such as For..Next Do..Loop and such. You may just want to type in the commands you dont know then click under it and press F1 for help. It's faster than asking someone on the boards.
iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 28th Jan 2009 16:57
Ok, thanks!

mi keety tot mi gramer?

(My kitty taught me grammer.)
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 28th Jan 2009 17:51
Ditto

~QJ
iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 28th Jan 2009 20:23
Quote: "Ditto"


Pokemon?

mi keety tot mi gramer?

(My kitty taught me grammer.)
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 29th Jan 2009 01:19
Quote: "Quote: "Ditto"

Pokemon?"


Sadly I know that ditto is a pokemon that replicates other pokemon, it is one of the few ones that has a logical name because that's exactly what the word ditto means, a replica of something, in this case a replica of a previous remark.

Well that's my trivia for the day


Goke of the day: [Q]What's a coders' favourite part of an orchestra?
[A]The strings.
iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 29th Jan 2009 03:03
Wow, you're like a regular PokeDex!

mi keety tot mi gramer?

(My kitty taught me grammer.)
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 29th Jan 2009 17:11
All I can say is...

LAWLZ

~QJ
iron programmer
17
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 31st Jan 2009 00:11
That one lost me...

mi keety tot mi gramer?

(My kitty taught me grammer.)

Login to post a reply

Server time is: 2025-05-18 18:39:15
Your offset time is: 2025-05-18 18:39:15