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 / ; : commands and compiling into .exe

Author
Message
wrathman
21
Years of Service
User Offline
Joined: 10th May 2003
Location: United Kingdom
Posted: 11th May 2003 02:37 Edited at: 11th May 2003 02:54
oohh. what a nice forum.

ok, i've searched the forum but couldn't find this info, so here's my prob.

what exactly does the ; command do and what is the difference between it and :

i'm coming from a c programming background, and using it all the time and i think it's causing me loads of errors.

secondly, how exactly do i compile my code into an exe file? i just failed a coursework cos i couldn't do it. i was gutted. cheers for any help.

oh yeah, and how do i allow my program to check for two sources of input, ie to (for example) move an object in a diagonal if upkey and rightkey are both pressed?

..some of them can be bent, others can be broken...
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 11th May 2003 04:36 Edited at: 11th May 2003 04:37
You dont need a ; for the end of a line in DB. You can use it to print things on the same line:



The ; symbol tells the compiler to display the next print command on the same line as the other.

The : symbol can be used at the end of a line, but it is not nessasary.

You can use it to stack multiple commands on one line in your program.



I don't know what DarkBASIC you are using. DarkBASIC 'Pro' or 'Classic'? They are different.

For arrow keys, use:
upkey()
downkey()
leftkey()
rightkey()

If a button is being pressed, it will return a 1.

You can also use:
returnkey()
escapekey()
etc....
This does not work for every one though.

You can use INKEY$(), to return a string value of the key, or scancode(), to return an integer.

You can see "Input Commands" in the help files for more information.

Hope that helped.

"All programmers are playwrites and all computers are lousy actors" -Anon
Andy Igoe
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 05:12
Under DBC to compile an exe just press F5 or F6 to enclose your media (all files in the project folder).

Under DBP you make an exe every time you test your program. The default .exe is located in your DBPro temp folder but you can change it for each project in the project manager - and name it according to your project name, ie. Project.exe

You don't need;
It will cause errors;

You don't need : unless you are entering the 20 line challenge

To test multiple keys at the same time



To test for keypresses


Pneumatic Dryll
wrathman
21
Years of Service
User Offline
Joined: 10th May 2003
Location: United Kingdom
Posted: 11th May 2003 05:48
yep, that sorted the first bit. i thought i had to close every statement with a ;
still it does mean my code is buggy elsewhere tho.

but how do i compile the final code (if i eventually complete it) into a standalone .exe file? if i press F5, or F4 for that matter, it runs the program but doesn't make it into an .exe

I know about using the inkey() commands, but i've used them in this context and if i hold down UP and then press RIGHT the object i'm moving goes up and then right, and not up and right.

muchas gracious

i am using DBPRO

..some of them can be bent, others can be broken...
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 11th May 2003 05:51
You don't need else.

Just:


"All programmers are playwrites and all computers are lousy actors" -Anon
wrathman
21
Years of Service
User Offline
Joined: 10th May 2003
Location: United Kingdom
Posted: 11th May 2003 05:52
sorry, didn't look at that second post.

that sorted it, nice one.

word up those at banshee studios, your "jetpack" games ace.

keep up the good work!!

..some of them can be bent, others can be broken...

Login to post a reply

Server time is: 2024-09-20 08:05:44
Your offset time is: 2024-09-20 08:05:44