Script.Load()

VitdomVitdom Join Date: 2012-04-30 Member: 151345Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow, WC 2013 - Shadow
I have seen some other mods which add code to a file like this:
Server.lua
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Script.Load("lua/Server.lua")

// Additional mod code here<!--c2--></div><!--ec2-->
But when I do this everything breaks, even with a clean file, with nothing but Script.Load("lua/Server.lua") in it.

Am I using Script.Load() incorrectly or am I doing some other thing wrong?

Comments

  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer
    What do you mean by breaks?

    Can you post a bit more example code?

    Script.Load() simply loads and parses the file into the Lua environment.
  • VitdomVitdom Join Date: 2012-04-30 Member: 151345Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow, WC 2013 - Shadow
    edited November 2012
    I activated a mod with the file Server.lua whose contents were only " Script.Load("lua/Server.lua") ".

    Server.exe does not output any errors at all, and stuff seem to run fine. But any commands inputted does not execute, e.g. "sv_changemap ns2_tram, cyclemap, cheats 1, addbot, sv_password testpass". Connecting to the server as a client works fine though.

    Output: <a href="http://pastebin.com/855pVsz7" target="_blank">http://pastebin.com/855pVsz7</a>
    (I haven't updated to 231 yet)

    I later added Shared.Message("MOD-SERVER.LUA") into the mod and Shared.Message("ORIGINAL-SERVER.LUA") into the original file, and only MOD-SERVER.LUA is printed into the console.
  • MullvadenMullvaden Join Date: 2012-11-08 Member: 168302Members
    Try renamed your mod server file to server2.lua or serverMod or something else.
    If you have lua files in your mod folder that have the same name as the NS2 original files it will only use the one in the mod.
  • VitdomVitdom Join Date: 2012-04-30 Member: 151345Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow, WC 2013 - Shadow
    edited November 2012
    Do multiple mods' game_setup.xmls override each other or are they compatible with each other? What is the best way to implement a mod to be compatible with other mods? Is there none?
  • fsfodfsfod uk Join Date: 2004-04-09 Member: 27810Members, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Its just which ever mod gets loaded first that has a game_setup.xml wins I think. I did come up with my own system to allow multiple mods in my menu mod but it would only work if every mod used it
Sign In or Register to comment.