| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 14508 | 
 
| 最后登录 | 2013-2-18 | 
 
| 在线时间 | 4 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 4 小时
 
        - 注册时间
 - 2008-8-20
 
        - 帖子
 - 159
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
前几天,我玩了一个叫《超级马力奥》的RM游戏 
那游戏里面有个脚本,运行了那脚本按窗口的X是不能退出的 
那脚本让我懂了按X时游戏会运行exit命令 
所以我写了这个脚本,可以在退出游戏时提示是否退出 
不同意就不能退出~ 
同意退出后会自动渐变退出,渐变退出和MAIN有关系 
效果: 
![]()  
以下是脚本: 
if true#true为使用,false为不使用 
def exit(i=0) 
name=""#提示标题,可不填 
$scene = nil if options("是否要退出游戏?",name) 
end 
end 
def options(text,name="") 
 @ask1 = [text,name] 
 @ctext = Array.new 
 @m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i') 
 @w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i') 
 @msgbox = Win32API.new('user32', 'MessageBox', %w(p p p i), 'i') 
 @wsm = Proc.new{|i|  
        len = @m2w.call(65001, 0, i, -1, nil, 0) 
        buf = "\0\0" * len 
        @m2w.call(65001, 0, i, -1, buf, buf.size/2) 
        len = @w2m.call(0, 0, buf, -1, nil, 0, nil, nil) 
        @ctext.push "\0" * len 
        @w2m.call(0, 0, buf, -1, @ctext.last, @ctext.last.size, nil, nil) 
        } 
[@ask1].flatten.each{|i| @wsm.call(i)} 
  def self.warning 
    1.times{|j| j == 0 ?((yield @ctext[0], @ctext[1]) == 1 ? (return true) : (return false)):(return false)} 
  end 
  return self.warning{|a,b| @msgbox.call(0, a, b, 1) } 
end  |   
 
 
 
 |