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.
Exempt Gold

0 Members and 1 Guest are viewing this topic.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Exempt Gold
Version: 1.0
Author: Welfare-Daddy Pacman
Date: March 30th, 2011
 
Version History


  • <Version 1.0> 03.30.2011 - Original Release
Planned Future Versions
  • None, as of yet.
Description


Read the script for features and instructions.
 
Screenshots
Not applicable.
 
Script
 

Code: [Select]
#==============================================================================
#  Exempt Gold
#  Version: 1.0
#  Author: Welfare-Daddy Pacman (rmrk.net)
#  Date: March 30, 2011
#
#------------------------------------------------------------------------------#
#  Description:
#
#  This script will exempt all gold features in-game. This means that in the
#  menu, no gold will be displayed. NOTE: If you use the \G message function,
#  nothing will happen.
#
#------------------------------------------------------------------------------#
#  Instructions: 
#   
#  - Place this script in the materials section, above Main.
#  - Put NO_GOLD as true to use the exempt function, false to not. Though, I
#  don't really see the point of having the script if you're not going to use
#  it.
#  - *IMPORTANT* For unknown reasons, this script makes the first message of
#  the game displayed. If you don't want it to look awkward, make your first
#  show text command of the game:
#  \.\^
#  so that it waits a quarter of a second, ends the command, repeats the command
#  then begins your actual message.
#=============================================
  #EDITABLE REGION
 
NO_GOLD = true
  #END EDITABLE REGION
#=============================================
  #NO EDITING! THAT'S NOT COOL!
  #EXEMPTING MENU GOLD
if NO_GOLD == true
class Scene_Menu < Scene_Base
alias wdp_scnmenu_start start
def start
  super
  create_menu_background
  create_command_window
  @status_window = Window_MenuStatus.new(160, 0)
end
end
  #FIXING RESULTS
class Scene_Menu
  alias wdp_scnmenu_terminate terminate
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @status_window.dispose
  end
end
class Scene_Menu
alias wdp_scnmenu_gold_update update
def update
  super
  update_menu_background
  @command_window.update
  @status_window.update
  if @command_window.active
    update_command_selection
  elsif @status_window.active
    update_actor_selection
  end
end
end
  #EXEMPTING WINDOW_GOLD
class Window_Message < Window_Selectable
  alias wdp_wndmsg_gold_window create_gold_window
  def create_gold_window
end
end
class Window_Message < Window_Selectable
  alias wdp_wndmsg_dispose_gold_window dispose_gold_window
  def dispose_gold_window
end
end
class Window_Message < Window_Selectable
  alias wdp_wndmsg_update_gold_window update_gold_window
  def update_gold_window
end
end
  #EXEMPTING GOLD COMMAND
class Window_Message < Window_Selectable
  alias wdp_wndmsg_update_message update_message
  def update_message
    loop do
      c = @text.slice!(/./m)            # Get next text character
      case c
      when nil                          # There is no text that must be drawn
        finish_message                  # Finish update
        break
      when "\x00"                       # New line
        new_line
        if @line_count >= MAX_LINE      # If line count is maximum
          unless @text.empty?           # If there is more
            self.pause = true           # Insert number input
            break
          end
        end
      when "\x01"                       # \C[n]  (text character color change)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (gold display)
        nil                             # See what I did here? Nothing happens.
      when "\x03"                       # \.  (wait 1/4 second)
        @wait_count = 15
        break
      when "\x04"                       # \|  (wait 1 second)
        @wait_count = 60
        break
      when "\x05"                       # \!  (Wait for input)
        self.pause = true
        break
      when "\x06"                       # \>  (Fast display ON)
        @line_show_fast = true
      when "\x07"                       # \<  (Fast display OFF)
        @line_show_fast = false
      when "\x08"                       # \^  (No wait for input)
        @pause_skip = true
      else                              # Normal text character
        contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
        c_width = contents.text_size(c).width
        @contents_x += c_width
      end
      break unless @show_fast or @line_show_fast
    end
  end
end
class Window_Message < Window_Selectable
  alias wdp_wndmsg_terminate_message terminate_message
  def terminate_message
      def terminate_message
    self.active = false
    self.pause = false
    self.index = -1
    @number_input_window.active = false
    @number_input_window.visible = false
    $game_message.main_proc.call if $game_message.main_proc != nil
    $game_message.clear
  end
end
end
  #EDIT WINDOW_GOLD
class Window_Gold < Window_Base
  alias wdp_wndgd_initialize initialize
  def initialize(x, y)
    super(x, y, 160, WLH + 32)
    refresh
  end
  def refresh
    self.contents.clear
  end
end
end

  #FIX RESET WINDOW
class Window_Message < Window_Selectable
  alias wdp_wndmsg_reset_window reset_window
  def reset_window
    @background = $game_message.background
    @position = $game_message.position
    if @background == 0   # Normal window
      self.opacity = 255
    else                  # Dim Background and Make it Transparent
      self.opacity = 0
    end
    case @position
    when 0  # Top
      self.y = 0
    when 1  # Middle
      self.y = 144
    when 2  # Bottom
      self.y = 288
    end
  end
end
Credit


  • Welfare-Daddy Pacman
Thanks
  • LoganForrests
  • DarkCodeZero
Support
 

I'm on RMRK really frequently, so just post here or PM me for support.
 
 
Known Compatibility Issues
As I aliased everything, not many scripts would be incompatible if you place this script underneath everything that edits Scene_Menu, Window_Base, Window_Message/Selectable and Window_Gold. This script works with my other exempt scripts.
 
 
Demo
 

You really shouldn't need one, the script's above this anyway.
 
 
Author's Notes


Well, I'd just like you to know that this script gave me something to do on a boring Wedensday night. I could've composed, I could've talked to people, but I scripted. Thank you RMRK for giving some entertainment.
Restrictions
Don't take credit for my work. Free for use in non-commercial projects, credit is requested, however. For commercial projects, please let me know.
 
:ccbysa: :rmvx:
For indie games.  :nespad:
« Last Edit: March 30, 2011, 11:02:06 AM by Welfare-Daddy Pacman »
it's like a metaphor or something i don't know

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Err, you may be aliasing, but that doesn't make this script compatible since you aren't calling them.
For instance:
Code: [Select]
  alias wdp_wndmsg_update_gold_window update_gold_window
  def update_gold_window
  end

The fact that it is aliased is kind of pointless unless it is used. In that case, the gold window won't even update if they turned the NO_GOLD constant to false. Which is probably fine since there is no real point to updating the gold window, but it certainly wouldn't be compatible with any scripts that did use that method for something.

More crucially, this:

Code: [Select]
alias wdp_wndmsg_update_message update_message
  def update_message
    loop do
      c = @text.slice!(/./m)            # Get next text character
      case c
      when nil                          # There is no text that must be drawn
        finish_message                  # Finish update
        break
      when "\x00"                       # New line
        new_line
        if @line_count >= MAX_LINE      # If line count is maximum
          unless @text.empty?           # If there is more
            self.pause = true           # Insert number input
            break
          end
        end
      when "\x01"                       # \C[n]  (text character color change)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (gold display)
        nil                             # See what I did here? Nothing happens.
      when "\x03"                       # \.  (wait 1/4 second)
        @wait_count = 15
        break
      when "\x04"                       # \|  (wait 1 second)
        @wait_count = 60
        break
      when "\x05"                       # \!  (Wait for input)
        self.pause = true
        break
      when "\x06"                       # \>  (Fast display ON)
        @line_show_fast = true
      when "\x07"                       # \<  (Fast display OFF)
        @line_show_fast = false
      when "\x08"                       # \^  (No wait for input)
        @pause_skip = true
      else                              # Normal text character
        contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
        c_width = contents.text_size(c).width
        @contents_x += c_width
      end
      break unless @show_fast or @line_show_fast
    end
  end

makes the script incompatible with practically every message system. In order for aliasing to be an effective compatibility measure, you actually have to call the alias. Now, it's not totally your fault, as that method is practically impossible to alias in a general way, but you could have designed the script differently so as to not need to alias that method - for instance - by just making the gold window invisible instead of deleting it all together, or changing gold window so that it refers to a dummy class that isn't a real window but has all the same methods.

Also, for methods inside the same class, you don't need to limit it to one method and you also don't need to refer again to its super class. Instead of:

Code: [Select]
class Window_Message < Window_Selectable
  def method_1
  end
end
class Window_Message < Window_Selectable
  def method_2
  end
end

you can do:
Code: [Select]
class Window_Message
  def method_1
  end
  def method_2
  end
end

That's not a big deal though. But it's questionable why you would take away the \G feature. It is a feature that can only be used intentionally by the user of the script - if he didn't want it to show, he wouldn't use. If he is using it, then he wants it to show, and so preventing its use merely removes functionality and customizability from this script.


Also, a better design for this script as it currently stands would probably be to simply modify the Window_Gold class and make it so that it is always invisible. That way you won't need to touch any scenes. If you did want to make it so that it was still possible to use \G, you'd need to do a little extra work.

In any case, I'm glad that you've started to play around with scripting; you're doing a good job for starting out.
« Last Edit: March 30, 2011, 12:23:53 PM by modern algebra »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I got scared when I saw that MA posted on my script. That's because he knows what he's doing. I, in most cases, do not.

As you probably know, I have been scripting for about a week and a half. I don't know much about it. It's great being in a community of people who do. So first off, thanks for that info.
Secondly, a series of errors made me take away the \G function. I didn't exactly know how to mess with Window_Gold effectively, so I changed all the classes that work with it. All I wanted was to change Scene_Menu, but that led to some errors which made me do that. Annoying.
Thirdly, that massive chunk I took out of Window_Message was because I really couldn't be bothered working around it. I'm sure it could be done, quite easily in fact, but I was rushing myself to finish the script.
Lastly, I did know that I can use several methods in one class, but it doesn't really matter as long as I keep stating the class.
Thank you for your criticisms; I'll take a look at the script later in the evening.
Frankly, I'm suprised the script even works.
it's like a metaphor or something i don't know

*
Rep:
Level 82
Quote from: Welfare-Daddy Pacman
Thirdly, that massive chunk I took out of Window_Message was because I really couldn't be bothered working around it. I'm sure it could be done, quite easily in fact, but I was rushing myself to finish the script.

If you want to do something like this, where you want to do something to a class or method that already exists, you should try using what I do (until I can be bothered/find a way to make it cleaner).

Define your own method in the same class that is to be your version of the original (giving it a similar name helps). Then alias the original method in your own script, and in the method set up a simple conditional statement. Since you like to use booleans to check if an option is set to true you can make good use of that here. When the statement is true, call your copied method, when the statement is false, call the original method via the alias. That way, the original is unchanged and any scripts that make use of the original explicitly will work as is expected.

To put an example using Window Message:

Code: [Select]
Class Window_Message < Window_Selectable

  alias original_update_message update_message
  def update_message
      if NO_GOLD #the one you have in your script here
          changed_update_message
     else
          original_update_message #runs the original update_message method in
                                               #Window_Message
     end
  end

  def changed_update_message
     #the stuff you want update_message to do
  end
 
end

You don't need to make a different version of the method separately. You can just put the code into the true section of the if branch, but I often find it tidier to use a separate method - not that I do it that often myself.

I use them that way quite often where I need to change quite a bit of the original method. I don't know how necessary or liked it is to alias methods that you add to though, but in those cases (where I add code but don't change existing code) I usually just overwrite them.

Try not to rush with the scripts though. That's when problems will creep in. I know how it feels to want to get a script out - I'm on a scripting high at the moment doing both simple things and a little more complicated things - but try not to be too hasty.
(Why do I always feel like it's the end of the world and I'm the last man standing?)