Sir-Elif lazily assumes every letter is a punctuation mark despite that being a lie

Godot Version

v4.4.2.stable.official

Question

These loops make the dialogue typewriter much slower on every stroke, whenst it’d usually be at a normal 0.03 second delay! I wouldn’t normally ask, but I unfortunately have not even a clue what is the source of the malfunction… the attached image oughta help in diagnosing the problem:


Aswell as the scenea del crime, for your purveyance. (But most likely entirely unimportant.):
2
Oh, and everything else works perfectly!!!

This is a bit of a logical issue in your code. When you write elif possum.substr(zoop,1) == "." or "!" or "?": you are actually checking 3 different things with the or operator, not checking if the substring is equal to one of them. It is interpreted as (possum.substr(zoop,1) == ".") or ("!") or ("?").

Since a non-empty string is always considered true, this branch will always be executed.

You actually want to do something like this, as an example:

var character = possum.substr(zoop, 1)
if character == "." or character == "!" or character == "?":
    pausiusMaximus = 10

I’m adding the character variable to avoid calling the substr() function every time.

PS: It’s easier if you paste the code here (well formatted), so one can copy when doing the reply, instead of typing everything again.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.