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 / Some Guy's All Out Newcomer Tutorial: The BASICs of DarkBASIC

Author
Message
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 00:49 Edited at: 29th Aug 2005 22:23
################################################################################
# Some Guy's All Out Newcomer Tutorial: The BASICs of DarkBASIC
# Skill Level: Just Started
#
# Chapters: 5
# If you liked this tutorial try: Some Guy's 2D Tutorial
#
################################################################################
Chapter 1: Da Basics
################################################################################
DarkBASIC is a programming language built upon Visual Basic. It uses the power of microsoft's
game engine Direct X. So let's get programming!

**Saying Hello World**

Let's jump into programming right away, this shouldn't be to hard for you to do. Hopefully not!

@@Source Code@@

Print "Hello World"

Run the example, not much really but a start no doubt.

**Variables**
Before you go any further we need to talk about variables, variables are used to store data.

variable# = 1.2

The top variable is called a real number, why? Because it is a decimal number as such.

Variable$ = "Hello World!"

This variable above yet again is a string$, because it stores words mostly. It can be used for
decimals or reals but they can not be treated as numbers only strings.

variable = 112

This variable above is a integer variable they can positive or negative.

**Saying Hello Again**

@@Source Code@@

hello$ = "Hello World!"
print hello$

num$ = "1"
numtwo$ = "2"
numthree$ = num$ + numtwo$
Print numthree$

num = 10
numtwo = -10.5
numthree = num + numtwo
print numthree

Run the code to see what happens

**Making Notes**
You may be wondering how we can make notes well that's easy! By commenting.

@@Source Code@@

Rem this is a comment rem is short for remark
` this is a easier way by pressing the ` key

Remstart
A GROUP OF COMMENTS
remend

Please run this code.

################################################################################
Chapter 2: Math
################################################################################

Unfornately if you hate math I brought it up, don't worry this is easy math, easy, easy, easy.

@@Source Code@@

Rem the Guessing Game
Rem A Easy Short Game

`Forgot the do and loop

do
num = rnd(100)
Input "I'm thinking of a number from 0 to 100 what is it? ",ynum

if ynum < num then print "Nope your wrong try higher."
if ynum > num then print "Too low!"
if ynum = num then print "You Got It!"
wait key
cls
loop

Ta-Da! Your first game. Try making a mad lib game or a name asker or continue on with math.

@@Source Code@@

Rem Adder
Rem A Easy Short Game

Input "What number should I add to another? ";numone
Input "And? ";numtwo
numthree = numone + numtwo
Print "This is the answer! ";numthree

Wow! Yet another game, try making one that subtracts, or divides, or multiplies

Oh and * is multiply, and / is divide in case your wondering
< is less, > is greater, <> is equal to, <= is less then or equal to, and >= is greater then or equal
to.

@@Source Code@@
Rem More Math
Rem A Simple Game

Input "Enter A Number";number
option = rnd(1)

if option = 1
inc number
print number
endif

if option = 0
dec number
print number
endif

I want you to go to the DarkBASIC command list and go under math to find more of these
math commands.

And when your ready let's move on.
################################################################################
Chapter 3: Text
################################################################################

Text is straightfoward

1D = Non-existant or is it?
2D = X Cordinate (across, or horizontal) and Y Cordinate (up and down or vertical)
3D = X, Y, and Z (In and Out)
4D = Foward and Backward or Time useless when it comes to games
5D = Hard to explain and useless period!
6D = Non-existant or is it?

text x,y,string$

val(string$) (turns a string into a number)
str$(integer) (turns a integer into a string)

set cursor x,y

ink rgb(red,green,blue),colornum

set text opaque

set text size sizenum
set text font desiretextfont$

As in the math not much of the rest is needed but view it anyways like you did with the math
if you want.
################################################################################
Chapter 4: Keyboard Input
################################################################################

if inkey$() = "a" then print "Yo"
if spacekey() = 1 then print "Hi"
if returnkey() = 1 then print "Dude"
if controlkey() = 1 then print "HEY"

View input for more examples of keyboard input.
################################################################################
Chapter 5: Arrays
################################################################################

dim a$(10)
a$(1) = "AAA"

dim a$(1,1)
a$(1,1) = "AAA"

dim a$(1,1,1)
a$(1,1,1) = "AAA"

Ah so what does that above mean? It means instead of using hundreds of different variable
names we made a group of variable names. Straightfoward Isn't it
################################################################################

I recommend you look at my 2D Tutorial (a work in progress) is out, and I recommend
Beginner's Guide to DarkBASIC Game Programming also.

PS: I might make a 3D Tutorial Later.

Peace.......

Some Guy
################################################################################

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 00:50
Oh and language used is DBC (DarkBASIC Classic)

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 29th Aug 2005 03:46
Quote: "ink rgb(red,green,blue),desirednumber"


Lol!

Priceless!

TDK_Man

Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 29th Aug 2005 06:10
Dont forget the "do" and the "loop". Their basic, and their needed.
Nice job though.

Weird = Unique. Unique = Human.
Im human.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Aug 2005 10:17
Quote: "Lol!

Priceless!
"


That's funny. I like how he talks about the 4th through 6th Dimensions too.

Quote: "4D = Foward and Backward or Time useless when it comes to games
5D = Hard to explain and useless period!
6D = Non-existant or is it?
"


"Time useless"... yup time sure is useless for games. Seriously though... I believe time is not a dimension... it's a state that flows through all dimensions.
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 18:07
Wow lotsa dimensions eh?

My 2D Tutorial's Up Now. A Work In Progress, my tutorials before my
games.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 29th Aug 2005 20:41
Again.

Quote: "ink rgb(red,green,blue),desirednumber"


desirednumber is a COLOR. (rgb(0,0,0) = 0). It determines the background color. For example: using opaque text.

I won't repeat what I said in your other post.

Immunity and Annihalation makes Immunihalation...
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 22:23
I won't either, I will correct my tutorial.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Aug 2005 05:46
Quote: "Wow lotsa dimensions eh? "


I think scientists believe there are 12... but don't quote me on that.

Login to post a reply

Server time is: 2024-11-27 18:52:54
Your offset time is: 2024-11-27 18:52:54