• Welcome to AtomicTorch Studio Forums.
 

I have a mod with a simple script. SP error "Can't start local game server"

Started by loudent, April 17, 2015, 09:43:15 PM

loudent

So I'm working on a relatively simple mod with a single script in it. Its got a on ship destroyed handler (does nothing but a console output right now). However, whenever I tried to start a game with it I get an error "Can't start local game server.

So I copied the contents from collision.js into my script and tried again. Same error. I changed the *name* of my script to collision.js and suddenly it works. Are we not allowed to add new scripts? we have to modify/use ones already there?

-Loudent

MenschMaschine

No Berries!

loudent

I tried different names. The last one was JettisonCargo.js

Does it matter?

MenschMaschine

I would guess there is some form of list of assets which are loaded by name.
Compared to a method where every *.js file in a given folder within the scripts-hierarchy
would be loaded and processed by the engine.

You also could try one of the JS-validation websites to be really really sure
that there are no errors. (no offense meant :) )
No Berries!

loudent

No offense taken, but when I literally copied one of the existing scripts into mine I can be reasonably sure there are no errors. Only difference is the name.

jeeplaw

In the header of the file, do you have any USING or INCLUDE statements?

loudent

Quote from: jeeplaw on April 18, 2015, 11:55:46 AM
In the header of the file, do you have any USING or INCLUDE statements?

Yes, of course.

Also, In my last test, I copied over the collision.js from the core pack into my mod, tested it and it worked, changed the name from collsion.js to something like lcollsion.js (no code changes) and it fails. If you want I could post the mod somewhere and you can look at it.

MenschMaschine

No Berries!

loudent

Quote from: MenschMaschine on April 18, 2015, 07:43:07 PM
That would help, yes.

Ok, here's a mod named coltesta.mpk
https://www.dropbox.com/s/akjy52r3widd88g/coltesta.mpk?dl=0

and here's a mod named coltestb.mpk
https://www.dropbox.com/s/jfz229bvyjno08x/coltestb.mpk?dl=0

The only difference (between module names) is that the script in coltesta is named collisiox.js and the file in coltestb.mpk is called collision.js

coltesta.mpk does not work (with the aforementioned error) and coltestb.mpk *does* work

loudent

Follow up. It appears the problem is the location. I had both files in data\scripts\global in my mod structure. If I move the collisiox.js out of global (say down to the scripts directory) it works again.

Well, it loads. I have yet to get it to work with a script


MenschMaschine

That's weird. Although, it remembers me of two shipmods that i tried.
Flessens Enterprise and N1c0's Nebula-1C0 both have their hull-data lying outside of the usual frigate, cruiser, other folders
and it still works.
No Berries!

ai_enabled

loudent, have you tried running the game server in multiplayer mode? It will output the errors. In that case the errors are:
[ERR] data/scripts/global/collisionb.js: action.Create() error: Action was already created: OnProjectileHitShip
[ERR] data/scripts/global/collisionb.js: action.Create() error: Action was already created: OnDebrisCollided


It means that the other script has been already added these actions. You cannot call
actions.Create("OnProjectileHitShip");
actions.Create("OnDebrisCollided");

in another script as it already called from the original script.
That's why the copy-pasted script with a different name is not working.

Regards!