Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Alright, now I've successfully caused a new problem:

So far, truncate_text runs fine until it actually has to cut something off. Whenever I set ysize or a surrounding fixed to a value smaller than what could contain the full text, it throws the error above. For example:

truncate_text last_phrase text_size 20 ysize 30

Here, last_phrase gets information attached to each save file and is defined on the save screen:

$ last_phrase = FileJson(slot, "last_line", empty="", missing=" ")

While "last_line" is obtained like this:

def the_lastline(d):
      mylast_line = getattr(store, '_last_raw_what', '',)
      if not mylast_line:
          mylast_line = getattr(store, '_last_choice_what', '',)
      if mylast_line == "ending":
          line_take = str(len(true_endings))+ _("/14 Rehabilitated")
      else:
          line_take = renpy.substitute(renpy.filter_text_tags(mylast_line, allow=[]))
          line_take = line_take.replace("\n", "")
          line_take = line_take.replace("\\", "")
          line_take = "\"" + line_take + "\""
          if line_take == "\"\"":
              line_take = ""
      d["last_line"] = line_take 

I don't really know what's going on here, but I could imagine "_last_raw_what" is the issue (getting dialogue text instead of "normal" text). 

Any idea for a workaround to make it compatible with truncate_text?

(+1)

Actually I think this is a very funny one - do you have a character named re? That's the name I imported the regex library under. I should probably put this in a separate namespace to avoid this kind of issue lol. If that's the case,  then you can update `import re` to `import re as regex` and change all the `re.` method calls to `regex.` method calls.

That was it, thank you! It works perfectly now.

Small update to let you know I modified the v1.2 files to put the code in its own namespace! Hopefully that will help someone avoid a similar problem. Thanks for pointing it out!