RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Help;-;] First Script [RMVXA]

0 Members and 1 Guest are viewing this topic.

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
This is the first script I've ever written.
I've been watching Diamond'd tutorials, and thought I'd give actually writing a script a try.

My idea is to make a script that allows me to change the font with a script call.

Code: [Select]
# Easy Font Changer
#===========================================================================

class Boe_Font_Chooser < Game_Variables

# Font 1
$boe_fontno1 = ["monstapix"]

# Font 2
$boe_fontno2 = ["monstapix"]

# Font 3
$boe_fontno3 = ["Arial"]

# Font 4
$boe_fontno4 = ["Arial"]

# -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =

   def initialize
   boe_font_changer
   end

   def update   
   boe_font_changer
   end
 
     def boe_font_changer
      if $font_number_boe_asj      == 0
       Font.default_name = $boe_fontno1
      elsif $font_number_boe_asj   == 1
       Font.default_name = $boe_fontno2
      elsif $font_number_boe_asj   == 2
       Font.default_name = $boe_fontno3
      elsif $font_number_boe_asj   == 3
       Font.default_name = $boe_fontno4
      else
      end
   end
end

The parts alone work "Font.default_name = $boe_fontno1" and "$boe_fontno1 = ["monstapix"]" placed by themselves changed the font, but I can't seem to get my method to activate.
&&&&&&&&&&&&&&&&

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Your script is fine. It doesn't work because it's not being called all the time.

Spoiler for:
Code: [Select]
class Scene_Map < Scene_Base
 
  alias boe_font_changer_smstart    start
  def start
    boe_font_changer_smstart              # Call Original 'Start' Method
    @font_chooser = Boe_Font_Chooser.new  # Make New Font Chooser
  end
 
 
  alias boe_font_changer_smupdate    update
  def update
    boe_font_changer_smupdate             # Call Original 'Update' Method
    @font_chooser.update                  # Call the 'Update' Method in BOE's Font Chooser
  end
 
end



Add this below your code and it should work.
You see, Scene_Map is a class that is updated whenever your characters are on a map. So what we do is to add a new 'instance' of the Font Chooser in the |start| method so that we only have to make a new instance one time.

Next in Scene_Map's update method we tell it to access the |update method| located within the BOE's Font Chooser instance we created in the |start| method.
Now whenever Scene_Map gets updated (which is all the time when you're on a Game Map), it'll also update BOE's Font Chooser along with it.




This means that you only need to change the variable |$font_number_boe_asj| in order for the script to work. You do not need to do anything else. :)
Though if I may make a suggestion, you can change:
Code: [Select]
$font_number_boe_asj
to:
Code: [Select]
$game_variables[10] # or $game_variables[47], etc.
so that you can change variables in the game rather than having to modify your font using a script call.
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Strange. It only updates when I return to the scene. If I change the variable, and talk to somebody, nothing happens. If I change the variable then open the menu, open shop processing ect, it updates it.

I'll see if I can figure what going on.

Thank you so much for your help. ;-;
&&&&&&&&&&&&&&&&

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Still haven't figured out why it's not updating, but still working on that.

I made some other changes. (Ones that you suggested.)

Code: [Select]
#===========================================================================
# Easy Font Changer
#===========================================================================

class Boe_Font_Chooser < Game_Variables

# Font Controlling Variable
$boe_variable_asj = 10

# Font 0
$boe_fontno1 = ["Arial"]

# Font 1
$boe_fontno2 = ["monstapix"]

# Font 2
$boe_fontno3 = ["Times New Roman"]

# Font 3
$boe_fontno4 = ["Modern Destronic"]

# -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =
# Do Not Enter (Unless you know what you're doing)
# -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =  -  =

   def initialize
   boe_font_changer
   end

   def update           
   boe_font_changer
   end
 
     def boe_font_changer                           # Font Number
      if $game_variables[$boe_variable_asj]      == 0
       Font.default_name = $boe_fontno1
      elsif $game_variables[$boe_variable_asj]   == 1
       Font.default_name = $boe_fontno2
      elsif $game_variables[$boe_variable_asj]   == 2
       Font.default_name = $boe_fontno3
      elsif $game_variables[$boe_variable_asj]   == 3
       Font.default_name = $boe_fontno4
      else
      end
   end
 end
                                          # Update
class Scene_Map < Scene_Base
 
  alias boe_font_changer_smstart    start
  def start
    boe_font_changer_smstart              # Call Original 'Start' Method
    @font_chooser = Boe_Font_Chooser.new  # Make New Font Chooser
  end
 
 
  alias boe_font_changer_smupdate    update
  def update
    boe_font_changer_smupdate             # Call Original 'Update' Method
    @font_chooser.update                  # Call the 'Update' Method in BOE's Font Chooser
  end
 
end
&&&&&&&&&&&&&&&&

**
Rep:
Level 36
Scripter
I think it could be because the font is defined when the bitmap is created and, after that, it uses the already created bitmap by the window instead of creating a new one. I tried to force to update the bitmap at least for the message window and even I try to create again the message window, but I think that there is something we're not taking in account... I don't know...