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 / Crash after creating large number of images

Author
Message
Trek
21
Years of Service
User Offline
Joined: 21st May 2005
Location: NJ, USA
Posted: 6th Jun 2012 17:10
Hi everyone,

I'm writing a game that requires a lot of text labels on 3D objects (see attached screenshot).

In order to do this, I wrote the following function to create a simple image with the desired text which I then apply to a plain object:



However, after creating about 100 of these images, it crashes the program. Does anyone know why this is or if there is a better way to be doing this?

Thanks,

David

Check out my website http://roborangers.home.comcast.net/Trek.html
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Jun 2012 17:57
The following works perfectly for me. Perhaps the problem is somewhere else in your code. Incidentally, what is the parameter "lines" for?

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jun 2012 18:04
It shouldn't crash, you must have a mistake in your program somewhere.

Trek
21
Years of Service
User Offline
Joined: 21st May 2005
Location: NJ, USA
Posted: 13th Jun 2012 12:15
Thank you for the quick and helpful replies. Sorry for not responding earlier - I didn't get e-mail notifications that the topic was approved and posts were made like I was expecting.

The parameter lines is for the future addition of being able to break up the message over multiple lines (something that I plan to work on now).

I'll see if I can find what else might be causing the error - it's strange, though, because when I comment out the line to that function call, it starts working again.

Check out my website http://roborangers.home.comcast.net/Trek.html
Trek
21
Years of Service
User Offline
Joined: 21st May 2005
Location: NJ, USA
Posted: 13th Jun 2012 12:30
*Moderator note: If you'd like, you can combine this message with the one I just submitted - I would normally be editing it so as not to double post*

The issue is resolved! I found that my problem was that I was sending it text lengths which were causing it to try to take a portion of the bitmap wider than 640 pixels which was causing it to crash since the bitmap I created was only that wide.

I just need to either make that bitmap wider or break it into multiple lines which is what the parameter was for.

Thank you both for your help and especially Green Gandalf for your helpful code snippet.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Jun 2012 00:35 Edited at: 14th Jun 2012 00:35
There's a big difference between a crash and a runtime error.

A crash will end the program unexpectedly and you'll get a windows message that may be indecipherable to you.

A runtime error will tell you what the error was and where it occurred: Runtime Error 504 - Cannot grab image due to an illegal area at line xxxx

Another difference is that the first can be difficult to trace, while the second would take the usually forum-dweller here about 30 seconds to explain to you.

Either way, if you hit CTRL-C on the message that appears before hitting the enter key, it will capture the message content so that you can post it to the forums in future and make it easy for people to help you

This particular error copies the following:
Quote: "
---------------------------
Error
---------------------------
Runtime Error 504 - Cannot grab image due to an illegal area at line 5
---------------------------
OK
---------------------------
"


Login to post a reply

Server time is: 2026-07-08 01:55:34
Your offset time is: 2026-07-08 01:55:34