| 
 
| 赞 | 1 |  
| VIP | 246 |  
| 好人卡 | 87 |  
| 积分 | 1 |  
| 经验 | 34142 |  
| 最后登录 | 2015-1-15 |  
| 在线时间 | 323 小时 |  
 Lv1.梦旅人 
	梦石0 星屑55 在线时间323 小时注册时间2010-8-21帖子666 | 
| 
网上找的脚本不少是没有缩进的(例如:人物跟随) ...让人看得蛋疼....所以本工程应运而生...
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  RGSS1,2,3全支持....不过本工程是RX的,所以建议安装RMXP,当然没有也行..但是请继续看下去..
 
 将脚本文件复制到本工程根目录下...直接运行Game.exe就行....
 
 对于没有RMXP的..
 
 class Array  def indentation(i)    return self if self == []    self.del_tem!    ary = [" "] * i    unshift(*ary)   end  def del_tem!    while self[0] == " "      self.delete_at(0)    end  endendclass String  def in_in?(ary)    ary1 = self.split("")    ary1.size.times{|i|return false if ary1[i] != ary[i]}    true  endendWord1 = ["class ","ensure","def ","while ","for ","if(","loop ","if ","begin","module ","unless ","until "] Word2 = ["rescue","when ","else","elsif ","elsif("]show = Sprite.newshow.bitmap = Bitmap.new(640,32)show.y = 100show.bitmap.draw_text(show.bitmap.rect, "请将Scripts.*文件放入根目录",1)40.times{|i|Graphics.update}show.bitmap.clearshow.bitmap.draw_text(show.bitmap.rect, "读取脚本文件",1)40.times{|i|Graphics.update}file = Dir["Scripts.*"]begin  scripts = load_data(file[0])  show.bitmap.clear  show.bitmap.draw_text(show.bitmap.rect, "读取#{file[0]}成功",1)  40.times{|i|Graphics.update}rescue  show.bitmap.clear  show.bitmap.draw_text(show.bitmap.rect, "读取失败",1)  40.times{|i|Graphics.update}  exitend$lines = 0;$in_ = 0;$tem = falsescripts.size.times{|t|  sc_new = "";$in_ = 0  sc = Zlib::Inflate.inflate(scripts[t][2])  sc.each_line{|line|$tem = false    $lines += 1;$lines%=100    Graphics.update if $lines == 0    line_a = line.split("")    line_a.del_tem!    Word1.each{|w|$tem = true if w.in_in?(line_a)}    Word2.each{|w|$in_ -= 2 if w.in_in?(line_a) and $tem = true}    $in_ -= 2 if "end".in_in?(line_a)    $in_ = [$in_,0].max    line_a.indentation(line_a[0] == "=" ? 0 : $in_)    sc_new += line_a.to_s    $in_ += 2 if $tem  }  scripts[t][2] = Zlib::Deflate.deflate(sc_new,6)  show.bitmap.clear  show.bitmap.draw_text(show.bitmap.rect, "处理中#{t}/#{scripts.size}",1)}save_data(scripts, file[0]) show.bitmap.clearshow.bitmap.draw_text(show.bitmap.rect, "处理完毕",1)10.times{|i|Graphics.update}
class Array 
  def indentation(i) 
    return self if self == [] 
    self.del_tem! 
    ary = [" "] * i 
    unshift(*ary)  
  end 
  def del_tem! 
    while self[0] == " " 
      self.delete_at(0) 
    end 
  end 
end 
class String 
  def in_in?(ary) 
    ary1 = self.split("") 
    ary1.size.times{|i|return false if ary1[i] != ary[i]} 
    true 
  end 
end 
Word1 = ["class ","ensure","def ","while ","for ","if(", 
"loop ","if ","begin","module ","unless ","until "] 
  
Word2 = ["rescue","when ","else","elsif ","elsif("] 
show = Sprite.new 
show.bitmap = Bitmap.new(640,32) 
show.y = 100 
show.bitmap.draw_text(show.bitmap.rect, "请将Scripts.*文件放入根目录",1) 
40.times{|i|Graphics.update} 
show.bitmap.clear 
show.bitmap.draw_text(show.bitmap.rect, "读取脚本文件",1) 
40.times{|i|Graphics.update} 
file = Dir["Scripts.*"] 
begin 
  scripts = load_data(file[0]) 
  show.bitmap.clear 
  show.bitmap.draw_text(show.bitmap.rect, "读取#{file[0]}成功",1) 
  40.times{|i|Graphics.update} 
rescue 
  show.bitmap.clear 
  show.bitmap.draw_text(show.bitmap.rect, "读取失败",1) 
  40.times{|i|Graphics.update} 
  exit 
end 
$lines = 0;$in_ = 0;$tem = false 
scripts.size.times{|t| 
  sc_new = "";$in_ = 0 
  sc = Zlib::Inflate.inflate(scripts[t][2]) 
  sc.each_line{|line|$tem = false 
    $lines += 1;$lines%=100 
    Graphics.update if $lines == 0 
    line_a = line.split("") 
    line_a.del_tem! 
    Word1.each{|w|$tem = true if w.in_in?(line_a)} 
    Word2.each{|w|$in_ -= 2 if w.in_in?(line_a) and $tem = true} 
    $in_ -= 2 if "end".in_in?(line_a) 
    $in_ = [$in_,0].max 
    line_a.indentation(line_a[0] == "=" ? 0 : $in_) 
    sc_new += line_a.to_s 
    $in_ += 2 if $tem 
  } 
  scripts[t][2] = Zlib::Deflate.deflate(sc_new,6) 
  show.bitmap.clear 
  show.bitmap.draw_text(show.bitmap.rect, "处理中#{t}/#{scripts.size}",1) 
} 
save_data(scripts, file[0])  
show.bitmap.clear 
show.bitmap.draw_text(show.bitmap.rect, "处理完毕",1) 
10.times{|i|Graphics.update} 
 复制到你的脚本文件到你游戏根目录下,把该脚本复制游戏脚本里,最好是第一行,运行,关闭RMVX/A,把根目录下的脚本文件移动到
 Data文件夹里覆盖。
 
 当然,以免发生不可预料的事,强烈建议使用前备份脚本文件
 
 
  代码美化.7z
(65.88 KB, 下载次数: 94) | 
 评分
查看全部评分
 |