Trying to get the functionality to load all running scripts upon load to work

This commit is contained in:
Daniel Xie 2016-12-14 15:44:18 -06:00
parent 334c144bae
commit 7ec22480a2
5 changed files with 9 additions and 3 deletions

@ -11,6 +11,9 @@ TESTING TODO:
If a server has no more money available it cannot be hacked anymore
Should work automatically...because your money gained percentage will be multiplied by 0
When the game is loaded re-load all of the scripts in runningScripts
- Does not seem to work. Although the addWorkerScript() function itself seems to work
- LOoks like its because AllServer is an object, so AllServers.length does not work. Have
to make a custom AllServers.size() function or something oogle it im too tired right now
Tasks TODO:
Script offline progress
If a script has bad syntax...it fucks everything up when you try to run it so fix that

@ -25,12 +25,12 @@
<!-- Main game files -->
<script src="src/Constants.js"></script>
<script src="src/Script.js"></script>
<script src="src/Server.js"></script>
<script src="src/Player.js"></script>
<script src="src/Faction.js"></script>
<script src="src/Company.js"></script>
<script src="src/Terminal.js"></script>
<script src="src/Script.js"></script>
<script src="src/engine.js"></script>

@ -98,7 +98,6 @@ function addWorkerScript(script, server) {
s.serverIp = server.ip;
workerScripts.push(s);
console.log("Pushed script onto workerScripts");
}
runScriptsLoop();

@ -130,10 +130,15 @@ Reviver.constructors.Script = Script;
//Called when the game is loaded. Loads all running scripts (from all servers)
//into worker scripts so that they will start running
function loadAllRunningScripts() {
var count = 0;
console.log("AllServers.length: " + AllServers.length);
for (var i = 0; i < AllServers.length; i++) {
var server = AllServers[i];
console.log("Loading scripts from server " + server.hostname);
for (var j = 0; j < server.runningScripts.length; j++) {
count++;
addWorkerScript(server.runningScripts[j], server);
}
}
console.log("Loaded " + count.toString() + " running scripts");
}

@ -297,7 +297,6 @@ var Engine = {
//Character info
Engine.Display.characterInfo = document.getElementById("character-info");
//Engine.displayCharacterInfo(); - Don't think I need this
//Script editor
Engine.Display.scriptEditorText = document.getElementById("script-editor-text");