小建议:
function sci(msg)
if(ranint(1, 3) == 1)then
return "{self}出剪刀!"..self_fair
elseif(ranint(1, 3) == 2)then
return "{self}出石头!"..self_win
elseif(ranint(1, 3) == 3)then
return "{self}出布!"..self_lose
end
end
这里的写法稍稍有些问题,产生自己结果的时候在if中做了3次ranint,有可能导致三个if全空(8/27)而无输出结果。推荐在函数开始时产生并固定自己结果,例如:
function sci(msg)
local self_choice = ranint(1, 3)
if(self_choice == 1)then
return "{self}出剪刀!"..self_fair
elseif(self_choice == 2)then
return "{self}出石头!"..self_win
elseif(self_choice == 3)then
return "{self}出布!"..self_lose
end
end