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 Discussion / How Do I Get the Current Graphics TEXT Coordinates?

Author
Message
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 13th Mar 2013 21:34
In other words, where the next pixel or text would print???

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 13th Mar 2013 22:32
How come I can't

Text ,," this is where we left off."

Just continue from where I left off in TEXT?

If all the "1"s are in the right place, it'll work like a charm.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 14th Mar 2013 00:26
TEXT doesn't, in a manner of speaking, create text and place it at a position. It draws the text on the screen. Once the command completes, there is nothing there. You could, I suppose, write your own function set that would do something similar like so:



I haven't tested that, so you'll probably want to test it and tweek it a bit, but basically arrays are globally stored, so you can change their data in a function and see that change outside of it. In this case, your last position will be at the same y coordinate but to the right by however many pixels the message string is wide (does that make sense?).

Hope this helps.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:03
Okay, so what's going on now?

After spending over 24 hours of programming trying to get Inkey$ to work properly, now I get this
"could not locate source file
C:\users\alpha\appdata\local\temp\untitled1.dba"
error message!!!!


And what the hell is "save as" and "save project as" and "save all"????? and why do I have to do all three and STILL I can't run my program any more????????

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:09
Now MY PROGRAM IS GONE!!!!!!


"Could not find main include file, the path stored in the include is invalid or missing. You will have to add the file manually."


WHY IS IT 2013 AND NOTHING WORKS?????? HOW DO YOU GUYS WRITE SOFTWARE??????


I CAN SEE MY PROGRAM ON THE HARD DRIVE!!!!!
It's right there.
ADAD 2.dbpro


WON'T F&$*#&^% LOAD IT!!!!!!

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:15
Okay, so I found my program

ADAD2.dba

But it REFUSES TO CALL IT A PROGRAM and will NOT RUN IT AFTER LOADING!!!!!!!

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:19
Okay, luckily I had the ascii and started a new program and I saved it as file, so what the hell is project? As in, WHY ISN'T THERE "SAVE" and it JUST WORKS, you know????

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:21

So why doesn't this command work, as in ACTAULLY "MAXIMIZE" the window? You know, you're not fooling anyone as there is white stuff at the bottom and top of the screen.

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:26 Edited at: 14th Mar 2013 10:27
You may be wondering why it took 24 hours of trial and error to use Inkey$....

Well, I kept getting 20 characters even though I pressed a letter once, then I had the problem of it printing a blank space between characters, and then there was this weird effect when SOMETIMES it would print the space between 2 characters of input.... and SOMETIMES IT WOULDN'T!!!!!!


ALL I WANTED WAS ONE LETTER AND TO REACT TO IT!

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:50
Okay, now I am changing the code, and it keeps running the ORIGINALLY LOADED program, not the modified stuff.

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 10:54
Well it keeps giving me this message even though now I am calling it ADAD3.dba
"could not locate source file
C:\users\alpha\appdata\local\temp\untitled1.dba"

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 11:01
Well, I started from what I had, the ascii, and it makes a "project" and now I'm just picking "save" to, you know, "save" my work..... is this what I'm supposed to do to, you know, "save" what I do?

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 14th Mar 2013 12:11
There used to be X Pos and Y Pos, so that you could record into 2 variables where you were so that you could jump somewhere else and print something, then jump back with Locate oldx, oldy. This was posssible for the graphics pixel location too. Dark BASIC doesn't have this?

If all the "1"s are in the right place, it'll work like a charm.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 14th Mar 2013 13:41 Edited at: 14th Mar 2013 13:44
Deca-posting isn't officially frowned upon here, because no one has ever done it before, but please edit your posts instead of having a conversation with yourself.

You are using DBPro, this is the board for DBClassic. A .dbpro file is a project file that stores various settings and links to .dba files that are included in the project. I don't like the default editor so I use Indigo, you might find it suits you better too.

Check out the DBPro Newcomers board, they will have answers to your questions.


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 14th Mar 2013 15:19
Quote: "Deca-posting isn't officially frowned upon here, because no one has ever done it before"


I don't know why, but this amused me much more than I would normally expect.

@Sequence

But before you go, your problem with inkey$ was because the inkey$ only checks to see what key is pressed down, and you are checking that about 40 times a second. There are a couple solutions to this:

1) Store the value of what key is being pressed as a variable. Only use the inkey$ value if it is different from the stored value.

2) Look into and implement the ENTRY$() and the CLEAR ENTRY BUFFER() commands (Its been a while, double check the syntax). They perform similar functions, but have the benefit of being able to clear the buffer to prevent multiple presses. You'd still probably need some timing control.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 15th Mar 2013 08:44
So, why do I get "Could not locate source file untitled1.dba"?

It's NOT a file that I am trying to load.

I am LOOKING at the code I WANT to be compiled and run.... BUT IT WON'T DO IT!!!!!!

WHY DON'T COMPUTER PROGRAMS DO WHAT YOU WANT DONE ANY MORE?



So to get this straight, I am staring at the code I want run, and dark basic WON'T run it.

Very well made program, huh?

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 15th Mar 2013 08:47 Edited at: 15th Mar 2013 08:48
Hi BN2 Productions,




After, and I am serious that I spent over 20 hours trying to figure out why stuff wouldn't work, I ended up with this, which seems to work right.

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 15th Mar 2013 09:03 Edited at: 15th Mar 2013 09:10
My file was resaved for some reason when I exited Dark basic, but still can't run it, even though I see it there clearly coded and did NOT save it before exiting.

If all the "1"s are in the right place, it'll work like a charm.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 15th Mar 2013 09:20 Edited at: 15th Mar 2013 09:22
Quote: "So, why do I get "Could not locate source file untitled1.dba"?"


it sounds like the project file (.dbpro) is still looking for the default new source file name rather than your current source file (.dba)

if your source file is called "something.dba" you should also have a "something.dbpro" project file in the same directory. open the project file in a text editor and look for the section which directs it where to find the source. It is near the top and should look like this:



if you see anything in there referencing untitled1.dba change that to your file name, and make sure the path is correct.

If that doesn't fix it, also check that the untitled1 file is not listed as an Include file in the editor.

This is probably all stemming from your problems with saving. possibly the best thing to do at this point is get a clean slate.

select all of your code, copy it to clip board.
hit the 'new project' icon, give it a name.
paste your code into the new file that opens up.
hit save all - this will save both the source .dba file and the project .dbpro file, you need both of these, and you need to keep both current
you will get a folder with the name of your project, in it will be the dba and dbpro files also with the name of the project.
when you close the files down and want to go back and work on them later, open the project .dbpro file and it will load everything up for you, use save all to keep both up to date with your changes.

Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 15th Mar 2013 09:20
NICE! Thanks OBese87

Idigo looks goooood.




I didn't think that it would work as it needed that piece of garbage, .net, which is like 600 megabytes, and I thought I erased it off of my hard drive.

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 15th Mar 2013 09:24
Thank you Ortu. I was "save" then "save project"ing before to "save" my work.

Have NO CLUE what the difference is. Why do they complicate things like that.


It's no wonder that barely anyone can code any more nowadays.

If all the "1"s are in the right place, it'll work like a charm.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 15th Mar 2013 15:35 Edited at: 15th Mar 2013 15:37
the project file is a settings file which coordinates how the compiler handles all of the source files, embedded media, and build settings for your executable, as well as how all of these things get loaded back up into the editor. its like a manifest or index for everything you might be working on beyond just the main source. when things are simple it may seem like uneeded complication, but as projects get bigger and more complicated, it actually works to help simplify things.

when you start including multiple source files to a project, save all will also make sure each of them are also saved and kept current

and of course any save as option allows you to save a new copy of whatver under a different name, leaving the original unchanged

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Mar 2013 21:09 Edited at: 15th Mar 2013 21:11
[edit: I was looking at the previous page, the post below might no longer be relevant.]

Quote: "A .dbpro file is a project file that stores various settings and links to .dba files that are included in the project."

The default editor works with project files (.dbpro), it is trying to compile the main source file, which it apparently takes to be "untitled1.dba", to compile a different file you must select it as the main source file for the project. If you just want to run some code, go to {file - new blank project} or something like that, you'll find it: this option will let you make a throw-away project that you don't have to save before compiling.


Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 10:12
Okay, I'm using indigo.... Someone want to explain why after loading my file.... IT WILL NOT RUN??????????? ????????? ?????? ?????? ???????????? ?????????????? ????????????????

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 10:15
I saved the file yesterday, it just won't work today.

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 10:19
I saw the program, I did "copy" created a new program, "paste" then I "ran" it and it worked.... WHY DOES NOTHING WORK ON WINDOWS "OS".

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 10:20
WINDOWS, SERIOUSLY IS THE MOST "BASKET CASE" "os" (SIC) EVER CREATED BY THE HUMAN "mind"(puke).

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 10:22
What would lead me to say this? Well, starting Dark BASIC 2 times in successive usages, leads to, IT NOT WORKING!!!!!!!!!!

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 18:02 Edited at: 16th Mar 2013 18:04
Is there a command that returns the largest or smallest of 2 or more variables, or an entire array?


Is CLEAR ENTRY BUFFER for use with Inkey$()?

What's the largest size of a string array variable, and a regular string? I've used a BASIC before that had strings that could be 32768 characters. You can have up to 5 array dimensions in Dark BASIC, what's the largest a Dimension can be? 65536? 32768?

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 18:08


I give up,.... none of the above commands work, so how do I do it as the manual does not say?

If all the "1"s are in the right place, it'll work like a charm.
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 16th Mar 2013 18:23 Edited at: 16th Mar 2013 18:24
Programming is supposed to be FUN!

Know what's NOT fun?

Looking through 32 example files, finding 6 with arrays, 2 of which have more than one, oh, and typing "dim" 32 times in FIND to look for arrays.

Did I find what I'm looking for? NO!!!!

If all the "1"s are in the right place, it'll work like a charm.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Mar 2013 20:18
In general, could you use the "Edit Post" button, rather than making several posts before someone has a chance to respond.

I cannot help you with your editor problem, I'm afraid (I don't use DBPro) but it seems like you're the only one having the issue (thus, it isn't a Windows or poorly constructed editor). Here's what I would suggest, create a new blank project with the single source file. Try to compile and run it. If it still doesn't work, try going back to the original IDE. Try the same thing. If that STILL doesn't work, I'm inclined to believe that a setting got messed up somewhere. Completely uninstall then reinstall DarkBASIC, then try again. If it still gives you trouble, come back and post EXACTLY WHAT YOU DID (what buttons you pressed, in what order). Screenshots are helpful too as someone may know what little thing to look for.

As for your array problems, keep in mind that I use DarkBASIC (not Pro) but as far as I know, you cannot initialize 2 arrays on a single line. Try:



As for finding the lowest value, if you have 2 variables, it would be easiest to use IF/ELSE/ENDIF . For an array, you would need to create a function that would operate like this:



Where the variable arraySize is however large you've dimensioned your array to be.

If you wanted to compare across multiple arrays, you'd need to run the function for several arrays (which would get tricky since you cannot pass an array as a function argument) and then use an IF/ELSE/ENDIF structure on it.

Clear Entry Buffer() only works in conjunction with the Entry$() function. Inkey$() only shows what is being pressed down, so you don't need to clear it (when you stop pressing the button, it resets to "" automatically). Note that none of these will stop you from getting a string of characters in a row, since your program is still going over that line of code ~30 times a second, so you will need some code to ensure that each press is only handled once.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Sequence
13
Years of Service
User Offline
Joined: 16th Mar 2011
Location: Canada
Posted: 19th Mar 2013 21:31 Edited at: 19th Mar 2013 21:32


If all the "1"s are in the right place, it'll work like a charm.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Mar 2013 01:51
It does not "erase everything you do" many people use Indigo without issue. The way you write your posts clearly shows that you are agitated and not thinking straight. Put it to the side, go do something else and come back when you've calmed down. Like you said "coding is supposed to be fun" so don't get worked up about it.


Login to post a reply

Server time is: 2024-03-28 19:44:43
Your offset time is: 2024-03-28 19:44:43