赞 | 0 |
VIP | 4 |
好人卡 | 0 |
积分 | 2 |
经验 | 31715 |
最后登录 | 2021-9-11 |
在线时间 | 829 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 180
- 在线时间
- 829 小时
- 注册时间
- 2010-6-26
- 帖子
- 671
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 企鹅达达 于 2010-11-17 01:15 编辑
许多脚本会用到数据库的备注栏,我们会想有些时候那些脚本不要起作用,一定时间过后再生效。那么,我们可以用到以下脚本:
p.s.使用方法自己查牛津词典 =.= 注意备注那的斜杠写法和不要漏了双引号……- #==============================================================================
- # Note Editor
- # Version: 1.0
- # Author: modern algebra (rmrk.net)
- # Date: December 16, 2009
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Description:
- #
- # This script allows you to edit the note field of an item with script calls
- # in-game. This is useful for editing features of other scripts that use the
- # note field for adding features; this will allow you to add those features
- # as part of the gameplay. The edits will only apply within the same game
- # file, so the note field will be clean whenever the player starts a new
- # game. It does not overwrite the regular note field - anything written in
- # note field in the database will be permanent in every save file.
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Instructions:
- #
- # Paste this script into the editor below the default scripts but above Main
- #
- # To use this script, simply use these codes in a call script:
- #
- # add_note (type, id, note)
- # type : refers to the database tab you want to change the notes of.
- # It is an integer, and broke down like this:
- # 0 => Item
- # 1 => Weapon
- # 2 => Armor
- # 3 => Skill
- # 4 => Enemy
- # 5 => State
- # id : the specific ID of the particular item, weapon, armor, skill,
- # enemy, or state you want to edit the note field of.
- # note : this is the string that you want to add to the note field.
- # delete_note (type, id, note)
- # type : same as for add_note
- # id : same as for add_note
- # note : this is the note you want to delete. It can be either the
- # string itself, or it can be an integer if (and onlt if) you
- # know the order it was added in - if you put in the integer 2
- # here, it will delete the third string you added to the item's
- # note.
- #
- # delete_note will only delete notes that have been added to the note field
- # in-game - it will not delete notes you set in the database directly.
- #
- # EXAMPLES:
- # add_note (0, 1, "new \\ note")
- # This would add "new \ note" to the note field of a potion (first item)
- # add_note (4, 6, "Default wisp")
- # This would add "Default wisp" to the note field of the sixth enemy in
- # the database (coincidentally a willowisp by default)
- # delete_note (2, 45, "\\CG[Evil, 5]")
- # This would delete the note "\CG[Evil, 5]" from the note field of the
- # 45th weapon in the database if it had been added in-game through the
- # add_note script. It would not delete it if you set it in the database
- # itself.
- #==============================================================================
- module RPG
- #==============================================================================
- # ** RPG::BaseItem
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - note
- #==============================================================================
- class BaseItem
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Return Note
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malgb_acigd_ntedit_7jb3 note
- def note (*args)
- type = case self
- when RPG::Item then 0
- when RPG::Weapon then 1
- when RPG::Armor then 2
- when RPG::Skill then 3
- end
- # Return Original Method + edited additions
- return malgb_acigd_ntedit_7jb3 (*args) + $game_system.ma_added_notes(type, self.id)
- end
- end
- #==============================================================================
- # ** RPG::Enemy
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - note
- #==============================================================================
- class Enemy
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Return Note
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_asciigod_noteedit_enmy_5hv2 note
- def note (*args)
- # Return Original Method + edited additions
- return ma_asciigod_noteedit_enmy_5hv2 (*args) + $game_system.ma_added_notes(4, self.id)
- end
- end
- #==============================================================================
- # ** RPG::State
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - note
- #==============================================================================
- class State
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Return Note
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modalg_gdasci_nted_stte_4xs2 note
- def note (*args)
- # Return Original Method + edited additions
- return modalg_gdasci_nted_stte_4xs2 (*args) + $game_system.ma_added_notes(5, self.id)
- end
- end
- end
- #==============================================================================
- # ** Game System
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new instance variable - ma_note_edits
- # aliased method - initialize
- # new method - ma_add_note, ma_delete_note
- #==============================================================================
- class Game_System
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modabra_ascod_init_ntedtr_8nn2 initialize
- def initialize (*args)
- @ma_note_edits = [ {}, {}, {}, {}, {}, {} ]
- # Run Original Method
- modabra_ascod_init_ntedtr_8nn2 (*args)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Add Note
- # type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
- # id : the ID of the specific item in its type
- # note : the note you want to add
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_add_note (type, id, note)
- @ma_note_edits[type][id] = [] if @ma_note_edits[type][id] == nil
- @ma_note_edits[type][id].push (note)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Delete Note
- # type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
- # id : the ID of the specific item in its type
- # note : the note you want to delete
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_delete_note (type, id, note)
- @ma_note_edits[type][id] = [] if @ma_note_edits[type][id] == nil
- note.is_a? (String) ? @ma_note_edits[type][id].delete (note) : @ma_note_edits[type][id].delete_at (note)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Added Notes
- #``````````````````````````````````````````````````````````````````````````
- # Returns the notes added to that item
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_added_notes (type, id)
- return "" if @ma_note_edits[type][id] == nil
- note_string = ""
- @ma_note_edits[type][id].each { |note| note_string += "\n #{note}" }
- return note_string
- end
- end
- #==============================================================================
- # ** Game Interpreter
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - add_note, delete_note
- #==============================================================================
- class Game_Interpreter
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Add Note
- # type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
- # id : the ID of the specific item in its type
- # note : the note you want to add
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def add_note (type, id, note)
- $game_system.ma_add_note (type, id, note)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Delete Note
- # type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
- # id : the ID of the specific item in its type
- # note : the note you want to delete
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def delete_note (type, id, note)
- $game_system.ma_delete_note (type, id, note)
- end
- end
复制代码 |
|