文字MUD游戏论坛-天下泥潭群英会-水泊梁山

文字MUD游戏论坛-天下泥潭群英会-水泊梁山 (http://www.aolai.org/forums/index.php)
-   『 机器人制作及下载 』 (http://www.aolai.org/forums/forumdisplay.php?f=5)
-   -   [抛砖引玉] 中文数字转换罗马数字机器人 (http://www.aolai.org/forums/showthread.php?t=15414)

shuieryin 2009-08-05 16:08

[抛砖引玉] 中文数字转换罗马数字机器人
 
1 个附件
其实也不是机器人拉,就一个trigger,用的上的朋友请下载,高手有空的话帮帮忙改改code找找bug吧..

bow

指令是: chat chanum "中文数字"

例子: chat chanum 九千九百九十九

shuieryin 2009-08-05 16:11

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
顺便说下,此机器不能转换“亿"

shuieryin 2009-08-06 00:56

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
1 个附件
压缩版 .

shuieryin 2009-08-06 01:05

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
checkNum = 0
correctNum = 1
tmp = %2
chatName = %1
showNum = @tmp
#math tmpCount {%len( @tmp) / 2}
tmpLen = %len( @tmp)
#loop 1,@tmpCount {
#math tmpLen {@tmpLen - 2}
tmpNum = %db( @convertChineseNum, %left( @tmp, 2))
#addkey tmpNumList {%i} {@tmpNum}
@tmp = %rightback( @tmp, @tmpLen)
}
#loopdb @tmpNumList {
#if %val>99 {
#math lastPos {%key - 1}
#math nextPos {%key + 1}
lastNum = %db( @tmpNumList, @lastPos)
nextNum = %db( @tmpNumList, @nextPos)
#if %val=10000 {
#math lastTwoPos {%key - 2}
lastTwoNum = %db( @tmpNumList, @lastTwoPos)
#if @lastNum!=10 {#math checkNum {@checkNum * %val}}
#unvar lastTwoPos
#unvar lastTwoNum
} {#math checkNum {@checkNum + @lastNum*%val}}
#if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}}
#unvar lastPos
#unvar nextPos
#unvar lastNum
#unvar nextNum
}
#if %val=0 {
#math nextPos {%key + 1}
nextNum = %db( @tmpNumList, @nextPos)
#math nextTwoPos {%key + 2}
nextTwoNum = %db( @tmpNumList, @nextTwoPos)
#if @nextTwoNum<10 {#math checkNum {@checkNum + @nextNum}}
#if @nextTwoNum=10000 {#math checkNum {@checkNum + @nextNum}}
#if @nextNum>9 {correctNum = 0}
#unvar nextPos
#unvar nextNum
#unvar nextTwoPos
#unvar nextTwoNum
}
#if %val=10 {
#math lastPos {%key - 1}
#math nextPos {%key + 1}
lastNum = %db( @tmpNumList, @lastPos)
nextNum = %db( @tmpNumList, @nextPos)
#if !@lastNum {#if @nextNum!=10000 {#math checkNum {@checkNum + %val + @nextNum}} {#math checkNum {%val * @nextNum}}} {#if @nextNum!=10000 {#math checkNum {@checkNum + @lastNum*%val + @nextNum}} {#math checkNum {(@checkNum + @lastNum*%val) * @nextNum}}}
#if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}}
#unvar lastPos
#unvar nextPos
#unvar lastNum
#unvar nextNum
}
#if %key=@tmpCount {
#if %val<10 {
#math lastPos {%key - 1}
lastNum = %db( @tmpNumList, @lastPos)
#if @lastNum<10 {#if @lastNum>0 {correctNum = 0}}
#unvar lastPos
#unvar lastNum
}
}
#if @tmpCount=1 {checkNum = %db( @tmpNumList, %key)}
}
#if @correctNum=0 {chat %1, 数字错误:@showNum} {chat %1, 数字为: @checkNum}
#unvar tmpNumList
#unvar checkNum
#unvar correctNum
#unvar tmp
#unvar chatName
#unvar showNum
#unvar tmpLen
#unvar tmpCount
#unvar tmpNum

bbs108 2009-08-12 23:34

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
这个用在什么地方tenten

yiyou 2009-08-17 11:29

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
这个。。。技术活太多,实用性不强啊。。。

xyuer 2009-11-11 03:02

回复: [抛砖引玉] 中文数字转换罗马数字机器人
 
引用:

作者: yiyou (帖子 104561)
这个。。。技术活太多,实用性不强啊。。。

这个貌似没什么用啊
:em01::em01:


所有时间均为格林尼治时间 +9, 现在的时间是 18:37.

Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号

站长 fengyue


Content Relevant URLs by vBSEO 3.6.1