Jump to content

Firestorm Preprocessor Help


Lele Zanzibar
 Share

You are about to reply to a thread that has been inactive for 1442 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi, 

I really want to use the Firestorm Preprocessor - it sounds like a great feature to help me write / manage my scripts better with the #include capabilities it offers so I don't have to copy-paste the same bits of code into every single script that requires it.

I've tried using the Firestorm Preprocessor before - I've ran into these issues then which is what made me give up using it... "Ill formed preprocessor directive #endif." Can someone help me or can someone point me to a more in-depth guide or something on using the preprocessor? Please do not link "https://wiki.firestormviewer.org/fs_preprocessor#setup" as I've read through this multiple times and can't figure out what is going on (unless there is something in there that I'm missing). I am LITERALLY using that guide and copy/pasting the tutorial. I've tried googling the error messages and there just doesn't seem to be any documentation out there regarding this...

This tutorial worked ONCE for me today - then I tried modifying the code to include the files I wanted to include... it stopped working. Fine - I probably had something wrong with my code... so I reset everything back to the tutorial so I can try again and I get this problem... "Ill formed preprocessor directive #endif". It's so frustrating. 

I've attached a picture with my scripts in VS Code, in SL, the error message, and my firestorm preprocessor settings.

 

Also, is there a guide on including within include files? I was trying to make one include file for my project that could include other bits of code all scripts in my project are going to require. I am not worried about double-including things.

 

Like...

Project-A > Script-1 --> #Includes Project-A-Includes-Scripts-File

Project-A > Script-2 --> #Includes Project-A-Includes-Scripts-File 

Project-A > Script-3 --> #Includes Project-A-Includes-Scripts-File

--> Project-A-Includes-Scripts-File --> #Includes GenericScript-1 + #Includes GenericScript-2 + #Includes GenericScript-3 + #Includes GenericScript4 + #Includes DebugScript

 

So that way I don't need to put:

Project-A > Script-1 --> #Includes GenericScript-1 + #Includes GenericScript-2 + #Includes GenericScript-3 + #Includes GenericScript4 + #Includes DebugScript

Project-A > Script-2 --> #Includes GenericScript-1 + #Includes GenericScript-2 + #Includes GenericScript-3 + #Includes GenericScript4 + #Includes DebugScript

Project-A > Script-3 --> #Includes GenericScript-1 + #Includes GenericScript-2 +#Includes GenericScript-3 + #Includes GenericScript4 + #Includes DebugScript

 

If this is possible, is it possible to use "#define debug" in Script-1, Script-2, or Script-3 so I can debug each script individually? Or set "#define debug" in the "Project-A-Includes-Scripts-File" so I can debug everything (or #undef something)?

 

Thank you in advance for your help! :)

LSL-PREPROCESSOR-PROBLEM.png

Link to comment
Share on other sites

2 hours ago, Lele Zanzibar said:

Also, is there a guide on including within include files?

Works fine. The standard C/C++ preprocessor trick for avoiding double includes works, too.

Example: In file myinclude.lsl:

#ifndef MYINCLUDELSL				// only if not already included
#define MYINCLUDELSL			// tells preprocessor this file has been included
/// content goes here
#endif // MYINCLUDELSL          // last line of file. Comment optional.

This will not expand a second time, if included more than once.

Edited by animats
Link to comment
Share on other sites

2 hours ago, Restless Swords said:

and yes, i assume they cannot edit and recompile in other viewers

You can edit and recompile in other viewers. Since the original script is in the comment it's even possible to find out how things work.
I wouldn't waste my time with bad readable scripts though if there is more to do than a tiny change.

Link to comment
Share on other sites

9 hours ago, Restless Swords said:

QUESTION: If i write a script using firestorm preprocessor then will that script still EXECUTE correctly for folks using another viewer?

- and yes, i assume they cannot edit and recompile in other viewers

The script will execute correctly / exactly the same for everybody regardless of anything because scripts aren't executed by the viewer. The region runs the scripts, viewers can only observe their effects on the world.

There is only an inconvenience while editing someone else's script. If I write a script with even one include-file and you try to recompile it with the Preprocessor, you won't be able to, because you don't have that include-file. You would have to edit the processed script.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1442 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...