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.
Basic Scene Mail 1.0

0 Members and 1 Guest are viewing this topic.

*
Scripter
Rep:
Level 40
Crownless King
Basic Scene Mail 1.0
Version: 1.0
Author: Soulpour777
Date: August 21, 2014

Description


This script allows the developer to set up items that are only visible by a certain note tag which they can basically use for anything. The items are called Mails, which means you can use them as set up for mails the actor can receive throughout the game.

Features

  • Mail Iems
  • A Scene to Contain All Mail Items

Screenshots



Instructions

1. Above all else, put the script below Materials above Main.
2. On your items you want to be used as mails, place the note tag <mail> on those items. Now remember, when you note tag something with it, they would be made automatically as mails and you can not find them in the Item list
because they are now Mails.
3. To call the List of Mails, do it on a script call:
SceneManager.call(Scene_Mail)

Script


Code: [Select]
#==============================================================================
# ** Basic Scene Mail 1.0
# Author: Soulpour777
# August 31, 2014
# Web URL: infinitytears.wordpress.com
# Change Log: September 1 - Equipment Compatibility Change and Fix
#------------------------------------------------------------------------------
# Description:
# This script allows the developer to set up items that are only visible by
# a certain note tag which they can basically use for anything. The items
# are called Mails, which means you can use them as set up for mails the actor
# can receive throughout the game.
#------------------------------------------------------------------------------
# Instructions of Using the Script:
# 1. Above all else, put the script below Materials above Main.
# 2. On your items you want to be used as mails, place the note tag <mail> on
# those items. Now remember, when you note tag something with it, they would
# be made automatically as mails and you can not find them in the Item list
# because they are now Mails.
# 3. To call the List of Mails, do it on a script call:
# SceneManager.call(Scene_Mail)
#------------------------------------------------------------------------------
# Terms of Use:
# - Preserve the script banner.
# - Credits must be given to the author when script is used.
# - You are allowed to modify, add, or edit any part of the content as long
# as the original author is credited.
# - You are free to use this script for Non Commercial Games.
#------------------------------------------------------------------------------
# If used for a commercial game, please feel free to inform the author. You
# will not be charged for anything for using this script, but there the author
# should at least be informed that it is being used somewhere.
#------------------------------------------------------------------------------
# For support, please mail the author at rpgmakervxace.net or in his website.
#==============================================================================
module Soulpour
  module MailingList
    Mail_RegEx = /<mail>/i
    Mail_Name = "Mails"
  end
end

class Window_CategMail < Window_HorzCommand
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :item_window
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @item_window.category = current_symbol if @item_window
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Soulpour::MailingList::Mail_Name, :mail_item)
  end
  #--------------------------------------------------------------------------
  # * Set Item Window
  #--------------------------------------------------------------------------
  def item_window=(item_window)
    @item_window = item_window
    update
  end
end

class Window_MailingList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    @category = :none
    @data = []
  end
  #--------------------------------------------------------------------------
  # * Set Category
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
    self.oy = 0
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # * Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # * Display in Enabled State?
  #--------------------------------------------------------------------------
  def enable?(item)
    $game_party.usable?(item)
  end
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_mailing_list_items
    @data = $game_party.all_items.select {|item| item.note =~ Soulpour::MailingList::Mail_RegEx }
    @data.push(nil) if include?(nil)
  end
  #--------------------------------------------------------------------------
  # * Restore Previous Selection Position
  #--------------------------------------------------------------------------
  def select_last
    select(@data.index($game_party.last_item.object) || 0)
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
      draw_item_number(rect, item)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Number of Items
  #--------------------------------------------------------------------------
  def draw_item_number(rect, item)
    draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
  end
 
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    make_mailing_list_items
    create_contents
    draw_all_items
  end
end

class Scene_Mail < Scene_ItemBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_category_window
    create_item_window
  end
  #--------------------------------------------------------------------------
  # * Create Category Window
  #--------------------------------------------------------------------------
  def create_category_window
    @category_window = Window_CategMail.new
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.y = @help_window.height
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # * Create Item Window
  #--------------------------------------------------------------------------
  def create_item_window
    wy = @category_window.y + @category_window.height
    wh = Graphics.height - wy
    @item_window = Window_MailingList.new(0, wy, Graphics.width, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @category_window.item_window = @item_window
  end
  #--------------------------------------------------------------------------
  # * Category [OK]
  #--------------------------------------------------------------------------
  def on_category_ok
    @item_window.activate
    @item_window.select_last
  end
  #--------------------------------------------------------------------------
  # * Item [OK]
  #--------------------------------------------------------------------------
  def on_item_ok
    $game_party.last_item.object = item
    determine_item
  end
  #--------------------------------------------------------------------------
  # * Item [Cancel]
  #--------------------------------------------------------------------------
  def on_item_cancel
    @item_window.unselect
    @category_window.activate
  end
  #--------------------------------------------------------------------------
  # * Play SE When Using Item
  #--------------------------------------------------------------------------
  def play_se_for_item
    Sound.play_use_item
  end
  #--------------------------------------------------------------------------
  # * Use Item
  #--------------------------------------------------------------------------
  def use_item
    super
    @item_window.redraw_current_item
  end
end

class Window_ItemList < Window_Selectable
  attr_accessor :only_if_noted
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    @category = :none
    @data = []
    @only_if_noted = false
  end
  #--------------------------------------------------------------------------
  # * Set Category
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
    self.oy = 0
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # * Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      @only_if_noted = true
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      @only_if_noted = true
      item.is_a?(RPG::Weapon)
    when :armor
      @only_if_noted = true
      item.is_a?(RPG::Armor)
    when :key_item
      @only_if_noted = true
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # * Display in Enabled State?
  #--------------------------------------------------------------------------
  def enable?(item)
    $game_party.usable?(item)
  end
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) && !(item.note =~ Soulpour::MailingList::Mail_RegEx) }
    @data.push(nil) if include?(nil)
  end
end

class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end 
  #--------------------------------------------------------------------------
  # * Overwrite Refresh
  #-------------------------------------------------------------------------- 
  def refresh
    make_item_list
    create_contents
    draw_all_items   
  end
end



Credit


  • Soulpour777

Support


For support, please mail the author at rmrk.net, rpgmakervxace.net or in his website.

Terms of Use


Terms of Use:
- Preserve the script banner.
- Credits must be given to the author when script is used.
- You are allowed to modify, add, or edit any part of the content as long as the original author is credited.
- You are free to use this script for Non Commercial Games.

If used for a commercial game, please feel free to inform the author. You will not be charged for anything for using this script, but there the author should at least be informed that it is being used somewhere.
« Last Edit: September 01, 2014, 05:59:14 PM by SoulPour777 »


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Queen of RMRKProject of the Year 20142014 Best RPG Maker User - Story2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Oh my gosh, I totally forgot about adding a mail system in my current game! ^_^

Looks really simple and easy to use...I love it! *__*
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
Scripter
Rep:
Level 40
Crownless King
Oh my gosh, I totally forgot about adding a mail system in my current game! ^_^

Looks really simple and easy to use...I love it! *__*

Thank you very much!  ;D


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
Scripter
Rep:
Level 40
Crownless King
Updated the script for Equipment Compatibility Issues.


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h