查看: 5402|回复: 9

[已经解决] 【RGSSGameMain】VA脚本中如何调用RGSS300中的RGSSGameMain函数?

[复制链接]
梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
发表于 2013-2-2 12:00:18 | 显示全部楼层 |阅读模式

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

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

×
各位大大,最近发现XP和VA有很大的不同,举个例子:

[pre lang="ruby" line="1"]#参数1:游戏句柄,参数2:脚本文件地址,参数3:加密档案文件地址
$RGSSGameMain = Win32API.new("RGSS102J", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$RGSSGameMain.call($GetActiveWindow.call,"C:\\Temp\\RMVA\\Scripts.rxdata","")[/pre]

上面代码在XP工程中完美运行,但是请看下面

[pre lang="ruby" line="1"]#参数1:游戏句柄,参数2:脚本文件地址,参数3:加密档案文件地址
$RGSSGameMain = Win32API.new("RGSS300", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$RGSSGameMain.call($GetActiveWindow.call,"C:\\Temp\\RMVA\\Scripts.rvdata2","")[/pre]

在VA中却报错:
1.JPG

这是为什么啊?有没有人知道呢?能否帮下忙。。
新手学习中.....努力吧!!
梦石
0
星屑
660
在线时间
1286 小时
注册时间
2011-6-14
回帖
3949
发表于 2013-2-2 12:22:07 | 显示全部楼层
脚本文件读取失败,检查脚本是否存在
然后,是不是VA专用格式的脚本
回复

使用道具 举报

梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
 楼主| 发表于 2013-2-2 19:29:01 | 显示全部楼层
satgo1546 发表于 2013-2-2 12:22
脚本文件读取失败,检查脚本是否存在
然后,是不是VA专用格式的脚本

老兄。。我都在研究API了。。你说我能犯这话错误吗?
PS:拜托帮帮忙呗

点评

谢谢提醒,我也是着急所致,不好意思啊,下次注意...  发表于 2013-2-16 16:34
态度可以稍微好一点么?这态度实在令人太失望了。  发表于 2013-2-2 20:51
新手学习中.....努力吧!!
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
653
在线时间
3774 小时
注册时间
2011-2-26
回帖
1577

开拓者

发表于 2013-2-2 19:33:13 来自手机 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
 楼主| 发表于 2013-2-2 20:03:48 | 显示全部楼层
晴兰 发表于 2013-2-2 19:33
脚本文件名要用unicode,如果没有中文路径的话可以认为每个字符后面加个\0, 最后加上两个\0 ...

什么意思?看的不太明白,能否告诉我,你将我的代码拿去测试了吗?
难道RMXP和RMVA的编码格式不一致??

点评

已经试验过,确实可行,但是如果脚本路径里面有“中文”就不行了,有解决办法吗?  发表于 2013-2-2 21:37
http://bbs.66rpg.com/thread-280866-1-1.html 这个功能上不是很完善,但初始化已经出来了  发表于 2013-2-2 20:41
我想说我初始化过VA,第二个参数是"D\0a\0t\0a\0/\0S\0c\0r\0i\0p\0t\0.\0r\0v\0d\0a\0t\0a\02\0\0\0"  发表于 2013-2-2 20:36
新手学习中.....努力吧!!
回复

使用道具 举报

Fuzzy Ginkgo

梦石
0
星屑
61105
在线时间
1933 小时
注册时间
2010-6-26
回帖
1535

烫烫烫开拓者

发表于 2013-2-2 20:45:19 | 显示全部楼层
本帖最后由 orzfly 于 2013-2-2 20:49 编辑

[pre lang="ruby"]
$RGSSGameMain = Win32API.new("RGSS300", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$RGSSGameMain.call($GetActiveWindow.call,"C\000:\000\\\000T\000e\000m\000p\000\\\000R\000M\000V\000A\000\\\000S\000c\000r\000i\000p\000t\000s\000.\000r\000v\000d\000a\000t\000a\0002\000\000\000","")
[/pre]

[pre lang="ruby"]
#==============================================================================
# ■ String
#------------------------------------------------------------------------------
#  为字符串追加编码转换的机能。
#==============================================================================
# 参考:
#http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx
#http://msdn.microsoft.com/en-us/library/windows/desktop/dd374130(v=vs.85).aspx
#http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
#==============================================================================
class String
  MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  WideCharToMultiByte = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  def to_uni
    len = MultiByteToWideChar.call 65001, 0, self, -1, nil, 0
    buf = "\0" * (len * 2 + 2)
    MultiByteToWideChar.call 65001, 0, self, -1, buf, buf.size / 2
   
    buf
  end
  
  def from_uni
    len = WideCharToMultiByte.call 65001, 0, (self.respond_to?(:force_encoding) ? self.force_encoding("ASCII-8BIT") : self) + "\000\000", -1, nil, 0, nil, nil
    ret = "\0" * len
    WideCharToMultiByte.call 65001, 0, self, -1, ret, ret.size, nil, nil
   
    self.respond_to?(:force_encoding) ?
    ret.force_encoding("ASCII-8BIT").delete("\000") :
    ret.delete("\000")
  end
end

$RGSSGameMain = Win32API.new("RGSS300", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$RGSSGameMain.call($GetActiveWindow.call,"C:\\Temp\\RMVA\\Scripts.rvdata2".to_uni,"")
[/pre]

评分

参与人数 1梦石 +1 收起 理由
Mic_洛洛 + 1 你是好人

查看全部评分

我的言论只代表我个人的观点,不代表雇主及/或任何第三方的立场。
Opinions expressed are solely my own and do not express the views or opinions of my employer and/or any third parties.
捐赠 | GitHub
回复

使用道具 举报

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
回帖
1296
发表于 2013-2-2 21:17:52 来自手机 | 显示全部楼层
确实有区别,用的w_char,不过话说这样有意义么?切换脚本?- -b

点评

你说对了。。就是切换脚本用,哈哈!  发表于 2013-2-2 21:21
回复

使用道具 举报

梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
 楼主| 发表于 2013-2-2 21:38:40 | 显示全部楼层
orzfly 发表于 2013-2-2 20:45
$RGSSGameMain = Win32API.new("RGSS300", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new ...

代码已经测试通过,很好很强大,但是有点遗憾:如果脚本路径里面有“中文”就不行了,有解决办法吗?
新手学习中.....努力吧!!
回复

使用道具 举报

梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
 楼主| 发表于 2013-2-3 13:37:50 | 显示全部楼层
中文路径的问题如果解决就可以认可啦,各位帮帮忙吧
新手学习中.....努力吧!!
回复

使用道具 举报

梦石
0
星屑
784
在线时间
380 小时
注册时间
2009-3-9
回帖
336
 楼主| 发表于 2013-2-16 16:53:24 | 显示全部楼层
orzfly 发表于 2013-2-2 20:45
$RGSSGameMain = Win32API.new("RGSS300", "RGSSGameMain", "IPP", "V")
$GetActiveWindow = Win32API.new ...

十分感谢,这个转换脚本很强大,但是好像中文路径不能转。。有什么办法解决吗?
新手学习中.....努力吧!!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部