Author Topic: Crash on exec server.cs  (Read 1987 times)

so whenever i execute some files on a remote VM thats hosting a blockland server, the game will crash after reaching the first line. It'll say something like "Establishing global variable. Failed: %error" and then it'll crash the game. ive tried using setModPaths(Getmodpaths()); but it still crashes when i exec the file. the file is Weapon_DwepRussianExpansion

are you execing it after the server is running? local variables exec'd in global context will instantly crash the server - this includes stuff in mods that does like %error = ForceRequiredAddon(etc); etc... since those %error values are local variables attempting to be run in the global scope. however if they're exec'd normally in the loading process by being enabled, they are fine, as addons are not loaded in global context.

ive never encountered it before. im execing after the server is running. see, i've done exec("add-ons/weapon_stuff/server.cs"); before on server.cs files that have those forcerequiredaddon bullstuffs and never encountered a crash before. whats the best way to execute server.cs files that have that in it? after server run?

I never use local variables outside of functions in my add-ons. They can cause never ending loading in some cases.

im not using them. its just inside most weapon add-ons' server.cs. i dont know why its crashing the VM but not my regular computer

ive never encountered it before. im execing after the server is running. see, i've done exec("add-ons/weapon_stuff/server.cs"); before on server.cs files that have those forcerequiredaddon bullstuffs and never encountered a crash before. whats the best way to execute server.cs files that have that in it? after server run?
those addons may have used a $global var instead of a %local var, is all i can guess. that or you're using blocklandloader on wine and the addon tries to attach a dll module, but i kinda doubt it is.

why can't you just enable it normally prior to server load? you can re-order packages without any chance of crashing after the server is done loading, if that's the main issue.

Because sometimes I gotta make changes to files.

Because sometimes I gotta make changes to files.
change any %vars not in a function to global then? assuming you're not crashing on your local computer when executing it with ingame eval that might be the difference here. Port's eval handles %local vars properly (since it creates a context for them to exist in)

Local variables in eval are atrocious