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

Project1

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

[RMXP发布] 方便玩脚本的人的变量实时查看脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
66 小时
注册时间
2011-5-25
帖子
73
跳转到指定楼层
1
发表于 2011-8-27 16:25:33 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 shoed 于 2011-8-27 16:25 编辑

本人感觉用RM玩脚本时总感觉非常不方便,不能实时的查看变量值的情况,
就像是VS2005那样,可以在一个输出窗口中看到变量的变化情况,因此
整了个简单的实时查看脚本,代码不复杂,个人感觉还是蛮方便的,但
是现在只能查看单个变量的情况,也算是个Bug吧~~~

先上图:


脚本:
  1. #--------------------------------------------------------------------------
  2. # ● 调试模板ver1.00
  3. # 制作者  小飞侠_shoed
  4. # 用法:
  5. # Debug::OutPutDebugString("map_x",map_x)
  6. # 参数1:调试的变量名  参数2:调试的变量
  7. #--------------------------------------------------------------------------



  8. module Debug

  9.   @@debug_win={}
  10.   @@win_x=0
  11.   @@win_y=0
  12.   @@win_wid=160
  13.   @@win_hei=36*2+32
  14.   
  15.   def Debug.OutPutDebugString(name,variable)
  16.     if @@debug_win.include?(name)
  17.       @@debug_win[name].refresh(name,variable)
  18.     else
  19.       @@win_x=@@debug_win.size%4*@@win_wid
  20.       @@win_y=@@debug_win.size/4*@@win_hei
  21.       @@debug_win[name]=Debug_Window.new(@@win_x,@@win_y,@@win_wid,@@win_hei,name,variable)
  22.       @@debug_win[name].z=9999
  23.     end
  24.   end
  25.   
  26.   class Debug_Window <Window_Base
  27.    
  28.     def initialize(cx,cy,cw,ch,me,str)
  29.       super(cx, cy, cw, ch)
  30.       @variable=[]
  31.       @variable[0]="---"
  32.       @variable[1]=str
  33.       self.contents = Bitmap.new(width - 32, height - 32)
  34.       self.contents.font.size = 32
  35.       refresh("---","---")
  36.     end
  37.    
  38.     def refresh(me,str)
  39.       if me!="---" and @variable[1] != str
  40.         @variable.shift
  41.         @variable.push(str)
  42.       end
  43.       self.contents.clear
  44.       self.contents.font.color = Color.new(255,255,0,255)
  45.       self.contents.draw_text(0, 2, width-32, 32, "#{me} : #{@variable[0]}")
  46.       self.contents.font.color = Color.new(255,0,0,255)
  47.       self.contents.draw_text(0, 38, width-32, 32, "#{me} : #{@variable[1]}")
  48.     end
  49.   end
  50. end
复制代码
使用方法也很简单:
Debug::OutPutDebugString("主角_X",$game_player.x)
Debug::OutPutDebugString("主角_Y",$game_player.y)

第一个参数你可以随意,只要自已认识就行,第二个参数就是变量了
这个函数可以放在while的循环中,也可以放在只执行一次的初始化中,基本没限制
呵呵,功能还很简单。。。

点评

http://bbs.66rpg.com/thread-91444-1-1.html  发表于 2011-8-28 03:09
还不如输出到命令行。  发表于 2011-8-28 03:07

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39925
在线时间
7498 小时
注册时间
2009-7-6
帖子
13489

开拓者贵宾

2
发表于 2011-8-27 21:32:39 | 只看该作者
一般P一下就可以了.

点评

= =  发表于 2011-8-27 21:49
小黄鸡的评论总是那么荡漾  发表于 2011-8-27 21:48
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-22 00:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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