Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: mrhx on March 20, 2016, 11:14:33 am

Title: Can't run script from another script [Linux]
Post by: mrhx on March 20, 2016, 11:14:33 am
I'm trying to run script fake.pas that uses procedure from TestScript.pas and TestScript.pas uses procedure from BaseScript.pas, all files in the same folder.
Windows starts it without problems but on Linux (Debian) server doesn't see TestScript unit.
Did I miss something? For example some 'SearchPath' that I need to set additionally on Linux.

config.ini
Code: [Select]
[Config]
Name = TestScript
MainFile = fake.pas
Sandboxed = 1
Debug = 1

[SearchPaths]

[Defines]

fake.pas
Code: [Select]
uses TestScript;
begin
Run();
end.

TestScript.pas
Code: [Select]
unit TestScript;
interface
uses BaseScript; {BaseScript.pas}
procedure Run();
implementation

procedure TestProcedure();
begin
WriteLn(Script.Name+' - procedure TestProcedure');
end;

procedure Run();
begin
TestProcedure(); {TestScript.pas}
BaseProcedure(); {BaseScript.pas}
end;

finalization
end.

BaseScript.pas
Code: [Select]
unit BaseScript;
interface
implementation

procedure BaseProcedure();
begin
WriteLn(Script.Name+' - procedure BaseProcedure');
end;

finalization
end.


Linux log
Code: [Select]
Welcome to Soldat 1.7.0
 Server name: Test
 Server PID: 23163
 [*] Preparing scripts to be launched
 [*] [TestScript] Compilation started
 [*] [TestScript] [Error] (1:6): Unit 'TestScript' not found or contains errors
 [*] [TestScript] Compilation failed
 [*] Disabling TestScript
 [*] Done
----------------------------------------------------------------
New Soldat Map
Loaded weapons mod "Mod v0.0.0"
Survival Mode ON
 Server IP: 0.0.0.0 Port: 23083
 Connection for file server started. Port: 23093

Windows log
Code: [Select]
Welcome to Soldat 1.7.0
 Server name: Test
 Server PID: 4852
 [*] Preparing scripts to be launched
 [*] [TestScript] Compilation started
 [*] [TestScript] Compilation complete
 [*] [TestScript] Loading bytecode
 [*] [TestScript] Bytecode loaded
 [*] Done
----------------------------------------------------------------
TestScript - procedure TestProcedure
TestScript - procedure BaseProcedure
New Soldat Map
Loaded weapons mod "Mod v0.0.0"
Survival Mode ON
 Server IP: 0.0.0.0 Port: 23083
 Connection for file server started. Port: 23093
Title: Re: Can't run script from another script [Linux]
Post by: Falcon` on March 20, 2016, 01:40:56 pm
Unit files should be all lower case. Works on windows as NTFS is case insensiive. Rename TestScript.pas to testscript.pas and BaseScript.pas to basescript.pas and you're good to go.
Title: Re: Can't run script from another script [Linux]
Post by: mrhx on March 20, 2016, 04:35:42 pm
Thanks for fast answer. I knew it that had to be something simple.