Project1
标题:
方便玩脚本的人的变量实时查看脚本
[打印本页]
作者:
shoed
时间:
2011-8-27 16:25
标题:
方便玩脚本的人的变量实时查看脚本
本帖最后由 shoed 于 2011-8-27 16:25 编辑
本人感觉用RM玩脚本时总感觉非常不方便,不能实时的查看变量值的情况,
就像是VS2005那样,可以在一个输出窗口中看到变量的变化情况,因此
整了个简单的实时查看脚本,代码不复杂,个人感觉还是蛮方便的,但
是现在只能查看单个变量的情况,也算是个Bug吧~~~
先上图:
1.jpg
(145.45 KB, 下载次数: 11)
下载附件
保存到相册
2011-8-27 16:16 上传
脚本:
#--------------------------------------------------------------------------
# ● 调试模板ver1.00
# 制作者 小飞侠_shoed
# 用法:
# Debug::OutPutDebugString("map_x",map_x)
# 参数1:调试的变量名 参数2:调试的变量
#--------------------------------------------------------------------------
module Debug
@@debug_win={}
@@win_x=0
@@win_y=0
@@win_wid=160
@@win_hei=36*2+32
def Debug.OutPutDebugString(name,variable)
if @@debug_win.include?(name)
@@debug_win[name].refresh(name,variable)
else
@@win_x=@@debug_win.size%4*@@win_wid
@@win_y=@@debug_win.size/4*@@win_hei
@@debug_win[name]=Debug_Window.new(@@win_x,@@win_y,@@win_wid,@@win_hei,name,variable)
@@debug_win[name].z=9999
end
end
class Debug_Window <Window_Base
def initialize(cx,cy,cw,ch,me,str)
super(cx, cy, cw, ch)
@variable=[]
@variable[0]="---"
@variable[1]=str
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 32
refresh("---","---")
end
def refresh(me,str)
if me!="---" and @variable[1] != str
@variable.shift
@variable.push(str)
end
self.contents.clear
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(0, 2, width-32, 32, "#{me} : #{@variable[0]}")
self.contents.font.color = Color.new(255,0,0,255)
self.contents.draw_text(0, 38, width-32, 32, "#{me} : #{@variable[1]}")
end
end
end
复制代码
使用方法也很简单:
Debug::OutPutDebugString("主角_X",$game_player.x)
Debug::OutPutDebugString("主角_Y",$game_player.y)
第一个参数你可以随意,只要自已认识就行,第二个参数就是变量了
这个函数可以放在while的循环中,也可以放在只执行一次的初始化中,基本没限制
呵呵,功能还很简单。。。
作者:
fux2
时间:
2011-8-27 21:32
一般P一下就可以了.
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1