Something I'm having an issue with is calling functions on both default and custom objects. Here is what I'm using to test things out:
<body>
<byondclass name = "coutput">
<script>
(function() {
return {
config: { isdefault: 1 },
fn: {
client_connected: function(obj, sub) {
this.elem.innerHTML = "client has logged in!";
//this.document.write("client has logged in!");
//this.document.write(obj.name + "client has logged in!");
}
}
};
})()
</script>
</byondclass>
<div id = "main_window" byondclass = "child" skinparams = "left: map; right: output; splitter: 50; is-vert = true">
<div id = "map" byondclass = "map" style = "size = 1024x608; zoom = 1"></div>
<div id = "output" byondclass = "coutput"></div>
</div>
</body>
And here is what I'm using to [attempt] to call my defined function, client_connected:
src << output(list2params(list(src)), "output:client_connected")
Nothing shows up in the output and there are no console errors. What's interesting is when I disable my environment's .dms file and run the game, I do get output that says "the + player" (which is the type of src), but that's not the output I'm looking for. More, I'd like to know what's happening that causes that message to appear.
Thanks.
I don't think user-defined functions in fn can be called in DM code. Instead, what I think you should be doing is relying on what you're given. For instance:
You'd then use winset to deliver commands to the "output" element.