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 / Graphic file location

Author
Message
SofaKing
12
Years of Service
User Offline
Joined: 6th Nov 2012
Location:
Posted: 6th Nov 2012 08:58
Hi,

First effort with DBPro and have a really dumb question:

Where do you put graphic files that you want to load into the program? I've tried copying my file to every folder I can imagine and I keep getting a "Could not load image file at line 4" error.

Thanks.
Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 6th Nov 2012 10:58
Welcome. I hope you enjoy your learning of the tool.

Always paste a snippet of your code in the post message form, highlight it and press the code button. You will get better answers to your questions more quickly.

However, I will take a wild guess that you have written something like this: Load Image "image.png", 1

In this case, providing you have saved the project; the image should go in the same folder as the project; which is where your executable (.exe) file is created by default.

If the image is in a sub-folder; then the following would be required: Load Image "subfolder\image.png", 1

What is happening is your program is being told to load an image in the current folder, which can be checked with the command Get Dir$(). If you use an absolute path as the following, the program will load the image directly. Load Image "c:\folder\image.png", 1; but this would not be good for a game release; it may get installed elsewhere.

SofaKing
12
Years of Service
User Offline
Joined: 6th Nov 2012
Location:
Posted: 6th Nov 2012 11:48
Thanks for the reply.

I've just started using Windows 7 and it doesn't want to let me save in the DB folders (some access restriction that I'm not knowledgable enough to fix). So I saved in my User folder, the project and the graphic both appear there.

But that doesn't seem to work well when I direct it with something like this: "load image "users\sk\field3.png",1". I can load the project into the editor (I assume from there) and it works (such as it is) but it won't go to the User folder to retrieve graphic, even when directed to. Obviously, I'm not getting it right at some point and I'm not real computer-savvy.

BTW- the error message is "Runtime Error 506-Could not load image at line 4." if that helps.

Thanks, again.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 6th Nov 2012 22:06
Quote: "I've just started using Windows 7 and it doesn't want to let me save in the DB folders"

Try this, it may work:
You could try locating the db install dir ([etc]\program files\dark basic software\ or \program files (x86)\ if you're on 64bit). Right-click and select "properties". Go to the security tab and select the Edit button below Groups. Now give Users and Administrators "Full Control" of the folder - actually give Everybody full control if you can. If this doesn't work or it won't let you, you'll have to turn off UAC.

Ultimately you gotta do something about pesky Windows security but you'll need to be "computer-savvy" to do it because you'll be taking responsibility for your own defense (like the good old days when I actually felt like I was in charge of the OS and not some appendage).

RP Functions Library v1.0

SofaKing
12
Years of Service
User Offline
Joined: 6th Nov 2012
Location:
Posted: 7th Nov 2012 14:05
Thanks, nonZero.
SofaKing
12
Years of Service
User Offline
Joined: 6th Nov 2012
Location:
Posted: 7th Nov 2012 14:09
Sorry...last one seems to have posted unexpectedly (talk about computer savvy!).

I will try your suggestion. I was able (I thought) to save the project in the DB Projects folder by opening the program as administrator. Seemed to do it, but there was nothing there when I tried to load the project later.

Thanks, again.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th Nov 2012 15:14
SofaKing try installing in a non Program files folder like C:\DBP I have made this move and it works fine now on Windows 8 and still works fine

Go Devils
12
Years of Service
User Offline
Joined: 13th Aug 2012
Location:
Posted: 9th Nov 2012 05:26
Hi sofaking

First, make sure that you understand the windows directory and file PATH structure

MrValentine is correct. Don't try to create your projects in the DBpro program folder (C:\program files\game creator\etc...)

I would create a general development folder (somewhere else), and then an internal folder for each project.

With these in place, create another internal folder called something like "MEDIA" in each project folder. Here you will place all files and object folders that will be loaded into your program.

If you make these names consistent from project to project it will make it much easier for you to remember and write (or reuse) your code.

OK, once all is in place, than inside your program, a line before you actually load the object or texture, use the SET DIR (set directory) command to the location of the object or texture files..

(example) Set dir "c:\generalfolder\projectfolder\media\Object Folder\File Name.x" (or .3ds or .dbo or texture format).

Once you understand this structure you can create an array with all of the information needed to load each object, texture it, position it, rotate, etc.

Below is a part of the system I'm using and it seems to work well. I have an array set called...

dim infomatrix$(100,20).

This array holds the information for 100 objects and/or textures, Each of the twenty positions is a different piece of information regarding the values that the load and position statements require... The following is one of the subroutines I use to load an .X object.

dotXobj;
(line 1) set dir "E:\DarkBasic\Projects\Base Matrix Movement and Skybox code"
(line 2) LOAD OBJECT infomatrix(x,2),val(infomatrix(x,1)),0,0
(line 3) SET OBJECT TRANSPARENCY val(infomatrix(x,1)),val(infomatrix(x,17))
(line 4) POSITION OBJECT val(infomatrix(x,1)),val(infomatrix(x,6)),val(infomatrix(x,7)),val(infomatrix(x,8))
(line 5) SCALE OBJECT val(infomatrix(x,1)), val(infomatrix(x,12)), val(infomatrix(x,13)), val(infomatrix(x,14))
(line 6) ROTATE OBJECT val(infomatrix(x,1)), val(infomatrix(x,9)), val(infomatrix(x,10)), val(infomatrix(x,11))
return

The first line points to the basic project directory. infomatrix$(x,2) is the remainder of the path to the actual file
(example "\media\objectfolder\filename.x"
Infomatrix$(x,1) is the object number


Hope this helps
hclayton
14
Years of Service
User Offline
Joined: 13th Nov 2010
Location: US
Posted: 9th Nov 2012 21:01
Not sure, but could be related to program not being set to run in administrator mode. Does a box appear when you start Darkbasic that ask to allow changes be made by this program? I had that problem at first when switched to Win7.
If this is problem, if you right click on icon on desktop, then select properties at bottem. Click on Compatibility tab and near the bottem is Privilege Level box. Make sure the Run this program as an administrator is checked.
Hope this helps

Login to post a reply

Server time is: 2024-11-23 17:34:07
Your offset time is: 2024-11-23 17:34:07