[Solved] Quicktest: There is no character at position 1.5. "?" is only 1 characters long


#1

Not sure what to make of this…
Quicktest is telling me:
There is no character at position 1.5. “?” is only 1 characters long.

I’m trying to understand what it means by “position 1.5”


#2

Is there a hard return in your code line?


#3

As in, am I pressing Enter to go to the next line? That kind of hard return? Yeah, everywhere


#4

Sorry for stating the obvious, have you searched for the stray question mark on your code document? Is it possible that you hit return prior to hitting the question mark and then hit a second hard return?


#5

Looking at paragraph marks. I don’t see a second hard return…


#6

I am really intrigued by this question. I can’t imagine what’s going on here. Any luck figuring out the problem?


#7

Some screenshots of the indicated line of the error and the error message itself will surely help a lot.


#8

Not yet. Working on it. Still trying to understand what “position 1.5” means.
Sorry to bother everyone.
It’s weird because when I play through it works fine, it just won’t pass Quicktest right now.
I’ll keep at it!

And sorry for not posting code, the Quicktest error comes up at line 1220 and there’s about 5200 or so lines of pure code in this scene, so I don’t want to distract anyone from their own writing or projects. Don’t worry, I’ll get it! :smiley:

I think if I just understood what Quicktest means by “position 1.5” then I could figure it out.


#9

If you solved it please let us know
I think you should upload it as us ( people having lots of time to kill :sweat_smile: ) will surely love to help


#10

Got the scene to pass when I took out a few blocks of code.
But that means I have to sacrifice some functionality.
Will continue working on it and will update when I get something.


#11

@Carlos.R. Are you using notepad++ or one of the dedicated word processors designed for making IF? It makes it so much easier to find bugs!

If you can post the lines around that numbered line (Notepad numbers them for you) it might help. It also has guide lines so it’s easier to see if you’ve accidently put a stray space and such like. (I used to use a standard word processor when I started and it drove me crazy).


#12

Yep, I am using Notepad++ to help me track down what’s going on. :slight_smile:

It’s an equation that’s throwing everything off, but I do have it narrowed down to two particular lines of code.
Now I have to retrace my steps and find out what I did.

Math. :dizzy_face:


#13

That the error when you’re searching the length of something and the length is not valid. The command you’re using is something like foo#bar where bar is equal to 1.5 (Search your code for pound signs (#).

(I’ll bring up making a more specific error report for this.)


#14

Ok, here’s where I’m at right now…

Here are two relevant snippets of code:

*if length(td2) >= 4
 *set ddc (length(td2) / 2) + 1
 *gosub cc4

That piece there goes into this:

*label cc4
*set dcl length(td2)
*if ddc < dcl
 *if td3 = "?"
  *set td3 (td2#ddc)
 *if td3 != "?"
  *set td3 td3&(td2#ddc)
 *set ddc + 1
 *goto cc4
*return

As you can see in the first snippet, it’s only supposed to modify ddc if the length of td2 is greater than or equal to 4.

However, there are some times when the length of td2 is less than 4 – that’s why I put the *if statement

I believe Quicktest is processing the equation (even behind the *if statement) at a length of less than 4 to give me the “position 1.5” error.

Not yet sure how to proceed… thinking about it.


#15

If the length of td2 is odd when that first bit of code, (say, td2 = "a", then ddc will be fractional. (In the case of td2 = "a", then ddc = 1.5. Then, when you run the second bit you hit td2#ddc which looks for the one and a halfth character in td2. What is the one in the halfth character in td2 at that point? (Hint, if you answer that question, you’re wrong.)

(Also, I have no idea what you’re trying to accomplish with this code, but I don’t think it’s doing what you think it’s doing. That said, my wild guess in a dark recommendations are to either turn that first *set to *set ddc length(td2) or to *set ddc round(length(td2)/2+1).)


#17

Okay so I figured it out!

Inside *label cc4 I have a *set command that was throwing off things because it was unintentionally part of a loop sequence.

I ended up putting this *set dcl length(td2) somewhere earlier on and everything is good now.

Functionality is restored and Quicktest = passed!