Your OnEvent_ChatWndReceiveMessage has incorrect parameters.
The first parameter is Chat window, yes, but the second is
the name of the users sending the message, while the third one being the
message itself. Finally, MessageKind is a variable and you can't not set 1 for that
So your codes should look like:
code:
function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind){
if(Msg == rndnumber) {
return rndnumber + "was the correct number."
}