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 / Text to image problems

Author
Message
Satchmo
20
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 21st Sep 2008 22:28
Well I've been trying to convert a string variable into an image, but it's not working, it's just giving me a black square.


Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 22nd Sep 2008 17:52 Edited at: 22nd Sep 2008 20:05
All your problems are here.



First of all don't "undim item$()" you're just about to use it.

"text 0,0,left$(item$(n),len(item$)-5)" should be - "text 0,0,left$(item$(n),len(item$(n))-4)"
You forgot the (n) and -5 will erase the last letter of your file name unless your extensions are four long.

Your text color is (255,255,255) and the box color is (255,255,255), you're not going to see anything if they're both white. Use a ink RGB(9,0,0) as Black for your text. Lower than that will be transparant and you also wont see a thing.

Your cls will also clear your box drawn. Use ink 0,0 : box 0,0,110,15 to clear your text instead.

Anyways try using this code, it saves more space and memory.

Satchmo
20
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 22nd Sep 2008 23:51
Quote: "First of all don't "undim item$()" you're just about to use it"


Whoops! I cant believe I missed that.

Quote: ""text 0,0,left$(item$(n),len(item$)-5)" should be - "text 0,0,left$(item$(n),len(item$(n))-4)"
You forgot the (n) and -5 will erase the last letter of your file name unless your extensions are four long."


Yes my extensions are four long .ZLVL

Alright, I tried it, and now it displays correctly, but for some reason, it won't detect collision with the sprites, and it's displaying one of my sprites left the top left corner.




Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Sep 2008 00:51 Edited at: 23rd Sep 2008 00:56
This will be easier to help if you show what's going on in your main loop. I cant really tell what the other variables and sprites are doing. For example it'll help to know what "paste sprite 16,200,230" is for or looks like.



If you're just trying to find it it collides you can try this.


sprite collision(Sprite,TargetSprite)
If you set the TargetSprite to 0 the command return any sprite number that collides with your sprite.

Login to post a reply

Server time is: 2025-06-07 06:41:08
Your offset time is: 2025-06-07 06:41:08