Can include() be used during game?

For AI and campaign script related discussions and questions
Post Reply
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Can include() be used during game?

Post 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
});
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Can include() be used during game?

Post by Per »

I think it should work. Only one way to know for sure...
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Can include() be used during game?

Post by aubergine »

woohoo, just added automatic loading of dependencies in my API :)

Any chance of an includePath() function? :)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Can include() be used during game?

Post by Per »

aubergine wrote:Any chance of an includePath() function? :)
What would that do? O_o
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Can include() be used during game?

Post by NoQ »

I think he has viewtopic.php?f=5&t=10030#p111907 in mind (?)
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Can include() be used during game?

Post by aubergine »

Yup, I was thinking of that topic :) Just posted a reply to Per's comment in that topic.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Can include() be used during game?

Post by aubergine »

Just posted an addendum in the other topic mentioned above.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply