Dynamic Window Skin

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Napoleon, May 15, 2013.

    Tags:
  1. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    Author: Napoleon

    Some of the features:

    - Compatible with my other Window Message Script.

    - Free for commercial use.

    - Change the skins dynamically while playing.

    - Has no method overwrites (so it's a very compatible script)

    All other details are inside the script. Has now also been added to the master demo.

    Script:

    Code:
    #sb:window_skin [window_skin]=beginScript:  Window SkinVersion: 1.00Author:  NapoleonAbout:- Easily change the skin of all windows and/or only for specific windows.- Also supports adding your own custom windows to it (advanced users).- Does not embed itself to the update() method of Window_Message  for increased performance.Instructions:- Place below "▼ Materials" but above "▼ Main Process".- Change the 'default'-skin in the settings to change all skins easily.- Don't forget to change the window HUE to 0, 0, 0 through:  [F9] > System tab > Window Color.  Otherwise the windows may get a weird unwanted hue.- To change the window skin create a new script-line and use:  set_skin(skin_name, window_name)- To change the default skin:  set_default_skin(skin_name)- Advanced users: or if you prefer to use a script call instead:  $game_system.window_skins[window_name] = skin_name- Examples:  set_skin('Window2') # Changes all default skins to Window2.png  set_skin('Window2', 'Window_MenuCommand') # Changes only the skin for Window_MenuCommand- To change all skins:  set_all_skins('your_skin_filename')- Adding custom windows to this script:  # Add this line to your initialize (AFTER the super(..) call!):  self.windowskin = $game_system.window_skin_bitmap(self.class)  # Then add a line to the SKINS setting matching your window's class name.Terms of Use:- Attribution 3.0 Unported (CC BY 3.0)  [URL="http://creativecommons.org/licenses/by/3.0/%C2%A0Version"]http://creativecommons.org/licenses/by/3.0/ Version[/URL] History:1.00 (21 August 2014)  - First Release=end#===============================================================================# Settings#===============================================================================module Nap; module Win_Skin  # The default key for when the skins have no key or when the refer to a  # nil-value.  # Only change this one if you are an advanced user!  DEFAULT_KEY = :default   # Note: case sensitive!  # Use nil values to use the default.  # You can also add your own custom windows here. For example:  # 'Napoleons_Window'    => 'Window3',  SKINS = {    DEFAULT_KEY           => 'Window_Desert', # Default skin. The default RPG Maker: 'Window'    'Window_Selectable'   => nil,    'Window_Command'      => nil,    'Window_HorzCommand'  => nil,    'Window_Help'         => nil,    'Window_Gold'         => nil,    'Window_MenuCommand'  => nil,    'Window_MenuStatus'   => nil,    'Window_MenuActor'    => nil,    'Window_ItemCategory' => nil,    'Window_ItemList'     => nil,    'Window_SkillCommand' => nil,    'Window_SkillStatus'  => nil,    'Window_SkillList'    => nil,    'Window_EquipStatus'  => nil,    'Window_EquipCommand' => nil,    'Window_EquipSlot'    => nil,    'Window_EquipItem'    => nil,    'Window_Status'       => nil,    'Window_SaveFile'     => nil,    'Window_ShopCommand'  => nil,    'Window_ShopBuy'      => nil,    'Window_ShopSell'     => nil,    'Window_ShopNumber'   => nil,    'Window_ShopStatus'   => nil,    'Window_NameEdit'     => nil,    'Window_NameInput'    => nil,    'Window_ChoiceList'   => nil,    'Window_NumberInput'  => nil,    'Window_KeyItem'      => nil,    'Window_Message'      => nil, # Show Text Window    'Window_ScrollText'   => nil,    'Window_MapName'      => nil,    'Window_BattleLog'    => nil,    'Window_PartyCommand' => nil,    'Window_ActorCommand' => nil,    'Window_BattleStatus' => nil,    'Window_BattleActor'  => nil,    'Window_BattleEnemy'  => nil,    'Window_BattleSkill'  => nil,    'Window_BattleItem'   => nil,    'Window_TitleCommand' => nil,    'Window_GameEnd'      => nil,    'Window_DebugLeft'    => nil,    'Window_DebugRight'   => nil,  }end; end # module Nap; module Win_Skin#===============================================================================$imported ||= {}$imported[:window_skin] = 1.00#===============================================================================# Window Base#===============================================================================class Window_Base < Window    #-----------------------------------------------------------------------------  # Initialize                                                           [ALIAS]  #-----------------------------------------------------------------------------  alias nap_win_skin_initialize initialize  def initialize(x, y, width, height)    nap_win_skin_initialize(x, y, width, height)    self.windowskin = $game_system.window_skin_bitmap(self.class)  endend#===============================================================================# Window Message# For: Because this window is only initialized once we need to set the skin#      when it is opened.#===============================================================================class Window_Message < Window_Base  alias nap_win_skin_open_and_wait open_and_wait  def open_and_wait        self.windowskin = $game_system.window_skin_bitmap(self.class)    nap_win_skin_open_and_wait  endend#===============================================================================# Game System#===============================================================================class Game_System  attr_accessor :window_skins   alias nap_win_skin_initialize initialize  #-----------------------------------------------------------------------------  # Initialize                                                           [ALIAS]  #-----------------------------------------------------------------------------  def initialize    nap_win_skin_initialize    @window_skins = Nap::Win_Skin::SKINS  end  #-----------------------------------------------------------------------------  # Window Skin Bitmap                                                     [NEW]  # Note: returns the default skin if a non-existing key is selected or if the  #       value is nil.  #-----------------------------------------------------------------------------  def window_skin_bitmap(window_name=Nap::Win_Skin::DEFAULT_KEY)    window_name = window_name.to_s.dup # to_s is required in case self.class is used (it not a string and will fail the comparison)    skin_name = @window_skins[window_name]    window_name = Nap::Win_Skin::DEFAULT_KEY if !skin_name || !@window_skins[window_name.to_s]    Cache.system(@window_skins[window_name])  endend#===============================================================================class Game_Interpreter  #-----------------------------------------------------------------------------  # Set Skin                                                               [NEW]  #-----------------------------------------------------------------------------  def set_skin(skin_name, window_name=Nap::Win_Skin::DEFAULT_KEY)    $game_system.window_skins[window_name] = skin_name  end  #-----------------------------------------------------------------------------  # Set All Skins                                                          [NEW]  #-----------------------------------------------------------------------------  def set_all_skins(new_skin_name)    $game_system.window_skins.keys.each { |k| $game_system.window_skins[k] = skin_name = nil }    set_default_skin(new_skin_name)  end  #-----------------------------------------------------------------------------  # Set Default Skin                                                       [NEW]  #-----------------------------------------------------------------------------  def set_default_skin(new_default_name)    $game_system.window_skins[Nap::Win_Skin::DEFAULT_KEY] = new_default_name  endend#===============================================================================
     
    Last edited by a moderator: Aug 21, 2014
    #1
    Bonkers and MxPlay_Uchiha like this.
  2. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
    Is it possible to use our own picture  and not a window skin ?
     
    #2
  3. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    No not with this script. It only supports skins as shown in the attachments of this post.

    Battle_Window.png

    Window.png
     
    #3
  4. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,310
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    Looks very very familiar...

    Also...

    Dont see how people without scripting knowledge would be able to "Easily Change ALL Windows"
     
    #4
  5. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    Is there another script that already does something like that? Which one? By the way, I just noticed that your Window_Skin script link is broken on your blog, it points to the wrong script. But it's not the same as mine but when I just saw that title I thought it was for a moment.

    The Master Script List has a script that does almost the same but it does not automatically change the skin when entering a battle and then back to the previous one again.

    If users can't call one single line like "Window_Skin.active_skin = :your_skin" then we could consider 80% of all scripts here to be only for scripters. Almost every script that I see requires you to edit a hash or to call a script line.  Just like your bust script:

    bust_mirror(x) If people can't even do that then they should not even bother looking in this forum section imo but learn the RPG Maker basics first before applying all sorts of scripts. I'd say that in my opinion this should be defined as 'easy'. But I added a few samples to the hash now just in case. Perhaps I should add a disclaimer to the top of all my scripts that says something like "I do not support people that can't call a script line from an event or people that can't replace a value in a hash". It's just that the people who don't know how to use it don't understand the disclaimer either.
     
    Last edited by a moderator: May 18, 2013
    #5
    MxPlay_Uchiha likes this.
  6. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,310
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    the link to my windowskin script works fine for me :o  

    My script just allows for every window to have its own unique windowskin,

    where as yours changes the active windowskin, for all windows. yes ?

    Also, yea i do agree that people should learn how the scripts they are using work.

    It would save me sooo much time explaining them (after i write the instructions in the script)
     
    #6
  7. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,057
    Location:
    Toronto
    First Language:
    English
    People have to start somewhere. Why not start with your script?


    They're not going to learn how script calls work anywhere outside of custom scripts.
     
    #7
  8. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,310
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    Thats a fair point.

    i mean, there are a few script calls that people could be using without any custom scripts, like $game_actors[1].add_param(0, 50), but to be fair, pretty much all of the default script calls get called while using basic event commands. So most Dev's are probably 100% oblivious to them :/
     
    Last edited by a moderator: May 18, 2013
    #8
  9. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    If they do not know how to edit a hash... Well... I can't speak for non-programmers but I did think (perhaps I was wrong) that people with no programming knowledge should still be able to edit the contents of a hash after seeing a few samples. If this is not the case then... Okay you're right perhaps I should re-label this from 'easy' --> 'intermediate'. Anything more than that would then be labeled as 'script only intended for scripters'.

    I could probably add this to an IQ test:

    :tiny => 1:small => 2:medium => 3? => 4Question: Fill in the question mark:

    A: small

    B: :small

    C: large

    D: :large

    The answer would be D of course.

    If RM users can't get the above question right then I might as well stop posting scripts here and keep it all to myself. Or I could add that test to the top of my scripts and if they answer it wrong I will advise them to use my script after they have some more experience with even simpler scripts.

    @Dekita:

    http://dekitarpg.wordpress.com/2013/03/14/d13x-scripts-list/ and click on "Windows Skin" it will redirect you to keys instead.

    But indeed it seems that there already was a script for that... And with more default 'events' to change the skin. Bah I could have saved me the trouble of creating this script then ;_;
     
    Last edited by a moderator: Aug 21, 2014
    #9
  10. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,310
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    ohhh it does re-direct... sorry about that, will have to fix that asap :D
     
    #10
  11. Hytporsche

    Hytporsche Veteran Veteran

    Messages:
    90
    Likes Received:
    1
    First Language:
    English
    How would you go about changing your windowskins in-game Dekita?

    Or since it is possible to switch windowskins in-game through a event, how would I go about do this without a script?
     
    Last edited by a moderator: Jul 29, 2013
    #11
  12. the Skye Mage

    the Skye Mage E=MC Squire Veteran

    Messages:
    154
    Likes Received:
    5
    First Language:
    english
    Having not been here or having Ace for a long time, i remember a few things but I wasn't all that proficient when my comp broke a year ago so I'm still basically a noob. So idk anything about scripting yet, basically.... I agree with this statement :)
     
    #12
    ?????? likes this.
  13. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    I deleted the old version (what a crap script that was) and replaced it with a new one in the OP. I will also add it to the master demo.
     
    #13
  14. Zoltor

    Zoltor Veteran Veteran

    Messages:
    1,550
    Likes Received:
    208
    First Language:
    English
    Oh awesome, you have script call options as well, so they can be changed during the game, this is something I could make use of. It will save me a lot of time, and more importantly, space(since images eat up space faster then anything else with the exception of perhaps music files, depending on the format).

    I was originally gonna have to do photoshop editing, and show pic, to pull off the effect of certain message boxes having a special windowskin, while others use another windowskin.
     
    Last edited by a moderator: Aug 21, 2014
    #14
  15. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    You can use both custom pictures for the message windows AND skins for the other windows if you use both of my 2 window scripts. They are compatible with each other.
     
    #15
  16. Zoltor

    Zoltor Veteran Veteran

    Messages:
    1,550
    Likes Received:
    208
    First Language:
    English
    A script designed to auto center pics on a window(I'm assuming that's how your other script works) would be fairly useless in my case, since I resize text boxes all the time, so the underlined problem that I would need like a 100, possibly more pics, would still exist.

    In any case though, if I can freely switch between active windowskins, there's no reason to use pics anyway.
     
    #16
  17. Miyoko

    Miyoko Villager Member

    Messages:
    19
    Likes Received:
    0
    First Language:
    English
    I seem to be having trouble getting this to work with yanfly's ace battle system... Any tips? I'm no scripter so I usually just kinda fumble my way through getting scripts to work but I'm having trouble with this one...
     
    #17
  18. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    I either need info about the case or just send me a demo. Without any info at all I can't help. I don't use his battle system.
     
    #18
  19. Miyoko

    Miyoko Villager Member

    Messages:
    19
    Likes Received:
    0
    First Language:
    English
    I get an error:

    Script "Dynamic Windows' line 154: NoMethodError occured. 

    undefined method '[]' for nil:NilClass

    I just tested it with a new project to make sure I didn't screw it up somehow and I got it working fine there. So yeah, it's having some sort of script conflict. I moved it to the start of my scripts and it's still getting an error. Will see about making a demo of sorts.
     
    #19
  20. Napoleon

    Napoleon Veteran Veteran

    Messages:
    869
    Likes Received:
    96
    First Language:
    Dutch
    Create a new event and add a script line:

    p $game_system.window_skinsIf it outputs nil then you have a script conflict yes.
     
    #20

Share This Page