illegal type conversion in function

Blitz3D Forums/Blitz3D Beginners Area/illegal type conversion in function

Second Chance(Posted 2003) [#1]
Can anyone tell me why I'm getting an "Illegal type conversion" error during compiling of this function? The first line after the function declaration is the first problem, but what's wrong with it?

btw - It uses the XLnt GUI functions.

Function Recalc()
ship\CATnum = CATtype$(gui_gadval(hullSelector)+hullMin)
ship\CATdesc$ = CATtype$(gui_gadval(hullSelector)+(10+hullMin))
ship\hullVolFac# = CATtype$(gui_gadval(hullSelector)+(20+hullMin))
ship\hullVol# = ship\volTotal# * ship\hullVolFac#
ship\volRemain# = ship\volTotal# - ship\hullVol#
ship\cost = ship\hullCost
gui_settext(category,"Mass Category: "+ship\massCategory$)
gui_settext(categoryNum,"Mass Category Number: "+ship\massCategoryNum)
gui_settext(volT,"Total Volume: "+ship\volTotal)

gui_settext(hullSelector,ship\hullsAvail$)
gui_settext(CATnum,"CAT: "+ship\CATnum)
gui_settext(catText,"Hull Material: "+ship\CATdesc$)
gui_settext(catVol,"Hull Volume: "+ship\hullVol#)
gui_settext(hullCost,"Hull Cost: "+ship\hullCost)

gui_settext(costT,"Total Cost: "+ ship\cost)
gui_settext(volR,"Volume Remaining: "+ship\volRemain#)
End Function

I've tried setting the object of the type ship to Global but it didn't matter.


Koriolis(Posted 2003) [#2]
I suppose "hullSelector" is an instance of Gadget. Have you checked it's global? if it's not then the compiler will take it as an int -> invalid conversion (int -> object).
I don't see anything else that could lead to an invalid conversion (given that ship is global, and hullMin is not an object).


Second Chance(Posted 2003) [#3]
Yep, you were right. Globalization was definitely the problem. None of the XLnt objects were global and so they weren't recognized in the function. Thanks.


GfK(Posted 2003) [#4]
<snip>


Second Chance(Posted 2003) [#5]
??? I don't know that one.


Yappy(Posted 2003) [#6]
doh! - didn't u get my email?


Second Chance(Posted 2003) [#7]
Thanks Yappy, yes I got it. But I didn't get to it in time before this got posted. Sorry I didn't let you know right away. Thanks very much to you both :)