• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Move description line offset value?

115
Posts
9
Years
    • Seen Nov 17, 2023
    I've almost fully implemented the FR/LG summary screens for my game, but I'm running into an issue you can see in the image below:

    Move description line offset value?


    (The arrows and red lines were added to make it easier to see the text overlapping the lines. Also don't worry about the words cutting off, I plan to shorten the descriptions to fit the text box)

    I was actually able to get the first line of the description lined up correctly by editing its position in this section of code in PScreen_Summary:

    Code:
    drawTextEx(overlay,15,209,238,4,
           pbGetMessage(MessageTypes::MoveDescriptions,moveid),
           Color.new(64,64,64),Color.new(176,176,176))

    But I can't find the value that deals with the offset of each line of text in the description. The code above seems to be the only part that references move descriptions.

    Does anyone know where I can find the offset for the move description text in the summary screen?
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    The actual line offset is in def getLineBrokenChunks, but for a resource of mine, I had to mess with this value too. What I did was allow you to specify a different line offset (the lineheight argument) in drawTextEx.
    Code:
    def drawTextEx(bitmap,x,y,width,numlines,text,baseColor,shadowColor,lineheight=32)
      normtext = getLineBrokenChunks(bitmap,text,width,nil,true,lineheight)
      renderLineBrokenChunksWithShadow(bitmap,x,y,normtext,numlines*lineheight,
         baseColor,shadowColor)
      return normtext
    end
    
    def getLineBrokenChunks(bitmap,value,width,dims,plain=false,lineheight=32)
      x = 0
      y = 0
      textheight = 0
      ret = []
      if dims
        dims[0] = 0
        dims[1] = 0
      end
      re = /<c=([^>]+)>/
      reNoMatch = /<c=[^>]+>/
      return ret if !bitmap || bitmap.disposed? || width <= 0
      textmsg = value.clone
      lines = 0
      color = Font.default_color
      while (c = textmsg.slice!(/\n|[^ \r\t\f\n\-]*\-+|(\S*([ \r\t\f]?))/)) != nil
        break if c == ""
        ccheck = c
        if ccheck == "\n"
          x = 0
          y += (textheight == 0) ? bitmap.text_size("X").height : textheight
          textheight = 0
          next
        end
        if ccheck[/</] && !plain
          textcols = []
          ccheck.scan(re){ textcols.push(rgbToColor($1)) }
          words = ccheck.split(reNoMatch) # must have no matches because split can include match
        else
          textcols = []
          words = [ccheck]
        end
        for i in 0...words.length
          word = words[i]
          if word && word != ""
            textSize = bitmap.text_size(word)
            textwidth = textSize.width
            if x > 0 && x + textwidth > width
              minTextSize = bitmap.text_size(word.gsub(/\s*/,""))
              if x > 0 && x + minTextSize.width>width
                x = 0
                y += lineheight # (textheight==0) ? bitmap.text_size("X").height : textheight
                textheight = 0
              end
            end
            textheight = lineheight # [textheight,textSize.height].max
            ret.push([word,x,y,textwidth,textheight,color])
            x += textwidth
            dims[0] = x if dims && dims[0] < x
          end
          if textcols[i]
            color = textcols[i]
          end
        end
      end
      dims[1] = y + textheight if dims
      return ret
    end
    (You can put this code at the top of a section, in a new section, pretty much anywhere. Doesn't matter.)

    So you have your drawText(...., Color.new(...), Color.new(...)). That should be:
    Code:
    drawText(....., Color.new(...), Color.new(...)[b], 24[/b])

    24 being the new line offset. Just play with that number until it looks good.
     
    Back
    Top