I tried to google for an answer but I haven't found anything that could help me.RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object it.gotoandplay.smartfoxserver.data.User@12fb62c of
class it.gotoandplay.smartfoxserver.data.User where it expected String, Number,
Boolean or Scriptable instance. Please check your code for missing Context.java
ToJS() call.
Rhino Usage Warning: Missed Context.javaToJS() conversion
Rhino Usage Warning: Missed Context.javaToJS() conversion
I keep getting this warning:
The warning seems to appear everytime this function gets calledLapo wrote:Hi,
it looks like you are passing the wrong object in a function call. Probably a User object instead of a userId which is expected as a number.
If you also have the line number of the error please double check your code to make sure you are passing the right arguments.
Code: Select all
//Send Bullet Data
if (cmd == "send.bulletdata")
{
var myZone = _server.getCurrentZone();
var myRoom = myZone.getRoom(fromRoom);
var playerID = user.getPlayerIndex();
var usersInRoom = myRoom.getAllUsers();
var usersToRespond = new Array();
for (index = 0; index<usersInRoom.length; index++) {
if (user != usersInRoom[index]) {
usersToRespond.push( usersInRoom[index] );
}
}
var response = {};
response._cmd = "receive.bulletdata";
response.pID = playerID;
response.pObject = params;
_server.sendResponse(response, fromRoom, null, myRoom.getAllUsers());
}The for loop that you use to populate the usersToRespond array is not necessary. The Room object exposes a method called getAllUsersButOne().
It works like this:
Maybe the error is caused in the foor loop. Try removing it and use the above example instead.
It works like this:
It will return an array with all the users in the room except myUser.var usersToRespond = room.getAllUsersButOne(myUser)
Maybe the error is caused in the foor loop. Try removing it and use the above example instead.
Well it's replaced and I'm not getting that error anymore. So thanks a lot for your help!Lapo wrote:The for loop that you use to populate the usersToRespond array is not necessary. The Room object exposes a method called getAllUsersButOne().
It works like this:It will return an array with all the users in the room except myUser.var usersToRespond = room.getAllUsersButOne(myUser)
Maybe the error is caused in the foor loop. Try removing it and use the above example instead.