<b>Question:</b>"Hello!
I'm making something that you can see the code of the color, but what i must use?
I have use this but it doesn't works!
CODE:
var tmp;
tmp=get_color(0);
if tmp>-1
message_caption(true,'CODE:')
show_message(tmp)"
<b>Answer:</b> The problem you have is a really common problem. It is caused by the difference between the two types of variables: the kind that contains a real value and the kind that contains a string value. Show message will probably not write a real value, which get_color will return. To fix this you must either convert the value before assigning it to the variable or you must temporarily "translate the value". To do the first, simply change:
tmp=get_color(0);
Into
tmp=string(get_color(0));
For the second, do the following, change:
show_message(tmp);
Into
show_message(string(tmp));
Some further reading about the generalized error type and the two different kind of values is to be found here:
http://gmtutorials.com/article/easy/cannot-compare-arguments/
.
Users logged in:
Comments
Loading comments...