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 / IFs and THEN's

Author
Message
Breca Lomit
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location:
Posted: 21st Dec 2002 05:14
Hi im sorta new to DarkBASIC (by saying sorta means i used to use darkbasic but i havent for about a year so ive forgotten.)

Im trying to learn all ova again so if someone could PLEASE help me with something.

Im trying to learn about ifs and thens all ova again and i was just wondering if someone could post a small code with ifs,thens and prints in it so i could figure it out, thanks.

PS:Where can you download the DB Manual?

Kind Regards Breca
eightfoot514
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 21st Dec 2002 05:21
you can get the manual at ftp://ftp.darkbasic.com/docs/DarkBASIC_Manual_v113.zip
this is linked from the update page.
hope thats useful,
eric

Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 21st Dec 2002 06:02
Here is a freaky code I made in about 5 minutes, or less. To work it, just go into DB and paste the code and then hit F5 and then when the screen comes up it should be blue, and then just tap the SHIFT key lightly, and text will appear. But, then, if you hold down the SHIFT button, you will see what is freaky about this code:








Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 21st Dec 2002 06:20
And here is another, better command. This time, when you hit the UP button, it will say something in english, but if you press the DOWN button it will say something in Spanish. What is says in English is what it will say in Spanish.



Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 21st Dec 2002 06:21
Oop! I got it mixed up. When you hit the Down button it is english and the up button is spanish.

Breca Lomit
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location:
Posted: 21st Dec 2002 06:37
I was looking for something a bit 'EASIER?' You see i need something with INPUTS and PRINTS and IFs and THENs that is all i need im am afraid. Just something basic like a game show program e.g. What does 1+1=? Answer 2? Correct! Answer 3? WRONG!


Thats what i would like thankyou.

Kind Regards Breca

ChronicFear
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 21st Dec 2002 06:42
Here is another one for you, to try to explain a little in this little tutorial ima make up



ok, im going to start with the basics (Most of this I learned in the tutorials, and, a nice DarkBasicPro programmer I met on the forums (im sorta a n00b as well).

Anywas, the sync commands
Sync is short for syncronize, which, basically sets it so that the frames can be shot. Basically, like in a theatre when they close the curtains, the stage is moved, and then opens, and there is a new scene. Neways, then, Sync Rate 30 is how many times a second this happens (Fast stage crew).

Now, onto a little more.
Load Object "C:\Textures\3d\Aircraft\Test2.x",1 Loads an object i have in one of my folders. Now, you should download your own to do this cause, it doesnt work unless you have mine in the same directory. So, save a 3d object into the same folder you save this code too, and do this
Load Object "[3d models name]",1
The second parameter is the number index, or, basically, name that you wanna give it. It can only be a number, no text. Use that number to do certain things to your object
Scale object works like a magnifying glass does. It can shrink of enlarge the object. I, enlarged mine. The parameters are Objects Index #,X#,Y#, and Z#.
Position Object basically positions your object on the screen at a certain spot. Mines placed at the X of 0 (right in front of you) at the y of 0 (eye level) and just a little ways in front of you. So, parameters are index #,X,Y,Z
Make Camera 1 makes a camera and names it 1
Position Camera 1,0,0,0 Puts the camera on basically in the middle, right on the bottom of the level (unless you want to go into negatives) and right against the wall (again, unless you want to use negatives). This makes the camera look diretly at the object.
Rem just makes a remark and wont load the text that you type as a function or command
Remstart and remend - The text inbetween these two commands wont be used as commands either, just, remarks

Do - This command starts the cycle of what the prog will run through everytime it hits the loop. So, if you want to make something move forward by 1 everytime it cycles, this would be the command before move object 1,10 (moves your object of 1 10 world units away from you). Then, after that, you would put loop

If Upkey()=1 Then Dec Pitch#,3
This command makes it so that if you push the up arrow, then, the Pitch# is decrease by three. See, Dec Variable,Decrease by this number
So, subract 3 from Pitch is basically how that works
XRotate Object 1,Pitch#
This makes the object rotate around the X axis by a degree of the variable Pitch#
Same thing with the Inc Pitch#,3 This adds 3 to the Pitch#
YRotate Object 1,Roll# just basically Rotates the object along the Y axis by the number of the variable Pitch#

Then you got that freakin sync command again, which, just tells it to refresh the screen. This Do/Loop process will be ran 30 times a second
Hope you liked my little tutorial and found it usefull

Your suffering cause of me its divine
-Korn-
Breca Lomit
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location:
Posted: 21st Dec 2002 07:47
It seems you are going to alt of trouble to post these tutorials BUT im sorry to say that i only need a basic code and i explained it in the last reply of mine and i will say once again "i only need a SMALL EASY code that is like a game show where the user input the answer and if it is not correct it says NO and if it is correct it says YES"

CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 21st Dec 2002 08:17
number = rnd(100)
do
print "guess my number 1-100 :";
`the ; at the end causes the input cursor to appear there
input answer
if answer < number then print "too low try again" else
if answer > number then print "too high try again" else
if answer = number then print " hey you win":end
loop
`the then in if-then isn't needed but may help in reading `code

hoped it helped
john

xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 21st Dec 2002 17:47
Here's another simple little prog.

ChronicFear
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 21st Dec 2002 20:10
I was just trying to give you the basics of 3d and stuff of Darkbaic. Sorry if that offended you in any way

Your suffering cause of me its divine
-Korn-
ChronicFear
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 21st Dec 2002 20:18
Here is one for you


I didnt use the Then command cause it doesnt work with the Else command

Here is an example of If Then



Your suffering cause of me its divine
-Korn-

Login to post a reply

Server time is: 2024-11-23 17:46:16
Your offset time is: 2024-11-23 17:46:16