Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
lovromirnik

Includes

Recommended Posts

Hello,

 

how would I specify SCAR to load includes from the same folder as the Main Script is in, regardless of the location?

Right now I had trouble transporting scripts from one computer to another because I had to change all the paths!

 

Thanks a lot! :o

Lovro Mirnik

Share this post


Link to post
Share on other sites

Just to give a little heads up, neither .\Include.scar or ScriptPath + Include.scar work.. :confused:

 

- - - Updated - - -

 

program Name;
{.include ScriptPath + Include.scar}

begin
 Include;
 PlaySound(ScriptPath + 'RandomSound.wav');
end.

 

Including it that way returns an error that an Include has not been found at the specified path.

If I remove the Include files the Sound gets played without problem.

 

What am I doing wrong?

 

Edit: Of course giving it the whole path works like a charm. See above problem why this isn't optimal for me.

 

- - - Updated - - -

 

Hello again,

 

I've found that I've been wrong for not actually saving the Script into the same folder as the Include.

After having it in the same folders I can call an include with either {.include Include.scar} and {$I Include.scar}.

 

I reckon they do the same thing. :D

Edited by lovromirnik
Additional information that could prove to be helpful

Share this post


Link to post
Share on other sites

Yea you can't put functions /variables etc. in the includes {} area.

 

$I Filename.scar will refer you to the includes folder/script folder automatically, otherwise enter the path manually or add \ to refer to subfolders.

Share this post


Link to post
Share on other sites

There is a search order it looks for includes if you don't include a path at all and just use the name of the include. Can't for the life of me remember the exact order. Think it's includes folder, scar application folder, script folder. Or something like that.

Share this post


Link to post
Share on other sites

^

 

And if you really need to know you could test it by doing Test.scar and having TestProcedure; WriteLn( with different letters

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...