设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3414|回复: 8
打印 上一主题 下一主题

[转载] 【vx】事件中编辑数据库备注栏

[复制链接]

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
跳转到指定楼层
1
发表于 2010-11-17 01:15:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 企鹅达达 于 2010-11-17 01:15 编辑

许多脚本会用到数据库的备注栏,我们会想有些时候那些脚本不要起作用,一定时间过后再生效。那么,我们可以用到以下脚本:
p.s.使用方法自己查牛津词典 =.= 注意备注那的斜杠写法和不要漏了双引号……
  1. #==============================================================================
  2. #  Note Editor
  3. #  Version: 1.0
  4. #  Author: modern algebra (rmrk.net)
  5. #  Date: December 16, 2009
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script allows you to edit the note field of an item with script calls
  10. #   in-game. This is useful for editing features of other scripts that use the
  11. #   note field for adding features; this will allow you to add those features
  12. #   as part of the gameplay. The edits will only apply within the same game
  13. #   file, so the note field will be clean whenever the player starts a new
  14. #   game. It does not overwrite the regular note field - anything written in
  15. #   note field in the database will be permanent in every save file.
  16. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. #  Instructions:
  18. #
  19. #    Paste this script into the editor below the default scripts but above Main
  20. #
  21. #    To use this script, simply use these codes in a call script:
  22. #
  23. #       add_note (type, id, note)
  24. #         type : refers to the database tab you want to change the notes of.
  25. #               It is an integer, and broke down like this:
  26. #                 0 => Item
  27. #                 1 => Weapon
  28. #                 2 => Armor
  29. #                 3 => Skill
  30. #                 4 => Enemy
  31. #                 5 => State
  32. #         id   : the specific ID of the particular item, weapon, armor, skill,
  33. #               enemy, or state you want to edit the note field of.
  34. #         note : this is the string that you want to add to the note field.
  35. #       delete_note (type, id, note)
  36. #         type : same as for add_note
  37. #         id   : same as for add_note
  38. #         note : this is the note you want to delete. It can be either the
  39. #               string itself, or it can be an integer if (and onlt if) you
  40. #               know the order it was added in - if you put in the integer 2
  41. #               here, it will delete the third string you added to the item's
  42. #               note.
  43. #
  44. #  delete_note will only delete notes that have been added to the note field
  45. # in-game - it will not delete notes you set in the database directly.
  46. #
  47. #    EXAMPLES:
  48. #      add_note (0, 1, "new \\ note")
  49. #        This would add "new \ note" to the note field of a potion (first item)
  50. #      add_note (4, 6, "Default wisp")
  51. #        This would add "Default wisp" to the note field of the sixth enemy in
  52. #         the database (coincidentally a willowisp by default)
  53. #      delete_note (2, 45, "\\CG[Evil, 5]")
  54. #        This would delete the note "\CG[Evil, 5]" from the note field of the
  55. #         45th weapon in the database if it had been added in-game through the
  56. #         add_note script. It would not delete it if you set it in the database
  57. #         itself.
  58. #==============================================================================

  59. module RPG
  60. #==============================================================================
  61. # ** RPG::BaseItem
  62. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  63. #  Summary of Changes:
  64. #    aliased method - note
  65. #==============================================================================

  66. class BaseItem
  67.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68.   # * Return Note
  69.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70.   alias malgb_acigd_ntedit_7jb3 note
  71.   def note (*args)
  72.     type = case self
  73.     when RPG::Item then 0
  74.     when RPG::Weapon then 1
  75.     when RPG::Armor then 2
  76.     when RPG::Skill then 3
  77.     end
  78.     # Return Original Method + edited additions
  79.     return malgb_acigd_ntedit_7jb3 (*args) + $game_system.ma_added_notes(type, self.id)
  80.   end
  81. end

  82. #==============================================================================
  83. # ** RPG::Enemy
  84. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  85. #  Summary of Changes:
  86. #    aliased method - note
  87. #==============================================================================

  88. class Enemy
  89.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90.   # * Return Note
  91.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92.   alias ma_asciigod_noteedit_enmy_5hv2 note
  93.   def note (*args)
  94.     # Return Original Method + edited additions
  95.     return ma_asciigod_noteedit_enmy_5hv2 (*args) + $game_system.ma_added_notes(4, self.id)
  96.   end
  97. end

  98. #==============================================================================
  99. # ** RPG::State
  100. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  101. #  Summary of Changes:
  102. #    aliased method - note
  103. #==============================================================================

  104. class State
  105.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  106.   # * Return Note
  107.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108.   alias modalg_gdasci_nted_stte_4xs2 note
  109.   def note (*args)
  110.     # Return Original Method + edited additions
  111.     return modalg_gdasci_nted_stte_4xs2 (*args) + $game_system.ma_added_notes(5, self.id)
  112.   end
  113. end
  114. end

  115. #==============================================================================
  116. # ** Game System
  117. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  118. #  Summary of Changes:
  119. #    new instance variable - ma_note_edits
  120. #    aliased method - initialize
  121. #    new method - ma_add_note, ma_delete_note
  122. #==============================================================================

  123. class Game_System
  124.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  125.   # * Object Initialization
  126.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127.   alias modabra_ascod_init_ntedtr_8nn2 initialize
  128.   def initialize (*args)
  129.     @ma_note_edits = [ {}, {}, {}, {}, {}, {} ]
  130.     # Run Original Method
  131.     modabra_ascod_init_ntedtr_8nn2 (*args)
  132.   end
  133.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134.   # * Add Note
  135.   #    type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
  136.   #    id   : the ID of the specific item in its type
  137.   #    note : the note you want to add
  138.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139.   def ma_add_note (type, id, note)
  140.     @ma_note_edits[type][id] = [] if @ma_note_edits[type][id] == nil
  141.     @ma_note_edits[type][id].push (note)
  142.   end
  143.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144.   # * Delete Note
  145.   #    type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
  146.   #    id   : the ID of the specific item in its type
  147.   #    note : the note you want to delete
  148.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149.   def ma_delete_note (type, id, note)
  150.     @ma_note_edits[type][id] = [] if @ma_note_edits[type][id] == nil
  151.     note.is_a? (String) ? @ma_note_edits[type][id].delete (note) : @ma_note_edits[type][id].delete_at (note)
  152.   end
  153.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  154.   # * Added Notes
  155.   #``````````````````````````````````````````````````````````````````````````
  156.   #  Returns the notes added to that item
  157.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158.   def ma_added_notes (type, id)
  159.     return "" if @ma_note_edits[type][id] == nil
  160.     note_string = ""
  161.     @ma_note_edits[type][id].each { |note| note_string += "\n #{note}" }
  162.     return note_string
  163.   end
  164. end

  165. #==============================================================================
  166. # ** Game Interpreter
  167. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  168. #  Summary of Changes:
  169. #    new method - add_note, delete_note
  170. #==============================================================================

  171. class Game_Interpreter
  172.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173.   # * Add Note
  174.   #    type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
  175.   #    id   : the ID of the specific item in its type
  176.   #    note : the note you want to add
  177.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178.   def add_note (type, id, note)
  179.     $game_system.ma_add_note (type, id, note)
  180.   end
  181.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  182.   # * Delete Note
  183.   #    type : the type of item (Item, Weapon, Armor, Skill, State, Enemy)
  184.   #    id   : the ID of the specific item in its type
  185.   #    note : the note you want to delete
  186.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  187.   def delete_note (type, id, note)
  188.     $game_system.ma_delete_note (type, id, note)
  189.   end
  190. end
复制代码
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!

Lv1.梦旅人

梦石
0
星屑
50
在线时间
17 小时
注册时间
2008-5-13
帖子
110
2
发表于 2010-11-17 22:28:19 | 只看该作者
范例~~~范例~~~
虽然我不想当伸手党~~~
可是没有范例~~~作为小白的我·~~~好难搞明白啊~。。。
被LZ PIA 飞·~~~~
回复 支持 反对

使用道具 举报

Lv2.观梦者

铃铃塔的守护者

梦石
0
星屑
626
在线时间
961 小时
注册时间
2010-10-24
帖子
2768

贵宾

3
发表于 2010-11-17 22:36:00 | 只看该作者
本帖最后由 px.凤翔九天 于 2010-11-17 22:36 编辑

范例?貌似楼主没有啊...这个英文不难啊,但是我想问的是这个是从哪里搞来的...居然是英文的。LZ的英语实力我猜测不低,但是其他人呢...所以需要翻译的话大家说一下,我就把说明翻译一下,要是少于1个说需要翻译就算了吧....
需要翻译的部分请直接在此贴“点评”中写出。

魔法麻将独立游戏制作中,欢迎热情的测试员与UI设计师合作开发~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
229
在线时间
596 小时
注册时间
2010-6-21
帖子
1218
4
发表于 2010-11-18 12:34:55 | 只看该作者
为什么不发到VX区呢
如果我是一个美工就好啦!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
5
 楼主| 发表于 2010-11-18 15:28:42 | 只看该作者
回复 懒De说 的帖子

因为版规,因为非原创非讨论,而且是外国的,所以放到地球村。当然,本鹅不介意阁下把这东西放去那里,毕竟很实用。如果阁下转区,我会加上转载字样的 =.=
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
6
 楼主| 发表于 2010-11-18 15:37:49 | 只看该作者
回复 lwdx0822 的帖子

add_note (0, 1, "new \\ note")、delete_note (2, 45, "\\CG[Evil, 5]"),作为新手,会在事件脚本中增加上面两句话就可以。

点评

一不小心连了……本来是想点评的,算了 =.=  发表于 2010-11-18 15:39
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
17 小时
注册时间
2008-5-13
帖子
110
7
发表于 2010-11-18 22:41:19 | 只看该作者
回复 企鹅达达 的帖子

求解你的那俩句话是什么意思~~~起什么作用。。。
我正在学习~。。。。所以~~~呵呵~~~
请LZ明解

点评

delete_note (2, 45, "\\CG[Evil, 5]") 删除备注(防具,45号,"\CG[Evil, 5]")  发表于 2010-11-18 22:59
add_note (0, 1, "new \\ note")、译过来是:增加备注(物品,1号,"new \ note"),注意斜杠数量,至于第一个数字为种类,第二个为id  发表于 2010-11-18 22:58
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1697
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

8
发表于 2010-11-22 10:15:19 | 只看该作者
明白了,这个脚本会配合以备注判定的事件脚本混合使用……么?

点评

就像“运行时修改数据库”那样修改备注名称……  发表于 2010-11-22 10:16
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
9
 楼主| 发表于 2010-11-22 10:44:01 | 只看该作者
本帖最后由 精灵使者 于 2010-11-22 11:44 编辑

回复 精灵使者 的帖子

你可以试一下,毕竟我没有见过可以判定数据库备注的脚本。

点评

建议你先看看能不能看明白那些英文说明,然后用一下这东西试试。毕竟我对脚本不熟,没办法把原理告诉你  发表于 2010-11-22 12:43
老实说我不太懂你的意思。反正这里就是可以在事件中修改备注栏,然后使得那些判断备注栏生效的脚本生效或者无效。修改备注的设置会记录在存档  发表于 2010-11-22 12:40
恩,这种情况肯定是事件修改脚本判定的。 因为以前就有运行的时候修改数据库的文章,能直接修改.note么?  发表于 2010-11-22 12:13
我是指在事件里面判定的没见过。如果是脚本里面判定的估计没问题。另外其实我对正则表达式都不是很懂……脚本准小白  发表于 2010-11-22 11:46
如果我记得没错的话,是.note是备注  发表于 2010-11-22 11:44
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-29 20:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表