Manual suggestion

Posted By: Error014

Manual suggestion - 12/16/12 14:14

Hey there!

This is not a mistake or anything in the manual, just a friendly suggestion. I recently had some trouble with this error message:

Quote:

Warning W1553 - Can't create alpha
The texture has no standard content (BMP, PCX, or TGA) and can't be automatically converted to an overlay or alpha texture. This warning is only issued when the warn_level variable is set to 1 or above


The problem was totally on my end (a wrongly set format in bmap_createblack (888)), but it was very difficult to find, since the above doesn't really give a starting point. Consider that for a stupid idiot like me, it might not be obvious what constitutes "standard content" (does bmap_createblack create "standard content"?), and what is necessary for "automatic conversion"?

I had to do a google search bringing me to this topic, which prompted me to do the investigation regarding bmap_blit (which in turn led me to check the different formats).
The whole mess was even more confusing, as I used this bitmap using ent_setskin for an entity that didn't had OVERLAY or TRANSLUCENT set.
What I'm saying is: This problem can be hard to debug. Some direction would be helpful! laugh


Of course I realize that in hindsight, this is an obvious problem, but I'm sure I don't have to tell you that those can still be difficult to make out in larger projects. A sentence like this in the manual would be helpful in providing a starting point.

Quote:

This can happen if you're using a dynamically created bitmap with a wrong format that Acknex does not create an alpha channel for. Check if the bitmap you're trying to display has a format with no alpha channel (such as 888, 565, ...).



~~

I've always liked that you included the "Programming Trouble: FAQ" in the manual (unfortunately a bit hard to find) - I believe thats a great idea especially given Gamestudio's target audience. Perhaps we could have a thread where users can suggest new questions and sections to add to this, so that in cases like the above, the user would know where to start looking?
In that case, the above could also be turned into a new question there.

Posted By: jcl

Re: Manual suggestion - 12/17/12 08:17

Thanks, we'll make that more clear in the manual. Please post here also if something in the manual was not outright wrong, but hard to understand.
Posted By: Error014

Re: Manual suggestion - 12/21/12 19:31

Again a suggestion - this is even less of an issue than the above, but I remember having a bit of trouble with this at first, and it's so easily fixed that I'll just suggest it here:

Lite-C apparently cannot automatically convert char to var, which is to say that something like this:

Code:
char mychar;
	mychar = 65; //Ascii for "A"
	str_setchr(mystring,1,mychar);



does not work. Since str_setchr expects the "var" type, even str_setchr(mystring,1,(var) mychar) (which I assume might be something a beginner might try, I believe I did once) would not work. You have to automatically convert to Integer beforehand:

Code:
str_setchr(mystring,1,(int) mychar);



So, none of this is news to you, of course, and it isn't overly difficult. But there's no mention of this need anywhere in the manual (or, if there is, it's too difficult to find).
Personally, I like using "char" instead of "int" if I know that it's enough to save some memory, so I encounter this kind of issue every now and then.

So here's what I suggest: There's a "Variables"-section in the manual, where you give an overview about the different types.
Perhaps you could add something like:

Quote:

Most of Acknex functions expect the var-type - the manual always states what type is expected. Types are automatically converted to var for you, so you usually don't have to worry about this. However, char types are not automatically converted to var - you'll have to convert to int first:

str_setchr(mystring,1,(int) mychartype);




EDIT: Or, who knows, maybe this is a bug (or oversight). Either way, it's now reported, sorry if it's now in the wrong place. laugh
Posted By: jcl

Re: Manual suggestion - 12/23/12 08:10

What you found is in fact a missing implicit conversion type. C languages should convert all numeric variables automatically. char -> fixed was just not implemented - we had not noticed it so far. We'll implement it in the next version.
Posted By: Error014

Re: Manual suggestion - 12/24/12 01:22

That's good news, thank you!

Minor thought: Maybe we can avoid some confusion if we add an example to the "casting"-section in the "variables"-part of the manual that actually converts the char 48 (= '0') and gets 48 as a result.
Just an idea - maybe some people who are used to, say, PHP, would get confused if they see their '0's getting converted to something they didn't expect.
© 2023 lite-C Forums