求助!汉化CombatGizmo3.2又出现新问题了!!
新问题在4楼--8.19 试着把所有 "you" 改成 YOU 或者 CSG_L_YOU你给的代码中没看到zhCN的翻译,只好推测一下了
CSG_CaptureAttack 函数中这一段
[language=lua] if (targetName and targetName == CSG_L_YOU or targetName == YOU) then
else
damage = 0;
end[/language]
第二个参数 targetName 不是和常量 "you" 进行比较的,应该是这里的问题了。作者没有考虑到多语种情况,或者变量 YOU / CSG_L_YOU 翻译不当。 非常感谢biggates。。把you改为CSG_L_YOU然后在localization里CSG_L_YOU = "你"即可
这样就能适应多语种了
汗。。。2。1的时候我知道把you改为“你”。。今天怎么变傻了 新的CombatGizmo3.2改动不是特别大
但是我发现按照3.0的方法把"you"全部改为"CSG_L_YOU"然后在localization里CSG_L_YOU = "你"
这个方法没用了。。。还是报错
3.0和3.2的这部分代码完全一样 没有任何改动。
另外我试着在美服客户端改"you"和"CSG_L_YOU"为任意值,比如“12345”。它都能正常在美服客户端运行。不知道怎么办了,弄了一天没搞好。
各位来看看是什么问题
附上我汉化过没问题的3.0和有问题的3.2 汉化者不能只进行常量字符串的修改,也要对程序结构进行理解才行,这样才能得到提高。如果生搬硬套地采用经验来修改,自然无法保证得到正确的结果。
系统给的错误提示是很重要的调试信息,一定要善加利用。
EDIT:刚开始心情不好,说的话可能有些过分了,见谅。 [quote]原帖由 [i]biggates[/i] 于 2007-8-19 02:31 发表 [url=http://bbs.cwowaddon.com/redirect.php?goto=findpost&pid=14417&ptid=1420][img]http://bbs.cwowaddon.com/images/common/back.gif[/img][/url]
……你要看错误报告啊,至少贴出来个啊
光给源代码,别人还得帮你测试
PS:我测试的时候还没发现错误 [/quote]
和上次一摸一样的错误额。。。
出错的地方的代码和3.0版没有任何的变化
[2007/08/19 02:49:12-15-x1]: CombatGizmo\CombatSentryGizmo.lua:1320: attempt to index field '?' (a nil value)
CombatGizmo\CombatSentryGizmo.lua:1179: in function `CSG_GetAttackerInfo'
CombatGizmo\CombatSentryGizmo.lua:917: in function `CSG_ShowNewName'
CombatGizmo\CombatSentryGizmo.lua:794: in function `CSG_CaptureAttack'
CombatGizmo\CombatSentryGizmo.lua:297: in function `CSG_OnEvent'
<string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>
---[[language=lua]CSG_Parse(event, arg1);
if( event == "PLAYER_ENTER_COMBAT" ) then
CSG_AddMessage("|cff3366ffEntering Combat");
CSGiz.inCombat = 1;
if (UnitAffectingCombat("target") and CSGiz.inCombat ~= 1) then
CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", 0, nil);
end
return;
elseif( event == "PLAYER_LEAVE_COMBAT" ) then
CSGiz.inCombat = nil;
CSG_AddMessage("|cff3366ffLEAVING COMBAT!");
return;
elseif( event == "PLAYER_REGEN_DISABLED" and CSGiz.inCombat ~= 1) then
CSGiz.onHate = 1;
if (UnitAffectingCombat("target") ) then
CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", 0, nil);
end
return;
elseif( event == "PLAYER_REGEN_ENABLED" ) then
CSGiz.onHate = nil;
CSG_AddMessage("|cff3366ffLEAVING COMBAT!");
return;
elseif( event == "UPDATE_MOUSEOVER_UNIT" ) then
--UnitAffectingCombat("target") and UnitName("targettarget") == UnitName("player") and UnitIsEnemy( "player", "target" )
if ( UnitIsDeadOrGhost( "mouseover" ) ) then
return;
end
--if ( not UnitAffectingCombat("mouseover") ) then
--return;
--end
if IsShiftKeyDown() then
CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover", 1);
return;
end
--Show Friends
if ( CSGiz.infotarget == 1 ) then
if ( UnitIsFriend( "player", "mouseover" ) and UnitPlayerControlled("mouseover") ) then
CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover", 1);
return;
end
end
--Show Enemies
if ( CSGiz.detect == 1 ) then
if (UnitIsEnemy( "player", "mouseover" ) and UnitPlayerControlled("mouseover")) then
CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover", nil, 1);
return;
end
end
--Show Creatures
if ( CSGiz.creatures == 1 ) then
if (UnitReaction("player", "mouseover") ~= nil and UnitReaction("player", "mouseover") <= 3 ) then
CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover", 1);
return;
end
end
--UNCOMMENT ME
--if (CSGiz.infotarget == 1 or CSG_CurList == 0) then
-- return;
--else
--see if the name exists on our list
--CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover");
--end
return;
elseif( event == "PLAYER_TARGET_CHANGED" ) then
if (IsPartyLeader()) then
if IsShiftKeyDown() then
if ( UnitCanAttack("player", "target") ) then
SetRaidTarget("target",RaidTargetIcon1);
end
elseif IsControlKeyDown() then
if ( UnitCanAttack("player", "target") ) then
SetRaidTarget("target",RaidTargetIcon2);
end
elseif IsAltKeyDown() then
if ( UnitCanAttack("player", "target") ) then
SetRaidTarget("target",RaidTargetIcon3);
end
end
end
if ( UnitIsDeadOrGhost( "target" ) ) then
return;
end
if (CSG.gathering == 1) then
CSG_AddMessage("PLAYER_TARGET_CHANGED: Returning due to gathering");
return;
else
CSG.curtarget = UnitName("target");
if (CSG.curtarget) then
CSG_AddMessage("PLAYER_TARGET_CHANGED: "..CSG.curtarget);
else
CSG_AddMessage("PLAYER_TARGET_CHANGED: (no target)");
end
--return;
end
--Show Friends
if ( CSGiz.infotarget == 1 ) then
if ( UnitIsFriend( "player", "target" ) and UnitPlayerControlled("target") ) then
CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", nil, "target", 1);
return;
end
end
--Show Enemies
if ( CSGiz.detect == 1 ) then
if (UnitIsEnemy( "player", "target" ) and UnitPlayerControlled("target")) then
CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", nil, "target", nil, 1);
return;
end
end
--Show Creatures
if ( CSGiz.creatures == 1 ) then
if (UnitReaction("player", "target") ~= nil and UnitReaction("player", "target") <= 3 ) then
CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", nil, "target", 1);
return;
end
end
--UNCOMMENT ME
--if (CSGiz.infotarget == 1 or CSG_CurList == 0) then
--return;
--else
--see if the name exists on our list
--local unitName = UnitName("target");
--CSG_CaptureAttack(UnitName("target"), "CSG_L_YOU", nil, nil);
--end
--return;
end[/language]所有的you已经替换成CSG_L_YOU并在localization里CSG_L_YOU = "你" [quote]原帖由 [i]biggates[/i] 于 2007-8-19 02:31 发表 [url=http://bbs.cwowaddon.com/redirect.php?goto=findpost&pid=14417&ptid=1420][img]http://bbs.cwowaddon.com/images/common/back.gif[/img][/url]
汉化者不能只进行常量字符串的修改,也要对程序结构进行理解才行,这样才能得到提高。如果连系统给的错误信息都不理解,生搬硬套地采用前一个版本的方法来修改,当然无法得到正确的结果。 ... [/quote]
因为2次提示的错误信息完全一样
涉及这部分的代码经过对比发现却没有变化,所以我采用了第1次的解决办法。但是无法解决 Debug啊
观察所用到的各个数据都是什么,引用了哪些不正常的变量,在何种状态下出错
我测试10分钟都没出错,想帮都帮不了
PS: 要灵活运用 /print 命令 [quote]原帖由 [i]biggates[/i] 于 2007-8-19 03:08 发表 [url=http://bbs.cwowaddon.com/redirect.php?goto=findpost&pid=14423&ptid=1420][img]http://bbs.cwowaddon.com/images/common/back.gif[/img][/url]
Debug啊
观察所用到的各个数据都是什么,引用了哪些不正常的变量,在何种状态下出错
我测试10分钟都没出错,想帮都帮不了
PS: 要灵活运用 /print 命令 ... [/quote]
哎。。。要学习的东西还很多啊
我妈OT了,得睡觉了 明天继续搞
现在的错误就是当鼠标移向一个红名敌对生物时无法收集敌对方的信息,然后报错 把所有 "CSG_L_YOU" 换成 CSG_L_YOU
见CombatSentryGizmo.lua 297 - 318 行,其他地方也存在。
例如:[language=lua] CSG_CaptureAttack(UnitName("mouseover"), "CSG_L_YOU", nil, "mouseover", 1);[/language]
改成:[language=lua] CSG_CaptureAttack(UnitName("mouseover"), CSG_L_YOU, nil, "mouseover", 1);[/language]
CSG_L_YOU 是常量字符串的名称,代表 "你"。把他当成字符串的值就不好了。
[language=lua] --内存中的数据
CSG_L_YOU = "你"
"CSG_L_YOU" = "CSG_L_YOU"
"you" = "you"
[/language]
当然,光这么改还不行。localization.lua 中的以下变量要翻译:
[language=lua] CSG_MAGE = "法师";
CSG_WARLOCK = "术士";
CSG_PRIEST = "牧师";
CSG_DRUID = "德鲁伊";
CSG_SHAMAN = "萨满祭司";
CSG_PALADIN = "圣骑士";
CSG_ROGUE = "盗贼";
CSG_HUNTER = "猎人";
CSG_WARRIOR = "战士";[/language]
PS:看你的汉化还不是很完整。作为汉化作者,要力争使用户的使用体验达到完美,使用过程中应该有完全脱离原版的感觉。
汉化,也是一门艺术……
PS2:建议联系原作者将 "you" 都改成 CSG_L_YOU,以及采用UnitClass()的第二个返回值作为 AttackerList[slot].cls 及 CSG_AbilityList 的各 cl 值,可以减小本地化工作量及出错
回复 #10 biggates 的帖子
恩 ,我再试试看我想问问为什么3.0中同样的代码到3.2中却无法使用了呢?
另外3.0版本的汉化还有技能列表没完成,所以标注了下BETA版本,3.2版我只是下载下来测试的,还没有全面汉化,应为每次更新版本我都先比较2个版本间不同的代码以学习学习。 没错,是相同的代码,你笔误了……
看2楼和你以前修改的3.0,CSG_L_YOU是不加引号的,3.2里你改成加了引号的了…… [quote]原帖由 [i]biggates[/i] 于 2007-8-19 14:47 发表 [url=http://bbs.cwowaddon.com/redirect.php?goto=findpost&pid=14477&ptid=1420][img]http://bbs.cwowaddon.com/images/common/back.gif[/img][/url]
没错,是相同的代码,你笔误了……
看2楼和你以前修改的3.0,CSG_L_YOU是不加引号的,3.2里你改成加了引号的了…… [/quote]
啊。。我找到了问题的所在。。
我汉化3.0版本的CSG_L_YOU也是加引号的。。。
但是。。。。。。。。我测试3.2版本的时候
CSG_MAGE = "法师"; CSG_WARLOCK = "术士"; CSG_PRIEST = "牧师"; CSG_DRUID = "德鲁伊"; CSG_SHAMAN = "萨满祭司"; CSG_PALADIN = "圣骑士"; CSG_ROGUE = "盗贼"; CSG_HUNTER = "猎人"; CSG_WARRIOR = "战士";
这一步。。我没做。
研究了半天。。其实错的位置并不是我们所关注的地方! 什么人啊……
CSG_L_YOU 不要加引号了,会导致数据错误(不是语法错误)。具体什么效果我不知道…… [quote]原帖由 [i]biggates[/i] 于 2007-8-20 13:02 发表 [url=http://bbs.cwowaddon.com/redirect.php?goto=findpost&pid=14608&ptid=1420][img]http://bbs.cwowaddon.com/images/common/back.gif[/img][/url]
什么人啊……
CSG_L_YOU 不要加引号了,会导致数据错误(不是语法错误)。具体什么效果我不知道…… [/quote]
啊。我承认我太粗心大意了。。不过目前还没发现错误。。
还是听话去掉引号好了。。。 象biggates说的
修改职业的话还真不如建议作者在一些API取值的时候,取第二个返回值
不会发生本地化导致的错误,扩展性能还好
另外,关于YOU和部分代码的问题建议你还不如参看下原来的combatsentrygizmo
现在这个作者主要还是作的merge的工作 :)
ps:顺带怀念csg的作者(也就是tipbuddy的作者了,害4人了)
再ps:原来的CSG在二次攻击filter方面会出现错误,在过滤名字含“的“的也会出错
建议你学习dennie的做法,改过滤combatlog为globestring部分的代码 :0
页:
[1]