|
|
|||||||
I have the following code giving me an error and I can not figure out what it is complaining about. Quote: It is complaining at this line Quote: 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:
|
||||||||
|
|
|||||||
Try assembling the string concatenation separately to a simple var. |
||||||||
|
|
|||||||
Not sure I get what you mean... is this it... Code:
Because I did try that and it did not help any. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
The error usually is the result of mixing vartype. That was why I thought you might try variations on the concatenation. |
||||||||
|
|
|||||||
well, what is: $Name[$PU,0] ??? |
||||||||
|
|
|||||||
It would return a name ex: Gargoyle |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
no, that would not be problem with com but with kixtart if that would be the case. |
||||||||
|
|
|||||||
I'm not pointing fingers nor splitting hairs. |
||||||||
|
|
|||||||
neither was I. I just said the change won't help. |
||||||||
|
|
|||||||
Return from Shawns request... $Name[$PU,0] Quote: I added this one Quote: 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: |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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:
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 |
||||||||
|
|
|||||||
Quote: I just toss in a whole bunch at one time and number them. Saves moving them around. |
||||||||
|
|
|||||||
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). |
||||||||
|
|
|||||||
Quote: 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. |
||||||||
|
|
|||||||
so, if you change your labelG line to something like: $LabelG.text = "stuff" does it still error? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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.... |
||||||||
|
|
|||||||
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: 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:
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. |
||||||||
|
|
|||||||
You would have DIM $a in Willing() for that to work. |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
right, and you can RETURN a locally dimmed variable (say, to a calling function), and not worry about it disappearing or anything. |
||||||||
|
|
|||||||
hmm... nice. |