Page 1 of 1

animpos -> switch expression not integral???

PostPosted: Tue May 10, 2011 10:58 am
by sonicfire
Code: Select all
switch (myactor.animpos)
{
case 0:
// do this
break;
case 1:
// do that
break;
}


error: switch expression not integral? huh?
animpos is integer, right ? :shock:

Re: animpos -> switch expression not integral???

PostPosted: Tue May 10, 2011 11:19 am
by rykein
Code: Select all
switch ((int)myactor.animpos)
{
case 0:
// do this
break;
case 1:
// do that
break;
}

Re: animpos -> switch expression not integral???

PostPosted: Tue May 10, 2011 11:36 am
by sonicfire
thanks!!
this is something i never understood -> that cast thing.
so, animpos is NOT integer? but with (int) i force switch to interpret animpos as integer?

Re: animpos -> switch expression not integral???

PostPosted: Tue May 10, 2011 7:22 pm
by savvy
no, animpos is an integer. otherwise you couldn't set it on a textNumber. its just that in switch you need to tell it that its an integer.
otherwise it reads it as some random obscure thing which it doesnt know.