My Setup:
I'm using Orbiter (full, not micro) with a Javascript room module that is currently sending CHAT_MESSAGE's from a module GreeterBot.js (found in the Union example) and I'm coming across a problem that several people have seemed to run into. I've read through a few forum posts already:
http://www.unionplatform.com/?page_id=3151:
(OrbiterMicro tutorial)
http://www.unionplatform.com/forums/viewtopic.php?f=3&t=146&p=491&hilit=message+listener+error#p491
(Sent a raw UPC through the messageManager)
http://www.unionplatform.com/forums/viewtopic.php?f=3&t=194&p=634&hilit=client.sendMessage#p634
(I think this developer is using [orbiter.getClientManager().sendMessage("CHAT_MESSAGE", [ e.getClientID() ], null, "Private hi to you!");] as a solution)
These tutorials pretty much nailed it, but I'm still looking for a solution to evt.getClient().getClientID(); not validating the getClientID.
It seems that either the message listener in unionchat.js isn't written correctly, or the onRoomAddClient(evt) function in GreeterBot.js isn't written right (getting the right arguments, or performing the sendMessage() with the right arguments)
Also, the union admin puts out a curious warning, that the "ScriptWrapperModule can't find the field [_script_file] for autoset"- is this something set in union.xml?
If you'd like to visit the site on which I'm developing (not sure that's gonna help), its 94ism.com/drawr. Below is the error reporting from Union Admin, the browser console, and my function in GreeterBot.js
In Union Admin-
Module [net.user1.union.script.ScriptWrapperModule] could not find field [_script_file] for autoset. Assuming it will be handled manually in module code.
Script [GreeterBot.js] was loaded by ScriptEngine [null]
In my console:
Uncaught Error: A message listener for incoming message [CHAT_MESSAGE] encountered an error:
TypeError: Cannot call method 'getClientID' of null
Ensure that all [CHAT_MESSAGE] listeners supply a first parameter whose datatype is Client (or a compatible type). Listeners ... parameters match the following actual message arguments:
Goodbye Guest1.
In GreeterBot.js:
function onRoomAddClient(evt) {
var args = ["Welcome Guest" + evt.getClient().getClientID()];
moduleContext.getRoom().sendMessage("CHAT_MESSAGE", null, args);
}
In the Orbiter API:
addMessageListener(message, listener, thisArg, forRoomIDs)
---Indicates the arguments that can (optionally) be input into the addMessageListener;
The tutorial only inputs "CHAT_MESSAGE" and chatMessageListener, which are [message] and [listener], but not [thisArg] or [forRoomIDs].
So I think this may be part of the issue?
@Colin, any ideas???