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

Project1

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

[原创发布] 【不是创意的创意】上下左右都能选择的脚本

 关闭 [复制链接]

Lv3.寻梦者 (暗夜天使)

精灵族の天使

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

开拓者贵宾

跳转到指定楼层
1
发表于 2007-3-30 15:53:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 精灵使者 于 2014-12-20 20:16 编辑

这个脚本特点我不用截图了。其实就是模仿以前的游戏的特点,4个键都能选择。
上=左,下=右,左=上,右=下,另外加入了左右循环功能,强烈推荐使用。

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #---------------------------------------------------------------------------
  5. #其实就是模仿以前的老游戏的特点,4个键都能选择菜单。
  6. #上=左,下=右,左=上,右=下,另外加入了左右循环功能,强烈推荐使用。
  7. #---------------------------------------------------------------------------


  8. class Window_Selectable
  9.   #--------------------------------------------------------------------------
  10.   # ● 刷新画面
  11.   #--------------------------------------------------------------------------
  12.   def update
  13.     super
  14.     # 可以移动光标的情况下
  15.     if self.active and @item_max > 0 and @index >= 0
  16.       # 方向键下被按下的情况下
  17.       if Input.repeat?(Input::DOWN)
  18.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  19.         # 或光标位置在(项目数-列数)之前的情况下
  20.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  21.            @index < @item_max - @column_max
  22.           # 光标向下移动
  23.           $game_system.se_play($data_system.cursor_se)
  24.           @index = (@index + @column_max) % @item_max
  25.         else
  26.           if @column_max >= 2 and  @index == @item_max - 1
  27.           $game_system.se_play($data_system.cursor_se)
  28.           @index = -1
  29.           end
  30.           # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  31.           if @column_max >= 2 and @index < @item_max - 1
  32.            # 光标向右移动
  33.            $game_system.se_play($data_system.cursor_se)
  34.            @index += 1
  35.           end
  36.         end
  37.       end
  38.       # 方向键上被按下的情况下
  39.       if Input.repeat?(Input::UP)
  40.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  41.         # 或光标位置在列之后的情况下
  42.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  43.            @index >= @column_max
  44.           # 光标向上移动
  45.           $game_system.se_play($data_system.cursor_se)
  46.           @index = (@index - @column_max + @item_max) % @item_max
  47.         else
  48.           if  @column_max >= 2 and @index == 0
  49.           $game_system.se_play($data_system.cursor_se)
  50.           @index = @item_max
  51.           end      
  52.           # 列数为 2 以上并且、光标位置在 0 之后的情况下
  53.           if @column_max >= 2 and @index > 0
  54.           # 光标向左移动
  55.           $game_system.se_play($data_system.cursor_se)
  56.           @index -= 1
  57.           end
  58.         end
  59.       end
  60.       # 方向键右被按下的情况下
  61.       if Input.repeat?(Input::RIGHT)      
  62.         if @column_max >= 2 and @index == @item_max - 1
  63.           $game_system.se_play($data_system.cursor_se)
  64.           @index = -1
  65.         end
  66.          # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  67.         if @column_max >= 2 and @index < @item_max - 1
  68.            # 光标向右移动
  69.            $game_system.se_play($data_system.cursor_se)
  70.            @index += 1
  71.         else
  72.           # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  73.           # 或光标位置在(项目数-列数)之前的情况下
  74.           if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
  75.            @index < @item_max - @column_max
  76.           # 光标向下移动
  77.           $game_system.se_play($data_system.cursor_se)
  78.           @index = (@index + @column_max) % @item_max
  79.           end
  80.         end  
  81.       end     
  82.       # 方向键左被按下的情况下
  83.       if Input.repeat?(Input::LEFT)
  84.         if  @column_max >= 2 and @index == 0
  85.           $game_system.se_play($data_system.cursor_se)
  86.           @index = @item_max
  87.         end      
  88.        # 列数为 2 以上并且、光标位置在 0 之后的情况下
  89.         if @column_max >= 2 and @index > 0
  90.          # 光标向左移动
  91.           $game_system.se_play($data_system.cursor_se)
  92.           @index -= 1
  93.         else
  94.           # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  95.           # 或光标位置在列之后的情况下
  96.           if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
  97.            @index >= @column_max
  98.           # 光标向上移动
  99.           $game_system.se_play($data_system.cursor_se)
  100.           @index = (@index - @column_max + @item_max) % @item_max
  101.           end
  102.         end
  103.       end
  104.       # R 键被按下的情况下
  105.       if Input.repeat?(Input::R)
  106.         # 显示的最后行在数据中最后行上方的情况下
  107.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  108.           # 光标向后移动一页
  109.           $game_system.se_play($data_system.cursor_se)
  110.           @index = [@index + self.page_item_max, @item_max - 1].min
  111.           self.top_row += self.page_row_max
  112.         end
  113.       end
  114.       # L 键被按下的情况下
  115.       if Input.repeat?(Input::L)
  116.         # 显示的开头行在位置 0 之后的情况下
  117.         if self.top_row > 0
  118.           # 光标向前移动一页
  119.           $game_system.se_play($data_system.cursor_se)
  120.           @index = [@index - self.page_item_max, 0].max
  121.           self.top_row -= self.page_row_max
  122.         end
  123.       end
  124.     end
  125.     # 刷新帮助文本 (update_help 定义了继承目标)
  126.     if self.active and @help_window != nil
  127.       update_help
  128.     end
  129.     # 刷新光标矩形
  130.     update_cursor_rect
  131.   end
  132. end

  133. #==============================================================================
  134. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  135. #==============================================================================
复制代码

Lv3.寻梦者 (暗夜天使)

精灵族の天使

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

开拓者贵宾

2
 楼主| 发表于 2007-3-30 15:53:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个脚本特点我不用截图了。其实就是模仿以前的游戏的特点,4个键都能选择。
上=左,下=右,左=上,右=下,另外加入了左右循环功能,强烈推荐使用。

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #---------------------------------------------------------------------------
  5. #其实就是模仿以前的老游戏的特点,4个键都能选择菜单。
  6. #上=左,下=右,左=上,右=下,另外加入了左右循环功能,强烈推荐使用。
  7. #---------------------------------------------------------------------------


  8. class Window_Selectable
  9.   #--------------------------------------------------------------------------
  10.   # ● 刷新画面
  11.   #--------------------------------------------------------------------------
  12.   def update
  13.     super
  14.     # 可以移动光标的情况下
  15.     if self.active and @item_max > 0 and @index >= 0
  16.       # 方向键下被按下的情况下
  17.       if Input.repeat?(Input::DOWN)
  18.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  19.         # 或光标位置在(项目数-列数)之前的情况下
  20.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  21.            @index < @item_max - @column_max
  22.           # 光标向下移动
  23.           $game_system.se_play($data_system.cursor_se)
  24.           @index = (@index + @column_max) % @item_max
  25.         else
  26.           if @column_max >= 2 and  @index == @item_max - 1
  27.           $game_system.se_play($data_system.cursor_se)
  28.           @index = -1
  29.           end
  30.           # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  31.           if @column_max >= 2 and @index < @item_max - 1
  32.            # 光标向右移动
  33.            $game_system.se_play($data_system.cursor_se)
  34.            @index += 1
  35.           end
  36.         end
  37.       end
  38.       # 方向键上被按下的情况下
  39.       if Input.repeat?(Input::UP)
  40.         # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  41.         # 或光标位置在列之后的情况下
  42.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  43.            @index >= @column_max
  44.           # 光标向上移动
  45.           $game_system.se_play($data_system.cursor_se)
  46.           @index = (@index - @column_max + @item_max) % @item_max
  47.         else
  48.           if  @column_max >= 2 and @index == 0
  49.           $game_system.se_play($data_system.cursor_se)
  50.           @index = @item_max
  51.           end      
  52.           # 列数为 2 以上并且、光标位置在 0 之后的情况下
  53.           if @column_max >= 2 and @index > 0
  54.           # 光标向左移动
  55.           $game_system.se_play($data_system.cursor_se)
  56.           @index -= 1
  57.           end
  58.         end
  59.       end
  60.       # 方向键右被按下的情况下
  61.       if Input.repeat?(Input::RIGHT)      
  62.         if @column_max >= 2 and @index == @item_max - 1
  63.           $game_system.se_play($data_system.cursor_se)
  64.           @index = -1
  65.         end
  66.          # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  67.         if @column_max >= 2 and @index < @item_max - 1
  68.            # 光标向右移动
  69.            $game_system.se_play($data_system.cursor_se)
  70.            @index += 1
  71.         else
  72.           # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  73.           # 或光标位置在(项目数-列数)之前的情况下
  74.           if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
  75.            @index < @item_max - @column_max
  76.           # 光标向下移动
  77.           $game_system.se_play($data_system.cursor_se)
  78.           @index = (@index + @column_max) % @item_max
  79.           end
  80.         end  
  81.       end     
  82.       # 方向键左被按下的情况下
  83.       if Input.repeat?(Input::LEFT)
  84.         if  @column_max >= 2 and @index == 0
  85.           $game_system.se_play($data_system.cursor_se)
  86.           @index = @item_max
  87.         end      
  88.        # 列数为 2 以上并且、光标位置在 0 之后的情况下
  89.         if @column_max >= 2 and @index > 0
  90.          # 光标向左移动
  91.           $game_system.se_play($data_system.cursor_se)
  92.           @index -= 1
  93.         else
  94.           # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  95.           # 或光标位置在列之后的情况下
  96.           if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
  97.            @index >= @column_max
  98.           # 光标向上移动
  99.           $game_system.se_play($data_system.cursor_se)
  100.           @index = (@index - @column_max + @item_max) % @item_max
  101.           end
  102.         end
  103.       end
  104.       # R 键被按下的情况下
  105.       if Input.repeat?(Input::R)
  106.         # 显示的最后行在数据中最后行上方的情况下
  107.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  108.           # 光标向后移动一页
  109.           $game_system.se_play($data_system.cursor_se)
  110.           @index = [@index + self.page_item_max, @item_max - 1].min
  111.           self.top_row += self.page_row_max
  112.         end
  113.       end
  114.       # L 键被按下的情况下
  115.       if Input.repeat?(Input::L)
  116.         # 显示的开头行在位置 0 之后的情况下
  117.         if self.top_row > 0
  118.           # 光标向前移动一页
  119.           $game_system.se_play($data_system.cursor_se)
  120.           @index = [@index - self.page_item_max, 0].max
  121.           self.top_row -= self.page_row_max
  122.         end
  123.       end
  124.     end
  125.     # 刷新帮助文本 (update_help 定义了继承目标)
  126.     if self.active and @help_window != nil
  127.       update_help
  128.     end
  129.     # 刷新光标矩形
  130.     update_cursor_rect
  131.   end
  132. end

  133. #==============================================================================
  134. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  135. #==============================================================================
复制代码
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2006-7-21
帖子
714
3
发表于 2007-3-30 18:56:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

苹果梨

梦石
0
星屑
43
在线时间
6 小时
注册时间
2007-2-14
帖子
720
4
发表于 2007-3-30 22:52:25 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

逃兵

5
发表于 2007-3-30 23:55:39 | 只看该作者
大概明白一点:
单行选择中 上=左;下=右
就是类似把
if Input.repeat?(Input::LEFT)

改成
if Input.repeat?(Input::LEFT) or Input.repeat?(Input::UP)

虽然可能会有点出入,但差不多就是这个意思.

一个细节修改
「If you judge people, you have no time to love them.」—— Mother Teresa
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

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

开拓者贵宾

6
 楼主| 发表于 2007-3-31 00:09:37 | 只看该作者
我上边好像写过了……这个是为了那个画面选择菜单写的。一般默认为上下,画面选择菜单为左右,所以不方便。用了这个就可以了。
我上边好像写了。
上下也可以选左右菜单,左右也可以选择上下菜单。另外又添进去了以前站中写的左右循环脚本,经检查可以运行。
就是物品栏循环有点奇怪了点……不过不影响使用。
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

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

开拓者贵宾

7
 楼主| 发表于 2007-3-31 00:10:29 | 只看该作者
以下引用gpra8764于2007-3-30 14:52:25的发言:


以下引用小傻瓜于2007-3-30 10:56:24的发言:

用来干吗?


是啊,又没有说明,又没有截图……

我代码上边的一行字就是说明。
上=左,下=右……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 22:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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