Gargoyle
(MM club member)
2006-01-29 12:35 AM
This type of array not supported

I have the following code giving me an error and I can not figure out what it is complaining about.

Quote:

ERROR : Error in expression: this type of array not supported in expressions.!




It is complaining at this line
Quote:

$LabelG.text + @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF




I have the exact same code in another function and it works just fine.

In troubleshooting: If I ? $a immediatly after the $a=PartnerSelect() I get the expected string. If $a = "your choice" the else statement works just fine.

I also thought that it might be complaining about the use of an array on the If $b[2] = 1 line, but added a $c = $b[2] and then If $c = 1, but it still complained.

My assumption is that it is the Line before the one reported, (the if statement) that is really the problem, but not sure what I am doing wrong in writing it.

$B[x] is always a 0 or 1 and $ExVar is always 1 - 6

Code:

Function O($PU)
$ = Split($Name[$PU,3],"~")
;$N = $Name[$PU,0]
If $[2] = 1 Or $ExVar < 4
$a = PartnerSelect($PU)
If $a <> "your choice"
$b = Willing($a)
If $b[2] = 1 Or $ExVar < 4
$LabelG.text + @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF
Pause()
EndIf
Else
$LabelG.text = $LabelG.text + @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF
Pause()
EndIf
Else
;Fix the label to explain more
$LabelG.text = $LabelG.text + @CRLF + "Sorry you do not have a preference, your loss"
Pause()
EndIf
EndFunction



Les
(KiX Master)
2006-01-29 12:45 AM
Re: This type of array not supported

Try assembling the string concatenation separately to a simple var.

Gargoyle
(MM club member)
2006-01-29 12:51 AM
Re: This type of array not supported

Not sure I get what you mean... is this it...

Code:

If $a <> "your choice"
$b = Willing($a)
$c = $b[2]

If $c = 1 Or $ExVar < 4
$LabelG.text + @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF
Pause()
EndIf
Else



Because I did try that and it did not help any.


Les
(KiX Master)
2006-01-29 01:20 AM
Re: This type of array not supported

No, I was thinking to separate it from the $LabelG.text

Are you sure about the line:
$LabelG.text + @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF

SHould not it be:
$LabelG.text = @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF


Gargoyle
(MM club member)
2006-01-29 01:28 AM
Re: This type of array not supported

You are correct it should be an = not a +, but that is a typo on my part, and after correcting it, I still have the same issue.

Les
(KiX Master)
2006-01-29 01:31 AM
Re: This type of array not supported

The error usually is the result of mixing vartype. That was why I thought you might try variations on the concatenation.

LonkeroAdministrator
(KiX Master Guru)
2006-01-29 11:53 AM
Re: This type of array not supported

well, what is:
$Name[$PU,0] ???


Gargoyle
(MM club member)
2006-01-29 04:15 PM
Re: This type of array not supported

It would return a name ex: Gargoyle

ShawnAdministrator
(KiX Supporter)
2006-01-29 04:54 PM
Re: This type of array not supported

I would throw this tracer:

?"VarType=" + VarTypeName($Name[$PU,0])

and this one:

?"Value=" + $Name[$PU,0]

just before that line and check-out the values.


Les
(KiX Master)
2006-01-29 05:13 PM
Re: This type of array not supported

Just going from memory but ISTR that some COM objects have problems with certain vartypes. Might be that $LabelG.text cannot handle the expression @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF so I suggested a variation on the concatenation.
Maybe:
$String = @CRLF + $Name[$PU,0] +" Please share with " + $a + @CRLF
$LabelG.text = $String


LonkeroAdministrator
(KiX Master Guru)
2006-01-29 05:52 PM
Re: This type of array not supported

no, that would not be problem with com but with kixtart if that would be the case.

Les
(KiX Master)
2006-01-29 06:08 PM
Re: This type of array not supported

I'm not pointing fingers nor splitting hairs.

LonkeroAdministrator
(KiX Master Guru)
2006-01-29 08:22 PM
Re: This type of array not supported

neither was I.
I just said the change won't help.


Gargoyle
(MM club member)
2006-01-29 10:46 PM
Re: This type of array not supported

Return from Shawns request... $Name[$PU,0]
Quote:


VarType=String
Value=Nancy



I added this one
Quote:


VarType for $a=String
Value=Cheryl



ERROR : Error in expression: this type of array not supported in expressions.!

The last ? Value = was placed just before the line
If $a <> "your choice"

And this is with putting in the suggested
$text = @CRLF + $Name[$PU,0] +" please share with " + $a + @CRLF
$LabelG.text = $text

I still believe the real issue is the line before the reported error.. this one
If $b[2] = 1 Or $ExVar < 4

To that end I got these returns
Quote:



1=Value of $B[2]
String= Type of Var for $B[2]
1=Value of $ExVar
Long=Type of Var for $ExVar




ShawnAdministrator
(KiX Supporter)
2006-01-29 11:16 PM
Re: This type of array not supported

Well, your going to have to do what I do ... put two tracers after each line in your script (even if they just say "before" and "after" and keep moving them around until you see only the "before" tracer - do it all the time - painfull I know, but you got a general idea where it is.

Gargoyle
(MM club member)
2006-01-29 11:41 PM
Re: This type of array not supported

Okay, the results are as such

Before and After for If $b[2] = 1 Or $ExVar < 4
Before for $text = @CRLF + $Name[$PU,0] +" please share with " + $a + @CRLF
But no After, so I geuss it is that line (my bad). However what am I doing wrong in this instance of it, but can do it in other places with no problem. I am sure that it is just a simple typo or something like that....

As an example: I use this line in another function in the script and it works just fine...

Code:

$LabelG.Text = $LabelG.Text + @CRLF + $Name[$PU,0] + " You get to remove your " + $Item +". Your partner is " + $a +@CRLF



I have tried it with the $labelG.text = $labelg.text ....

But removed it when I got the same results, and did not want it at this point in the script as I am wanting to completly reassign the value of $labelG.text


Les
(KiX Master)
2006-01-30 12:15 AM
Re: This type of array not supported

Quote:

... put two tracers after each line... just say "before" and "after" and keep moving them around...



I just toss in a whole bunch at one time and number them. Saves moving them around.


ShawnAdministrator
(KiX Supporter)
2006-01-30 12:22 AM
Re: This type of array not supported

Well, Im not surprised this line would work elsewhere in your script ... seems like this is a contextual error, depends on whats happen'n at the time - a tough bug to catch but as you can appreciate, without the script, cant offer much help (speaking for myself anyways).

Gargoyle
(MM club member)
2006-01-30 01:54 AM
Re: This type of array not supported

Quote:

without the script



There in lies the problem, this script is huge and is as Shawn and Jooel know adult in nature.

Just to give you an idea of how big... The main script is only 349 lines, but the functions script is another 822, plus all the different forms scripts, and then there is the huge bitmap script (all of my base64 strings).

So with that said, I can post it or send it to anyone that wants to see how twisted of an individual I really am.


LonkeroAdministrator
(KiX Master Guru)
2006-01-30 02:08 AM
Re: This type of array not supported

so, if you change your labelG line to something like:
$LabelG.text = "stuff"

does it still error?


Gargoyle
(MM club member)
2006-01-30 02:23 AM
Re: This type of array not supported

Good call Jooel, No it does not error. So it is definatly something about how I wrote the line. Hmmm. What to do about that now. I will have to look at a different way of doing it.

Les
(KiX Master)
2006-01-30 02:56 AM
Re: This type of array not supported

So, you're saying that the line:
$text = @CRLF + $Name[$PU,0] +" please share with " + $a + @CRLF
throws the error?

Weird. What if you cast to string?
$text = "" + @CRLF + $Name[$PU,0] +" please share with " + $a + @CRLF


Gargoyle
(MM club member)
2006-01-30 05:05 AM
Re: This type of array not supported

I was wondering if this is an issue of using a label to much. The $LabelG is used as a notification window within the game, and therefore I am changing the text in the label constantly.
Is it possible that I need to "reset" the label from time to time? If so what is the best way to do that.

Les, I will try that and let you know.


Shawn I know this is more appropriate for KFORG, but since the thread is already going here....


Gargoyle
(MM club member)
2006-01-30 03:48 PM
Re: This type of array not supported

Okay Les, I tried as you suggested and got the same error.

I removed the $Name[$PU,0] and still got the error, then I removed the $a, and the error went away.

So now the question is why is $a giving me a problem... It is returned as VarType string, and it is giving me the expected result (a name)

Quote:

VarType for $a=String
Value=Cheryl





So I tried this .. $a = Cstr(PartnerSelect($PU))

Still got the error

So then I tried changing the line
$b = Willing($a)
to
$c = $a
$b = Willing($c)

Thinking that maybe the call to the Willing function was messing up $a, but that did not change the results either.

Then to further troubleshoot, I started printing $a after each step.

With that I got the expected results until I called the Willing($a) function.

Code:

Function Willing($Player)
For $ = 1 to $Count
If $Player = $Name[$,0]
$a = Split($Name[$,3],"~")
EndIf
Next
$Willing = $a
EndFunction



So I changed all of the $a in the function to $z and that has now resolved the problem.

I geuss this just goes to show that you must keep track of what variable is being passed where and doing what.

My only question then would be, I thought each function had its own exclusive variables, and would not change the variables that were used in other functions.


ShawnAdministrator
(KiX Supporter)
2006-01-30 04:07 PM
Re: This type of array not supported

You would have DIM $a in Willing() for that to work.

Gargoyle
(MM club member)
2006-01-30 04:14 PM
Re: This type of array not supported

As well I should and had planned on going back and doing all of those for each of the functions, just had not got around to doing it.

But to make sure that I understand, if I do not Dim a variable it should be considered to be global in nature, but if I dim it, it will be local to each function?


ShawnAdministrator
(KiX Supporter)
2006-01-30 04:32 PM
Re: This type of array not supported

right, and you can RETURN a locally dimmed variable (say, to a calling function), and not worry about it disappearing or anything.

LonkeroAdministrator
(KiX Master Guru)
2006-01-30 08:44 PM
Re: This type of array not supported

hmm...
nice.