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 Professional Discussion / absolute beginner - help please

Author
Message
wolves
17
Years of Service
User Offline
Joined: 11th Oct 2002
Location: United Kingdom
Posted: 30th Oct 2002 11:17
I've just installed DBpro. Never attempted any programming before and am really floundering.

Have gone through GETTING STARTED - didn't understand all of it though.

Gone through the EXAMPLES section and couldn't follow a lot of it.

Then worked through the PRINCIPLES and fared a bit better. Couldn't follow all that stuff about lottery and arrays and restore and branch statements etc.

When I get to the tutorial what am I supposed to do? Di you have to break down all the code because by this stage it still looks like GREEK to me!

In short guys (and gals) help. Is there a better book I can buy to explain all this stuff. I really need a concise step by step book to lead me through.

Cheers everyone.
rapscaLLion
17
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 30th Oct 2002 15:02
Well, the main problem is that your new to programming. So, your gonna have to take it really easy to start. I suggest you start VERY simple, and work your way up, teaching yourself on the way because the docs are woefully inadequate. They are being worked on though.

>Start by figuring out and using the PRINT command. Just use the print command a couple times, saying stuff like "hello world"
>Continue by using the input command, then take the user's input and print it out again. This introduces simple variables and input.
>Work your way up to a number guessing game, were using the RND() command, the computer picks a random number and the user has to guess it, he gets 3 tries, and if he is too high or low when he guesses, the computer prints "too high" or "too low" accordingly. If you can get that done, then you'll have a better basis. After you can continue along this path, or try to go through the tutorials, etc. Don't start worrying about graphics anytime soon!

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
pathfinder
17
Years of Service
User Offline
Joined: 5th Sep 2002
Location:
Posted: 30th Oct 2002 15:31
1/ If you get completely stuck and you cant find a book on qbasic which comes with older windows systems ready to run. Run an MS dos window and type qbasic and off you go.

2/ check out the 20 lines section on the forum some of the code requires no download you just copy the code.

3/ if you want to do a random game make sure you have

randomize timer()

in your code otherwise everytime you run your game it will produce random numbers in the same order.

I have to admit though its all very daunting when you first look at a darkbasic program. But as rapscaLLion said stick to simple programs no graphics and work your way up . if you look in the 20 line section theres loads on little programs to keep you happy

Viktor
17
Years of Service
User Offline
Joined: 7th Oct 2002
Location: Austria
Posted: 30th Oct 2002 17:31
Yes, how true, you cannot expect that your first game will have better physics and graphics than "HALO" or "DOOM III", start with making simple games or applications in order to learn how to master DBP and how make workarounds to the bugs.
My first game was a Adventure with 10 rooms and no parser, and it took me one month to complete. It was coded on a C64.

ChipOne
17
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 30th Oct 2002 18:46
rapscaLLion: that's hilarious! you and i almost posted the same thing (look at the newcomers forums)!

wolves: please don't cross post...if you put up your question and don't immediately get an answer, just be patient, an maybe try to rephrase your question so it is more direct. now you have two places where people are going to be giving you different information and won't be able to work together as easily to help you. you're working against yourself!

-= i only do what my rice krispies tell me to do =-
wolves
17
Years of Service
User Offline
Joined: 11th Oct 2002
Location: United Kingdom
Posted: 31st Oct 2002 15:21
Oops - ChipOne

My mistake. I am also new to forums. Will confine myself to one area only, this one. Thanks for the advice. You certainly are a helpful bunch!

I went to DB heaven and found that the author of the site is going to write some basic tutorials - these should help a lot. I think a rather thick manual is required in the bookshops.

Here's looking at you, kid
Marc Fleury
17
Years of Service
User Offline
Joined: 1st Oct 2002
Location:
Posted: 31st Oct 2002 16:41
There already is a from-the-beginning tutorial at DBHeave.com:

[url]www.dbheaven.com/thebook.php[/url]

Learn DB here -- http://www.dbheaven.com/ -- Learn DB here
Shadow Robert
17
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 1st Nov 2002 01:21
The DB original manual was pretty good
due to the updated setup of pro though the lessons don't copy direct - which is a shame

tell ya what, i don't think i have the lottery code in the demo manual - so upload it and i'll wizz over it and recomment it, because Lee's comments never were really for the complete beginner

Anata aru kowagaru no watashi!
wolves
17
Years of Service
User Offline
Joined: 11th Oct 2002
Location: United Kingdom
Posted: 1st Nov 2002 12:24
Hi Raven Vegeta

Thanks for the help The lottery code is:
Arrays are going to be a very important part of your
future programs. They allow you to store large
amounts of data under a single name. You can then
access the data by index rather than by name alone.

If you had to write a program that stored each
weeks lottery numbers, typing out 52 unique
variable names is a lot of work, hard to maintain
and quite unnecessary. Arrays allow you to create a
special kind of variable that can store more than
one item of data. You might start your program like
this:

lottery1$="43,76,12,34,12,11"
lottery2$="76,12,34,12,11,44"
lottery3$="12,34,12,02,05,07"
etc..
Two hours later, you realize you could have written
it like this:

DIM lottery$(52)
lottery$(1)="43,76,12,34,12,11"
lottery$(2)="76,12,34,12,11,44"
lottery$(3)="12,34,12,02,05,07"
etc..
We declare a string array using the DIM command
followed by a name for our array. Like variables,
when we use a dollar symbol after the name we
instruct the program to use the array to store only
strings. We then enclose in brackets how many
items of data we wish the array to store. The array
can be filled almost like a variable, but you must
also provide the position within the array you wish
to store your data.

But you then ask yourself what benefits I would
have gained using the second approach. If you
where also required to print out all 52 lottery
numbers to the screen with your first approach you
would have to add another 52 statements that
printed each variable:

PRINT lottery1$
PRINT lottery2$
PRINT lottery3$
etc..
But if you had used an array, the same example
would look like this:

PRINT lottery$(1)
PRINT lottery$(2)
PRINT lottery$(3)
etc..
You will have noticed that by using an array, you no
longer have to refer to your data using a unique
variable name. You can now point to the data you
want using a position number. Accessing data this
way has a thousand advantages over trying to
access data by variable name alone, as you will
discover. One example would be to improve the
above like this:

FOR T=1 TO 52
PRINT lottery$(T)
NEXT T
Incredibly the above code replaced 52 PRINT
statements with just 3 statements. With the above
example, T is incremented from 1 to 52 within a
loop that prints out the contents of the array at that
position.

Arrays can also store multiple levels of data. At the
moment our lottery entries are stored as strings and
the numbers are hard to get at. Let's say we wanted
to store all six numbers for every lottery week, we
would create an array like this:

DIM lottery(52,6)
Without the dollar symbol($), we are declaring the
array to store integer numbers instead of strings.
You will also notice we have a second number
separated by a comma. This means for every array
position from 1 to 52, there is a sub-set numbered
1 to 6 in which multiple data can be stored. You can
visualize an array as a filing cabinet with large
draws numbered 1 to 52. Within each of the 52
draws is a tray with 6 boxes inside. You can store a
value in each box. In all you can store 312 (52 x 6)
values in this array. You can have up to five
dimensions in your array, which means you can
create an array as big as (1,2,3,4,5). Be careful
when declaring dimensions, as large arrays
consume large amounts of memory and may reduce
overall performance of your program.

Entering data into our new array is elementary:

lottery(1,1)=43
lottery(1,2)=76
lottery(1,3)=12
lottery(1,4)=34
lottery(1,5)=12
lottery(1,6)=11
lottery(2,1)=43
lottery(2,2)=76
lottery(2,3)=12
lottery(2,4)=34
lottery(2,5)=12
lottery(2,6)=11
You are now able to give your program access to
much more useful data. Unlike the string approach,
you could make your program count how many
times a certain number has appeared.

As you have determined, arrays need to be declared
as a particular type. You can have an array of
integer numbers, real numbers or strings. You
cannot have multiple types in the same array, but
you can declare new arrays dedicated to holding
such data.

As I am a total novice I couldn't make much of this out.

Cheers

Here's looking at you, kid
wolves
17
Years of Service
User Offline
Joined: 11th Oct 2002
Location: United Kingdom
Posted: 1st Nov 2002 15:48
Still struggling to understand very basics.

Tried running this but it wont work.

rem create cube of 100
make object cube 1,100
rem load image
load image "sadie.jpg",1

rem texture cube
texture object 1,1
rem main loop

do
yrotate object 1,object angle y(1)+0.5
loop


If I take out the load image line I get a revolving cube - fine.

I am trying to load a photo of the dog called sadie. It's a jpg. Does the program know to look in a certain folder on hard disk or do I have to tell it that also?

I have tried several images but none work.

What does the ,1 mean after the image name?

Thank you all out there. Wish you were here all sitting over my shoulder. I would need a pretty big room I reckon.

Here's looking at you, kid
Flashing Blade
17
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 2nd Nov 2002 00:56
hi wolves me n00b to dbp too - i programmed vb and pascal and started to learn c++

(1) yes you need to specify path, but easier (especialy if distributing final prog) to put "sadie.jpg" into your current project folder. Or make a folder in your current project folder and call it something like "grafix", then copy sadie file to it, then load with:
load image "grafix\sadie.jpg",1
(2) don't worry if you no understand arrays. When you are writing a program that needs to use arrays then you will learn all about 'em with some trial and error and some manual reading - everything trial and error with a bit of manual reading - reading manual no use unless in conjunction with a prog u making (imho).
Rodro
17
Years of Service
User Offline
Joined: 17th Sep 2002
Location:
Posted: 2nd Nov 2002 05:05
"What does the ,1 mean after the image name?"

The ,1 means you are loading the image into image #1. If you need to referrence that image later in the code just use 1.

SYNTAX
LOAD IMAGE Filename, Image Number

Hey!! You talking to me?
Megaman X
17
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Sweden
Posted: 2nd Nov 2002 13:22
Wolves, I have a cool DB Manual made to DB Ver 1.9. I know it's a bit old ( perhaps too old ) but it teaches u all the basics and stuff. Tell me if u are entrested here:

roguex2000@hotmail.com

I don't suffer from insanity, I enjoy every minute of it.
-- Rogue
Megaman X
17
Years of Service
User Offline
Joined: 21st Oct 2002
Location: Sweden
Posted: 2nd Nov 2002 13:24
Also, don't think twice when u code with DB, press F1 for help after ALL commands u type, so u can see what it does. There's some tutorials in there, I think u should make them all, do not skip any even if it looks dum. And press F1 in every statment

I don't suffer from insanity, I enjoy every minute of it.
-- Rogue

Login to post a reply

Server time is: 2020-07-14 21:11:00
Your offset time is: 2020-07-14 21:11:00