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 Professional Discussion / Problem with Get Image

Author
Message
Christoffer
15
Years of Service
User Offline
Joined: 8th Feb 2011
Location: Sweden
Posted: 22nd Jul 2011 01:52
Hi there, i have a small problem..
When i try to use Get Image with predefined variables it gives me an error saying ".....illegal area at line blah blah"
but when i use it with integers directly it works.
Here is an example.

This will give me that error.



While this will work without errors but does not do what i want.


Maby i'm going all wrong on this, any suggestions?
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 22nd Jul 2011 08:16 Edited at: 22nd Jul 2011 08:24
How big is the image you load?

try this...



Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Jul 2011 11:01
If you go outside of the size of the bitmap with GET IMAGE it'll produce that error. To test it out load it as bitmap zero instead and make a box over where each GET IMAGE would be to see if it's going to grab the right area.



If that's going to be a sprite eventually you should look up the CREATE ANIMATED SPRITE command... it's much easier to use.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jul 2011 12:48
I guess the reason it works in one case and not the other is because you are grabbing different areas of the bitmap and I'd also guess in your first case you are doing what the error message says.

In your non-working snippet you are incrementing x by 116 so your 8th get image is actually grabbing the region 812, 0, 928, 68. But your working snippet is grabbing the same region in each case. Perhaps your bitmap is not at least 928 pixels wide?
Christoffer
15
Years of Service
User Offline
Joined: 8th Feb 2011
Location: Sweden
Posted: 22nd Jul 2011 14:32
I have tried Rich Dersheimer suggestion and it still not work.
i did even try with this


This will still give the error, and the image is bigger that.. :S
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jul 2011 16:22
That code works fine for me so something else must be the problem.

Which version of DBPro and the Editor are you using (look at Help/About)?
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Jul 2011 18:14
Quote: "This will still give the error, and the image is bigger that.. :S"


The same error or a different error like "Could not load bitmap.". Perhaps the image is corrupt... attach it to your next message.

Christoffer
15
Years of Service
User Offline
Joined: 8th Feb 2011
Location: Sweden
Posted: 23rd Jul 2011 01:14
Well i did not work then, but it works now, well without errors anyway... haha i don't know really what i did, but thanks for all the help!

This is how the code looks now:


I think it was when i used a variable from outside the for loop? maby it's a bug but i tried run it in the lates ide that comes with dbp and i usally use Indigo, same error there.

Well it works now with that code. (made sure all the perimeter is inside the image)

thanks all!

Login to post a reply

Server time is: 2026-07-11 12:03:05
Your offset time is: 2026-07-11 12:03:05