主题:  如何编一个中文打字练习程序?

andyfl

职务:普通成员
等级:1
金币:0.0
发贴:127
#12001/2/28 23:49:00
从外部读入一个txt文件放入一个变量里,关键是怎样在用户每输入完一个字、词之后自动识别所输入字或词的是否正确,从而算出输入文字的正确率?



D计划-混沌

职务:管理员
等级:6
金币:15.2
发贴:3528
#22001/3/1 12:16:47
你好像没表达清楚意思
if member().text=变量 or enter then
--最好先去掉字后面的空格
if member().text=变量 then
--正确+1
--正确率计算
end if
end if

    



andyfl

职务:普通成员
等级:1
金币:0.0
发贴:127
#32001/3/1 23:04:42
我的意思是:程序从磁盘上读取一个参照例文,让用户按照此例文中的文字(例文中不包括空格、回车)
用任意一种输入法进行文字录入,那我怎样在用户每输入完一个字或词后立即与例文中的文字对照,从而
判断用户是否输入正确?
(一时着急,没有表达清楚,抱歉了...)



荣誉版主

职务:普通成员
等级:1
金币:0.0
发贴:71
#42001/3/2 12:12:04
在那个接受用户输入的Sprite上写脚本:
On KeyUp me
if (Sprite me.Spritenum).member.text contains ????? then
.....
end if
end



D计划-混沌

职务:管理员
等级:6
金币:15.2
发贴:3528
#52001/3/2 12:14:40
既时检测the number of chars in menber(输入框)=i
member(参照例文).char[i].text与menber(输入框).char[i].text比较



andyfl

职务:普通成员
等级:1
金币:0.0
发贴:127
#62001/3/3 20:33:07
on exitFrame
global inputnum
if the timer<60*40 then
go the frame
set inputnum=length(the text of member "input")
if the text of member "input" <>"" and char inputnum of the text of member "input" <> char inputnum of the text of member "orgtxt" then
set the foreColor of char inputnum of member "input" to 7
else
set the foreColor of char inputnum of member "input" to 255
end if
end if
end
可是,当用户输入一个词或词组时,有时会出现词组的第一个字不能判断的情况。
比如:把“我是”输入成“卧室”(“卧室”两个字是一次录入的!),只能判断出“室”出错,怎么办?



D计划-混沌

职务:管理员
等级:6
金币:15.2
发贴:3528
#72001/3/3 23:10:23
可以试试用一不可见输入框
if member("hideinput").text<>"" then
member("hideinput").text after member("input"))
set inputnum=length(the text of member "input")
set inputaddnum=length(the text of member "hideinput")
repeat with i=1 to inputaddnum
这里写判断
end repeat
member("hideinput").text=""
END
只是一个想法。