TroisVerites Posted March 2, 2012 Share Posted March 2, 2012 Hi All I am working in C++.NET, Python. And at least 20 years that I have more touched a line of pascal. I am a little lost in this world. Advice? I would like to separate the code in multiple files or modules. Consider SeaFight: I would like to have a module for: -client area-> Client.scar -Minimap-> MiniMap.scar -The Map-> Map.scar -MainMod-> MainMod.scar 1) How to compile modules without error ' Unexpected end of file"? 2) How to include modules in the main module 'MainMod.scar'? 2.1) What manners to create modules? 3) Can you give me advice on Scar, undocumented functions, a fairly complete tutorial on pascal? Thank you in advance Quote Link to comment Share on other sites More sharing options...
rsutton Posted March 2, 2012 Share Posted March 2, 2012 1. Usually when you get an unexpected end of file, well There is a few issues that could cause this but the most common is that you are not running your MAIN loop correctly. When you enter Scar and amke your procedures and functions these are ABOVE you main "Begin and End" This last end will have a . on it like this END. the others would have end; to end the function or procedure. Nothing executes unless it is by itself Begin and End which is not inside of a procedure or function. Sorry pretty crappy explaination but I dont have time to write a whole section. You can also view freddy's scar manual and tutorials on Wiki.scar-divi.com I think it is. So in your Main script put this at the top of your list for includes [scar] {$I YOURFolder/Client.scar} {$I YOURFolder/MiniMap.scar} {$I YOURFolder/Map.scar} {$I YOURFolder/MainMod.scar}[/scar] If the files are not in a seperate folder and in the same folder as your main script is you can delete the YOURFolder path and just put the .scar 2.1) In your "mod" files as you like to call them you dont need a Main Begin and End loop, dont need a "program new" or any crap like that. Just store your procedures and functions there and you can call them up easy as pie... YourProcedure; would call up the Procedure YourProcedure; which is in your other file. As for your 3rd question: Google Quote Link to comment Share on other sites More sharing options...
TroisVerites Posted March 2, 2012 Author Share Posted March 2, 2012 Hi I just would like to know if it is possible to compile a separed file with some procedures . Because when I compile this kind of file , I have always "' Unexpected end of file"?. If I compile a script with a Begin ...end. , it is always fine. Thanks for your reply Quote Link to comment Share on other sites More sharing options...
rsutton Posted March 2, 2012 Share Posted March 2, 2012 I Just told you..... ---------- Post added at 06:55 AM ---------- Previous post was at 06:54 AM ---------- Or you are missing an End; somewhere in your script Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted March 3, 2012 Share Posted March 3, 2012 Here is a visual example. MiniMap.Scar File [scar] {------------------------------------------------------------------------------- MiniMap Functions/Procedure -------------------------------------------------------------------------------} Procedure FindME; begin end; //What ever else you want to add [/scar] Main Script [scar] Program SeaFight; {$I YourFolder\MiniMap.Scar} // This is a folder in the same Folder/Location of this script the contains MiniMap.Scar begin FindME;// Do some procedure from minimap.scar... end. [/scar] Quote Link to comment Share on other sites More sharing options...
TroisVerites Posted March 3, 2012 Author Share Posted March 3, 2012 HI shadowrecon, Yes , I have understood , what you said. In your sample MiniMap.scar , is there a way to compile this file , without de MainScript and without Error ? Yes I Know I can add a Begin...end. at the end of the file to compile it. But I try to find another clean solution. Thanks Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted March 3, 2012 Share Posted March 3, 2012 (edited) HI shadowrecon, Yes , I have understood , what you said. In your sample MiniMap.scar , is there a way to compile this file , without de MainScript and without Error ? Yes I Know I can add a Begin...end. at the end of the file to compile it. But I try to find another clean solution. Thanks Umm only other way i would see would to include it in a separate file like you would your main script and run that. I wouldn't recommend just putting it in your main script as errors in there may make you think there is an error in your include. The best way is to just add a begin and end. which i think is pretty easy/simple, while reducing the chances of external errors giving you the run around. =P Edited March 4, 2012 by shadowrecon Quote Link to comment Share on other sites More sharing options...
FHannes Posted March 3, 2012 Share Posted March 3, 2012 HI shadowrecon, Yes , I have understood , what you said. In your sample MiniMap.scar , is there a way to compile this file , without de MainScript and without Error ? Yes I Know I can add a Begin...end. at the end of the file to compile it. But I try to find another clean solution. Thanks What do you mean by compile? It's an include file, it will only compile when included in a script. Quote Link to comment Share on other sites More sharing options...
TroisVerites Posted March 3, 2012 Author Share Posted March 3, 2012 Compile = To check Syntax Quote Link to comment Share on other sites More sharing options...
FHannes Posted March 3, 2012 Share Posted March 3, 2012 Compile = To check Syntax If you really want to do that without including it in another file, just press compile, it'll throw the end of file error, but if a syntax error is detected it will throw that one first. Quote Link to comment Share on other sites More sharing options...
TroisVerites Posted March 4, 2012 Author Share Posted March 4, 2012 Thanks Freddy Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted March 4, 2012 Share Posted March 4, 2012 If you really want to do that without including it in another file, just press compile, it'll throw the end of file error, but if a syntax error is detected it will throw that one first. did not know this, thanks something to keep in mind. Quote Link to comment Share on other sites More sharing options...