Page 1 of 1

Can include() be used during game?

Posted: 11 Nov 2012, 05:08
by aubergine
I've got an API for diagnostics that I won't always want loaded. However, on occasion it might be useful to try and load it via a chat command (I've already made an API for managing chat commands).

Can include() be used during a game, or does it only work when the JS env is being initialised?

Here's what I want to do:

Code: Select all

var diagPaths = ["multiplay/skirmish", "multiplay/skirmish/api"];

diagPaths.some(function(path) {
	include(path+"/Diag.js");
	return (typeof Diag == "function"); // will not try any more paths if loaded
});

Re: Can include() be used during game?

Posted: 11 Nov 2012, 12:14
by Per
I think it should work. Only one way to know for sure...

Re: Can include() be used during game?

Posted: 12 Nov 2012, 07:14
by aubergine
woohoo, just added automatic loading of dependencies in my API :)

Any chance of an includePath() function? :)

Re: Can include() be used during game?

Posted: 12 Nov 2012, 10:16
by Per
aubergine wrote:Any chance of an includePath() function? :)
What would that do? O_o

Re: Can include() be used during game?

Posted: 12 Nov 2012, 13:16
by NoQ
I think he has viewtopic.php?f=5&t=10030#p111907 in mind (?)

Re: Can include() be used during game?

Posted: 12 Nov 2012, 18:16
by aubergine
Yup, I was thinking of that topic :) Just posted a reply to Per's comment in that topic.

Re: Can include() be used during game?

Posted: 15 Nov 2012, 04:33
by aubergine
Just posted an addendum in the other topic mentioned above.