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.

Newcomers DBPro Corner / Learning DBPro

Author
Message
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 29th Mar 2009 23:24 Edited at: 29th Mar 2009 23:28
Hello, I have had DBPro for about 3 years now and I have been skimming through tutorials and writing very simple programs. However I am not sure on how to learn this language. By just following tutorials about random things or learning different aspects individually. I just wanted to know how every one else learn't it and would be kind to tell me.

I was thinking about buying the DBPro Hands On books, does anyone recommend them and will they help me?

Thanks alot,

Jack

TheCleverGuyz
Databug
16
Years of Service
User Offline
Joined: 27th Oct 2008
Location: Elsewhere
Posted: 30th Mar 2009 00:03
I learned by buying a guidebook first and reading it. Then i told myself to make an easy game and if i didn't know a code to accomplish what i needed i looked it up. If it didnt have it i posted on the forum. In the end i learned a bit and now i dont have to look at the book anymore except once or twice

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 30th Mar 2009 00:44
Before I ever took any classes for programming, which back then there weren't any, I did just what Databug did. I had my Apple //e, and a very good book on programming in Applesoft BASIC. I wore that book out learning everything I could about the language. Then I started picking up things by looking at other people's programs.

Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 30th Mar 2009 18:34
Thanks, I probably will but the Hands of DBpro books and just follow along.

TheCleverGuyz
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Mar 2009 18:41
I knew some basic programming before I bought DBC and eventually DBP. I did purchase Hands on DBP and it definitely helped me. I would recommend purchasing it. I also looked at the source code for the demos and code snippets to figure out how people accomplished things. If I have a particular problem I can't solve, I look on this forum to see if others have had that same problem and almost always there is something that I find that helps.

Good luck

LB

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Mar 2009 03:06 Edited at: 31st Mar 2009 03:06
I bought DBC, looked at the examples, and tried to figure out what the ones that looked cool did (after I got over the fact that I didn't understand the tank demo) . Overtime I learned in a backwards way-- starting at the print command (hello world), then learning 3D objects, and then learning what variables were.

<---Spell casting battle game!
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 31st Mar 2009 09:57
Once again thanks, I've been looking at the Beginers guide to DBPro and I've learn't loads already. When I get a bit more cash I'm going to buy the Hands On books.

Sorry if there's typos I'm really tired...


Jack

TheCleverGuyz
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 31st Mar 2009 22:08
I made a simple gambling game where you have to guess whether it will be a higher or lower number. You could probably do it in less lines of code than me and probably do it alot better. But I just put what I had just learn't into this..



TheCleverGuyz
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 1st Apr 2009 10:16
thats a great start keep going and you will be pro material....
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Apr 2009 16:22 Edited at: 1st Apr 2009 18:17
Half Life Dude
Not bad for starters. While I really do not want this thread to turn in to a goto / anti-goto 'discussion', I would strongly suggest you learn to use subroutines (aka procedures) instead of goto. A prolific use of goto will create what is known as 'spaghetti code' where you are constantly jumping around in the code. It makes larger programs very, very difficult to debug. Using procedures takes a little thought and planning, but once you learn to code that way you will be a better coder IMO.

There are those on the forums that swear by the use of goto and it certainly can be used in DB programs. I would say that there are very rare circumstances where it might be the thing to do, but many, like myself, consider it poor programming practice to use goto as a norm.

EDIT: Also, you have a colon after 'repeat' throughout your code. This should error, but for some reason does not. You should delete these.

Good luck,

LB

Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 1st Apr 2009 18:29 Edited at: 1st Apr 2009 18:31
LBFN: Yes, I read that using GOTO was bad but it was just a test. Also are you talking about functions?

EDIT: Just noticed the colons must have misstyped because I wrote that code once and then copied and pasted it to the other parts. I'll change now.

Lucifer: Thanks mate

TheCleverGuyz
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Apr 2009 19:05
I would suggest that you try to re-write your code using procedures. Your do-loop should normally be relatively small, primarily consisting of calls to subroutines or functions. Subroutines are also called procedures, but are different than functions. I would suggest that you get a good understanding of how to use subroutines before you move on to functions.

Also, instead of using num1, num2, num3, etc., why not use an array?
Example:
early in the program:



here is an example of a subroutine:



call this from your main do-loop:


LB

mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 1st Apr 2009 19:17
lol i have had dark basic for one week and i am already in the middle of making my first game. a 3d fps just go to the tutorials thread and find the fps tutorialit is realy good

www.madninjas.co.nr we are mad and we are ninjas
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 1st Apr 2009 19:20 Edited at: 1st Apr 2009 19:49
Thanks alot, I'll start looking at subroutines then.

EDIT: How do I go about pulling the different info out of the subroutines?

Jack

TheCleverGuyz
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Apr 2009 21:14
Half Life Dude

Subroutines normally contain events that happen repeatedly. Here is an example of what you could do:



This code assumes that you have dimensioned an array named 'number', have a variable named 'counter' and another subroutine named 'Win'.

BTW, you have # on the end of the money variable. This denotes it as having float precision, but you use it like an integer. If money is always going to be an integer, you should drop the # sign at the end (it is that way in my example).

LB

Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 1st Apr 2009 21:25
Thanks LB, I put a # at the end of my money because when I add different things you can do to the game your money could become a point number. Besides that I'm not sure what you mean could you post it with abit of my other code so I can see the context?

If its to much hassle don't worry about it Thanks alot anyway

Jack

TheCleverGuyz
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Apr 2009 15:20
I really didn't want to do it all for you, but you seem genuinely interested in learning, so perhaps you can learn from this.




As you can see, the main do-loop is quite small and compact. The code is easy to edit and debug. While this is just an example of how it can be done (and there are other ways you could do it), my hope is that you will see the advantages of subroutines over using the dreaded goto.

Good luck,

LB

Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 2nd Apr 2009 18:32 Edited at: 2nd Apr 2009 18:59
Am I right: You have two arrays Num and Counter and inside Num you have ofcourse the random numbers. Is then the Counter the second array wich tells the computer which random number to use?

Also your right about the setup its much easy to work with lots of goto's saying the same thing.

Thanks alot

Jack

TheCleverGuyz
Tobo
19
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 10th Apr 2009 10:31
Half Life Dude / Jack,

Referring back to your original question, I can strongly recommend the Hands On DarkBasic books, both Volumes 1 and 2.

The tutorials are written so well, that the concepts used are easily tranferable to other languages. The Hands on DB books actually helped me out with BlitzBasic - go figure!

The tutorials are short, sweet and very easy to follow. Each command is explained in full and very effectively.

Not only that, but I just bought both of them (direct from digital skills) for £55 with free postage.

Hope this helps.

T.
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 27th Apr 2009 22:59
Bringing back an old thread sorry. But thanks everyone. When I get a bit more cash I'm going to definatly buy the books.

Tobo: Thats a nice deal.

TheCleverGuyz
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 28th Apr 2009 11:53
i just do nothing else than programming and browse the forum a lot, i think its just practice. sometimes make a little game, etc...

(\__/)
(O.o )
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!

Login to post a reply

Server time is: 2024-11-24 09:03:24
Your offset time is: 2024-11-24 09:03:24