Page 1 of 1

incompatible types?

PostPosted: Tue Feb 05, 2008 4:07 pm
by asmodeus
Why doesn't this work?: I create a variable called test_var[5][5]. I write test_var = 0; in the script editor and it tells me "incompatible types". How can I avoid this problem?

Re: incompatible types?

PostPosted: Tue Feb 05, 2008 4:15 pm
by makslane
Are you trying to change the adrees of the variable test_var to 0.
What you want to do?

Re: incompatible types?

PostPosted: Tue Feb 05, 2008 6:02 pm
by asmodeus
No, I want to read the value to get a color for the setpen function. (setpen(test_var[...)

Re: incompatible types?

PostPosted: Tue Feb 05, 2008 6:30 pm
by makslane
Try use:


test_var[0][0] = somevalue;

Or somevalue = test_var[0][0];

Re: incompatible types?

PostPosted: Tue Feb 05, 2008 6:37 pm
by asmodeus
The problem is, that I want to write a variable name and "+", "-", "/", "*" instead of only a number.
in my game it is [320/2-320*vari+xcount*var] and that in both arrays.
If I use it only in one of them and write a single number in the other array, than it works.

Re: incompatible types?

PostPosted: Tue Feb 05, 2008 7:30 pm
by makslane
Try this:

Code: Select all
test_var[320/2-320*vari+xcount*var][320/2-320*vari+xcount*var] = somevalue;


Or:

Code: Select all
double index = 320/2-320*vari+xcount*var;
test_var[index][index] = somevalue;

Re: incompatible types?

PostPosted: Wed Feb 06, 2008 12:27 pm
by asmodeus
first: It doesn't work, yet. :?: :( (view screenshot)
second: I don't want to change the value from the test_var with the arrays, I want to read the value and put the value in another variable.

Re: incompatible types?

PostPosted: Wed Feb 06, 2008 12:34 pm
by makslane

Re: incompatible types?

PostPosted: Wed Feb 06, 2008 12:42 pm
by asmodeus
Thanks! That was the problem, I think. :D