TypeError: line.replace is not a function

First time I have ever seen this error…

Upon running quickest I receive
QUICKTEST FAILED
TypeError: line.replace is not a function

Randomtest works just fine. Any ideas what this could be?

I’ve never seen that before! Can you show us the line that’s throwing that error?

1 Like

That’s one problem, I have no idea how to check what line is creating the problem!
Will it help if I paste the string that quickest gave me? I don’t know how to read it…

Quicktest of final scene

thecity
executing
thecity,9#1 (10)
thecity,9#2 (16)
thecity,9#1 (10),54#1 (55)
thecity,9#1 (10),54#2 (59)
thecity,9#1 (10),54#1 (55),71#1 (72)
thecity,9#1 (10),54#1 (55),71#2 (74)
thecity,9#1 (10),54#1 (55),71#3 (76)
thecity,9#1 (10),54#1 (55),71#4 (78)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93)
thecity,9#1 (10),54#1 (55),71#1 (72),92#2 (99)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),107F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),109F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),115#1 (116)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),115#2 (119)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,249F,252F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,249F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,276F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#2 (468)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#1 (189)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#2 (193)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#3 (207)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,134F,148F,162F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,134F,148F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,134F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,226F,229F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,226F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,404F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,340F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#1 (285)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#2 (293)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#3 (301)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#4 (309)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#5 (317)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#6 (325)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F,502F,505F,508F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F,502F,505F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F,502F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),513F,515F,517F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),513F,515F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),513F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),541#1 (542)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),541#2 (546)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),541#3 (550)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#2 (468),480#1 (481)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#2 (468),480#2 (488)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#2 (193),195F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#3 (207),209F,214F,219F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#3 (207),209F,214F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,188#3 (207),209F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#1 (412)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#2 (420)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#3 (428)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#4 (436)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#5 (444)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,327F,408F,411#6 (452)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#1 (349)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#2 (357)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#3 (365)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#4 (373)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#5 (381)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,263F,345F,348#6 (389)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#1 (285),289F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#2 (293),297F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#3 (301),305F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#4 (309),313F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,281F,284#5 (317),321F
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F,502F,505F,4537#1 (4538)
thecity,9#1 (10),54#1 (55),71#1 (72),92#1 (93),113F,122F,126F,462#1 (463),496F,499F,502F,6489F,6491F,6493F,6495F
QUICKTEST FAILED
TypeError: line.replace is not a function

At the risk of asking the obvious, does the string “line.replace” appear anywhere in your code?

Nope :sweat_smile:

It may well be a bug, then. @dfabulich will know how to deal with it. We’ll await his guidance.

1 Like

Did you try using the .bat file to run quicktest? For the latest versions of choicescript, the .html files had some issues which were resolved by running the .bat equivalents.

I had to use the .bat complie file to compile one of my games, since the .html version threw up an error.

1 Like

I’m using CSIDE, how would I use the .bat file?

I’ve never used CSIDE (I’m just too used to traditional choicescript on notepad), but download choicescript from github, replace all the ingame text files with the text files from your game (web/mygame/scenes/), then go to the outermost folder and run this file.

Edit:It may be something with CSIDE, so try the quicktest .html file too.

1 Like

I’ll try this when I get home from work and post an update.

Thank you

1 Like

No luck…

Edit: Is it possible that the chapter is just too long?

Hmm… could you break up the chapter into separate txt files to isolate the problem? (I am scratching my head too.)

How long are we talking?

I don’t think this is the case – mainly bc I did get the “your scene is too long” error message (at around 300K words) and remember it as being pretty straightforward, not confusing.

*if destinations_visited = 1
    *goto devontown
*elseif destinations_visited = 2
    *goto bigcityromance
*elseif destinations_visited = 3
    *goto minorhousesnegotiate
*elseif destinations_visited = 4
    destinations_visited = 
    *print destinations_visited
    ${destinations_visited}
    *elseif destinations_visited = 0
    *print destinations_visited
    ${destinations_visited}
*else
    destinations_visited = 
    *print destinations_visited
    ${destinations_visited}
    *goto bug
*label bug
*bug ${destinations_visited}
*label devontown
*if sexuality =2
    *set brother 2
    *set priest 2
*if sexuality >= 3
    *rand brother  1 2
    *rand priest 1 2

If you take out this section of code from the thecity.txtfile, quicktest passes. I’m out of brain juice, so could someone look at this code and figure out the problem?

1 Like

Uh oh. Is that really a thing? I never heard of that before. I’ve got a chapter in Tea and Scones that’s sitting at 586,000 words, and it passes Quicksave. What causes the “too long” error?

I would run a search for line.replace just in case as I’ve never seen that error.

Also agree that if you get weird errors that aren’t making sense, try the .bat files first before looking further. I spent large amounts of time trying to track down errors that didn’t actually exist on a recent project because there’s something going on with the html versions at times.

Otherwise you’re probably where I was a while back *ending the scene in places and work through it with tests until you identify where the problem might be.

It’s interesting that I think it looks like your last two lines are duplicate. What’s going on around the vicinity of line 462? (Bear in mind it could be somewhere between that line and the choice before it, or the choice after this one, probably related to selection 1. It isn’t always on line 462).

1 Like

This passes quicktest :+1:

*comment Sequence travel scenes based on the number of destinations visited.
*if destinations_visited = 1
    *goto devontown
*elseif destinations_visited = 2
    *goto bigcityromance
*elseif destinations_visited = 3
    *goto minorhousesnegotiate
*elseif destinations_visited = 4
    *comment destinations_visited = 
    *comment *print destinations_visited
    *comment ${destinations_visited}
    *comment *elseif destinations_visited = 0
    *comment *print destinations_visited
    *comment ${destinations_visited}
    *comment VANCE - I added the goto below
    *goto minorhousesnegotiate
*else
    *comment destinations_visited = 
    *comment *print destinations_visited
    *comment ${destinations_visited}
    *goto bug
*label bug
*comment *bug ${destinations_visited}

This fails quicktest :-1:

*comment Sequence travel scenes based on the number of destinations visited.
*if destinations_visited = 1
    *goto devontown
*elseif destinations_visited = 2
    *goto bigcityromance
*elseif destinations_visited = 3
    *goto minorhousesnegotiate
*elseif destinations_visited = 4
    destinations_visited = 
    *print destinations_visited
    ${destinations_visited}
    *elseif destinations_visited = 0
    *print destinations_visited
    ${destinations_visited}
*else
    destinations_visited = 
    *print destinations_visited
    ${destinations_visited}
    *goto bug

We’ve isolated the problem, now we just need to head in for the kill.

2 Likes

You have something that is indented on a line or under a choice and the code thinks it’s a command, but there is no # or * in front of it.

4 Likes

Is it an incorrect spacing on this line?

3 Likes

I deleted that part and now it seems to work. I guess it was something to do with the weird spacing I did while trying to isolate the problem on a different bug.

For posterity, the specific problem was

*elseif destinations_visited = 4
    *print destinations_visited

More specifically, the *print destinations_visited. Changing that into a different variable in curly brackets causes an “Invalid expression, couldn’t extract another token” error.

Anyway, a big thank you to everyone who gave ideas about how to solve this problem. I would never have figured it out alone.

2 Likes