SphereCommunity
Functions Calling? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Functions Calling? (/Thread-Functions-Calling)



Functions Calling? - Baeguth - 08-11-2017 06:44 PM

Hello!

I've created a bunch of functions inside a script file called functions.scp.
I would like to USE and actually call those functions from other script files (such as combatsystem.scp).

I've noticed however that I can't by normally typing the function name.
What should i do?
Is there a way or do i have to write the function i need inside the same script?
Thank you


RE: Functions Calling? - darksun84 - 08-11-2017 07:02 PM

Function can be called in any script files but take notice about two things:

If the function.scp is in a sub folder of the scripts folder you have to add the sub folder path (example: scripts/yourfolder) in the sphere_tables.scp (order is important), then restart the server.

If you created function.scp in the scripts folder ( not a subfolder of it) while the server is running, you have to load the script file manually by using load function.scp in the server console (or restart the server).


RE: Functions Calling? - Baeguth - 08-11-2017 07:03 PM

(08-11-2017 07:02 PM)darksun84 Wrote:  Function can be called in any script files but take notice about two things:

If the function.scp is in a sub folder of the scripts folder you have to add the sub folder path (example: scripts/yourfolder) in the sphere_tables.scp (order is important), then restart the server.

If you created function.scp in the scripts folder ( not a subfolder of it) while the server is running, you have to load the script file manually by using load function.scp in the server console (or restart the server).

Thank you so much for the explaination Smile