原帖由 sure 于 2008-3-12 04:01 PM 发表 http://advent.pkuxkx.com:1234/forum/images/common/back.gif
var num;
function money(money)
{
var t="一百二十八万三千零四十五";
num=0;
var n=ch2num(t);
world.note(n);
}
function ch2num(ch)
{
var r,str;
... zmud支持js么?是mush的。 能不能给个适合zmud的阿?
3x zmud适合手动,mush适合全自动,如果是挂机的话推荐mush,mush非常稳定,zmud挂长时间程序就死掉了。 mush不会修改阿,没法改的更适合自己!
教教我zmud里面怎么设?前面留的都不行啊? 数字转换lua版
function chs2num(s)
local cur = 0
local yi = 0
local sgl = 0
local len = string.len(s)
local tt = {}
tt["零"] = function() end
tt["一"] = function() sgl = 1 end
tt["二"] = function() sgl = 2 end
tt["三"] = function() sgl = 3 end
tt["四"] = function() sgl = 4 end
tt["五"] = function() sgl = 5 end
tt["六"] = function() sgl = 6 end
tt["七"] = function() sgl = 7 end
tt['八'] = function() sgl = 8 end
tt["九"] = function() sgl = 9 end
tt["十"] = function()
if sgl == 0 then sgl = 1 end
cur = cur + sgl * 10
sgl = 0
end
tt["百"] = function()
cur = cur + sgl * 100
sgl = 0
end
tt["千"] = function()
cur = cur + sgl * 1000
sgl = 0
end
tt["万"] = function()
cur = (cur +sgl) * 10000
sgl = 0
end
tt["亿"] = function()
yi = (cur + sgl) * 100000000
cur = 0
sgl = 0
end
for i = 1,len,2 do
k = string.sub(s,i,i+1)
tt()
end
num = yi + cur +sgl
return num
end 提供一条CMUD的转换数字语句,ZMUD不知道是不是可以用:
$number = %subregex($number,"(一|二|三|四|五|六|七|八|九)","(?MEMBER:1)")
number是中文数字,经过这条语句的处理,可以把(一|二|三|四|五|六|七|八|九)这些数字转换成1-9。
至于十,百,千,万的转换就不一一列举了。
zmud 4.62通过
#alias ch2num {tempb=%1;tempbb=%1;
tempb=%replace(@tempb,"万","*10000+");
tempb=%replace(@tempb,"千","*1000+");
tempb=%replace(@tempb,"百","*100+");
tempb=%replace(@tempb,"十","*10+");
tempb=%replace(@tempb,"九","9");
tempb=%replace(@tempb,"八","8");
tempb=%replace(@tempb,"七","7");
tempb=%replace(@tempb,"六","6");
tempb=%replace(@tempb,"五","5");
tempb=%replace(@tempb,"四","4");
tempb=%replace(@tempb,"三","3");
tempb=%replace(@tempb,"二","2");
tempb=%replace(@tempb,"一","1");
tempb=%remove("零",@tempb);
#if %ismember(%rightback(@tempb,1),"+") {tempb=%leftback(@tempb,1)};
#var @tempbb @tempb}
当然,超过万了,就不行了,呵呵。但玩mud基本够用了
enjoy:)
使用:zmud命令行打ch2num 两万三千四百五十六
得到23456 #FUNC numlist {一 二 三 四 五 六 七 八 九 十 百 千 万}
#TRIGGER {^??(%*)两黄金~(Gold~)} {count=%replace(%replace(%replace(%concat(零,%1),零十,零一十),零,),百十,百一十);#9 count=%replace(@count,%word(@numlist,%i),%i);#4 count=%replace(@count,%word(@numlist,%i+9),*1%repeat(0,%i)+0);count=%eval(@count)} {atoi} 548
有效范围:零 ~ 九万九千九百九十九
改编成alias就自己做吧,简单至极
[ 本帖最后由 bluse 于 2010-5-19 04:21 PM 编辑 ]
页:
1
[2]