Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Script that removes junk symbol (squares like that [] )

Save-Point

Full Version: Script that removes junk symbol (squares like that [] )
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, i have a problem with this junk sympol that appears in some cases except "enter" or "space".
Mainly in Bestiary Book script and Text Scroll script. Everything is ok with ingame dialogues. I'm using Tahoma and Arial font. Interesting thing is that is that problem started when i changed to Win10.

Screenshots:
[Image: image.jpg]
[Image: image.jpg]

I've found something like that but it's not for XP version.

Code:
class Window_Base
 alias :process_normal_character_vxa :process_normal_character
 def process_normal_character(c, pos)
return unless c >= ' '
process_normal_character_vxa(c, pos)
 end
end
Those squares are not junk symbols. Those are incorrectly translated space (or similar) symbols based upon the font you are using. Not all fonts work the same, and the squares are a means of replacement.

It happens MORE often when converting from one language to another. But it also happens with RPGMaker versions based on the engine and DLL if said DLL is made for a different country (ie Japanese vs English).... or just a different year dll. I have seen this plenty of times when I translated scripts and demos from Japanese into English. And when I upgraded my personal project from one RPGMaker version to another, the squares appeared because of the way it handled the font I used.

So replacing the Square symbols with spaces ... doesn't work when the space symbols for your font is actually being translated 'back' into a junk square.

I'd look into things like 'retyping' the data to ensure no garbage in the data itself, and seeing how a different font in the script would look.

EDIT #1 : Related to code snippet...
Text is drawn by the draw_text command, and that is a part of the Bitmap class. Whatever is sent into it will come out based upon the font being used.

However, the code you supplied is attached to the Window_Base class. In this, it must be directly related to features within that class that directly prints individual characters upon the screen one at a time before said characters are rendered with draw_text. In essence, the Message Window itself. It wouldn't affect any other texts draw, such as from menus or custom dialogs.

EDIT #2 : Related to Demon Picture Book (the Bestiary) .... and the font
Having a copy of the original Japanese version on hand, as well as a copy I translated, I know that the script itself doesn't request a custom font. Sure, it changes font 'size' and color, but not the font itself. It is using the default font your engine is set to use. So.....

Place this as a simple script within your script library right ABOVE main:
Code:
Font.default_name = "Arial"
or probably better (for a 'range' of fonts if the first one isn't found).
Code:
Font.default_name = ["Tahoma", "Arial", "Beep Boop"]
........ do not ask what the Beep Boop font is like. :P
Thank You again :)
Unfortunately solution works only for Demon Picture Book. And im not asking about Beep Boop ;)
I was trying different fonts but problem stays. It's in fact attached to Window_Base.

This is that script but im warning You - it's a mess ;) I need it only to draw text from files (no scrolling etc.)

Code:
#===================================================
# ? Text Scroll Script  R3-Fixed - Created by dubealex, edited by Ssinssrigg
#===================================================
# For more infos and update, visit:
# rmxp.dubealex.com
#
#-> Stack level too deep caused by ALIAS now fixed.
#
# November 29, 2004
#===================================================

#===================================================
# ? CLASS Text_Scroller Begins
#===================================================

class Scene_Map

alias alex_tss_original_update update
@@i=0

def update

#
alex_tss_original_update

Book_Scroll.bupdate

if $game_temp.message_window_showing
     return
   end
  unless $game_player.moving?
     if $game_temp.battle_calling
      call_battle
     elsif $game_temp.shop_calling
      call_shop
     elsif $game_temp.name_calling
      call_name
     elsif $game_temp.menu_calling
      call_menu
     elsif $game_temp.save_calling
      call_save
     elsif $game_temp.debug_calling
      call_debug
     end
   end
  if $game_player.moving?
     $tss_scroll_window.dispose
  end
end

Input.update

end

class Text_Scroller

def initialize (file, opacity_scroll, opacity_bg, speed, live_scroll)

   text=IO.readlines("Data 2/#{file}")
   $tss_speed = speed
   $tss_iteration = 480.0/speed
   $tss_sy= (text.size*32) + 64

   $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
   $tss_scroll_window.opacity = opacity_scroll
   $tss_scroll_window.z = 500
   $tss_scroll_window.x = 0
   $tss_scroll_window.y = 480

   $tss_bg_window = Window_bg.new
   $tss_bg_window.opacity = opacity_bg
   $tss_bg_window.z=300

   case live_scroll
   when 0
     update
     when 1
       $live_scroll=true
   end
end
def update

       for i in 0...(($tss_sy/480.0) * $tss_iteration) + $tss_iteration
          $tss_scroll_window.y -= $tss_speed
          Graphics.update
        end
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
  end
end
#===================================================
# ? CLASS Text_Scroller Ends
#===================================================


#===================================================
# ? CLASS Window_Scroll Begins
#===================================================
class Window_Scroll < Window_Base

def initialize (file, sx, sy)
   @sx=sx
   @sy=sy

   super(0, 0, sx, sy)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Arial"
   self.contents.font.size = 14
   @text=IO.readlines("Data 2/#{file}")
   @text_color=0
   refresh
end

def refresh  
   y=0
     for i in 0...@text.size
       y+=15
       if @text[i].index('/') == 0
           @text_color=@text[i].slice! (0..2)
           @text_color.slice!(0)
       end
       if @text[i].index('*') == 0
           line_color=@text[i].slice! (0..2)
           line_color.slice!(0)
          self.contents.font.color = text_color(line_color.to_i)
        else
       self.contents.font.color = text_color(@text_color.to_i)
       end
       self.contents.draw_text(0, y, @sx, 32, @text[i])
     end
end
end
#===================================================
# ? CLASS Window_Scroll Ends
#===================================================


#===================================================
# ? CLASS Book_Scroll Begins
#===================================================
class Book_Scroll
@@mode=0

def initialize (book_name, number_of_pages, start_page, opacity_scroll, opacity_bg)
   if @@mode == 1
   return
  end

   file = book_name.to_s+"/"+start_page.to_s+".rxdata"
   text=IO.readlines("Data 2/#{file}")
   $tss_sy= (text.size*32) + 64

   $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
   $tss_scroll_window.opacity = opacity_scroll
   $tss_scroll_window.z=500
   $tss_scroll_window.x = 0
   $tss_scroll_window.y = 0

   $tss_bg_window = Window_bg.new
   $tss_bg_window.opacity = opacity_bg
   $tss_bg_window.z=400

@@mode=1
@@book_name = book_name
@@start_page =  start_page
@@number_of_pages =  number_of_pages
@@opacity_scroll =  opacity_scroll
@@opacity_bg =  opacity_bg

#   book_update(book_name, start_page, number_of_pages, opacity_scroll, opacity_bg)
   $game_system.menu_disabled = true
end

def self.bupdate
if @@mode == 1
book_update(@@book_name, @@start_page, @@number_of_pages, @@opacity_scroll, @@opacity_bg)
end
end

def self.book_update(book_name,start_page, number_of_pages, opacity_scroll, opacity_bg)
#  loop do
# Graphics.update
#  Input.update

if Input.repeat?(Input::C)
     @@mode=0
   end
if Input.repeat?(Input::RIGHT)
     @@mode=0
     $game_system.menu_disabled = false
  #   break
   end
   if Input.repeat?(Input::LEFT)
     @@mode=0
     $game_system.menu_disabled = false
  #   break
   end
   if Input.repeat?(Input::UP)
     @@mode=0
     $game_system.menu_disabled = false
  #   break
   end
   if Input.repeat?(Input::DOWN)
     @@mode=0
     $game_system.menu_disabled = false
   #  break
   end
   if Input.trigger?(Input::B)
     @@mode=0
     $game_system.menu_disabled = false
    # break
   end
  
#end
end


end

#===================================================
# ? CLASS Book_Scroll Ends
#===================================================


#===================================================
# ? CLASS Window_bg Begins
#===================================================
class Window_bg < Window_Base

def initialize
   super(0, 0, 640, 480)
end
end
#===================================================
# ? CLASS Window_bg Ends
#=========================================
I know the script too well. It uses a hell of a lot of Global variables rather than use instance variables. I pasted an updated version to use Instance variables which slightly reduces memory required in-game. It also has a setting within where you can change the font used in the scrolled text. This in difference to the original which has the font hard-coded with the line:
Code:
self.contents.font.name = "Arial"

Still, the issue could be the type of data saved in the text file, (Ansi vs Ascii).
Quote:
Code:
Font.default_name = ["Tahoma", "Arial", "Beep Boop"]
........ do not ask what the Beep Boop font is like. :P

I found the Beep Boop font

http://fontstruct.com/fontstructions/sho...eep_boop_1

I like it
Shocked   I WAS MAKING IT UP!!!!!
(01-27-2017, 04:45 AM)DerVVulfman Wrote: [ -> ]Shocked   I WAS MAKING IT UP!!!!!

and Yesteryear's font isent its own name Tongue sticking out
(01-27-2017, 04:49 AM)Siletrea Wrote: [ -> ]
(01-27-2017, 04:45 AM)DerVVulfman Wrote: [ -> ]Shocked   I WAS MAKING IT UP!!!!!

and Yesteryear's font isent its own name Tongue sticking out

Nice  Laughing + Tongue sticking out

Unfortunetly nothing really fixed squares in Text Scroll script, even different type of data saved in the text file (ANSI, UTF-8)
Anyway thank You for helping, Demon Picture Book is working propertly, and there is "override" for Text Scroll script to show those squares beyond visible screen :) Litte more work with each text file but same effect  Happy