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 / "Sprite alpha value illegal" Error, can anyone help?

Author
Message
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 3rd Feb 2011 05:46 Edited at: 3rd Feb 2011 06:00
Hi,

I get this error even though the value I pass to the command cannot be outside the range 0-255, here's the code:



I only seem to get the error randomly, anyone got any idea why this might happen?

Thanks,
Broken_Code

[EDIT]
OK, after some testing it seems the value it throws up the error at is -1, how does that get past the checks?
Thanks,
Broken_Code
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 3rd Feb 2011 06:06
Alright, changing it to:


Stopped me getting the error, again, anyone know why? I'm running quite an old version of the editor and compiler due to being on win7 and none of the updates playing fair with it, could that be the issue?

Thanks,
Broken_Code
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Feb 2011 08:17
It'll be because that <0.0 is only checked if it's >1.0

if temp#>1.0 then temp#=1.0 : if temp#<0.0 then temp#=0.0

That's the equivalent of:

if temp#>1.0
temp#=1.0
if temp#<0.0 then temp#=0.0
endif

So you fixed it yourself by seperating that second condition check, so it's no longer part of the first check.

Health, Ammo, and bacon and eggs!
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 6th Feb 2011 00:20
Really? I didn't know that, well you learn something new every day, and with that I've filled my quota!

Thanks Van B,
Broken_Code

Login to post a reply

Server time is: 2026-07-17 18:53:20
Your offset time is: 2026-07-17 18:53:20