SRL Archive - Help and Support

Back with a nooby question!


Dark_Sniper

2010-06-28 03:13:57

Ok this is going to sound very noobish coming from a veteran like me, but…

When I include a file for my script is there a way to include a file that is in the same path as my script?

I obviously tried {.include ScriptPath/myincludetothescript.scar}

so anyone want to help this old dog out?

or is this not possible lol.

ZephyrsFury

2010-06-28 03:42:43

{.include MyIncludeToTheScript.scar} works for me.

Dark_Sniper

2010-06-28 03:55:09

lol it should.

Lets say my include is stuck in a folder.
I dont know what folder it is in, but I know its in the same folder as the script being ran.

how do I include it now?

or what if the include is on my desktop? :p.

Narcle

2010-06-28 03:59:12

Well I know there is 'ScriptPath' but I never tried it to include a file. I was actually curious about this myself.

Dark_Sniper

2010-06-28 04:02:48

Lol so I tried script path and what an epic fail that was lol…

Include file C:\Program Files\SCAR\includes\ScriptPath\myinclude.scar does not exist.

LOL, soooo any help?

ZephyrsFury

2010-06-28 04:04:53

{.include YourIncludeFile.scar} works if the include is in the same folder as your script. Not sure about it being on your desktop though, you'd need the path of your desktop which changes for each OS w/e.

Also 'ScriptPath' is a function so you wont' be able to use it in compiler directives (ie including files).

Narcle

2010-06-28 04:10:47

From: ZephyrsFury
{.include YourIncludeFile.scar} works if the include is in the same folder as your script. Not sure about it being on your desktop though, you'd need the path of your desktop which changes for each OS w/e.

Also 'ScriptPath' is a function so you wont' be able to use it in compiler directives (ie including files).


Indeed this works no matter where the files are as long as they are in the same place. (just tested)

Dark_Sniper

2010-06-28 04:11:08

Ya… my attempt seems to agree with that statement…

I have a solution in mind…

I need to know if there is a way to include a file from somewhere outside the include folder… and how…


or


if there is a way to include a file that you have no idea where it's located, just that its in the same path as the script you wanna run.

Dark_Sniper

2010-06-28 04:12:10

ok Ill try :p.

Narcle

2010-06-28 04:14:22

File 1: named test.simba
procedure hi;
begin
writeln('hi');
end;

File 2:
{$i test.simba}

begin
hi;
end.

Save them both in same place, run file 2…

Dark_Sniper

2010-06-28 04:18:53

I got it working.

Lol looks like ima have to switch to simba.
I still run scar :p.

ZephyrsFury

2010-06-28 04:31:24

You can also use a direct file path:


{.include C:\Users\Erik\Desktop\test2.scar}

Narcle

2010-06-28 04:46:48

From: ZephyrsFury
You can also use a direct file path:


{.include C:\Users\Erik\Desktop\test2.scar}


I think he wants it setup so its universal.