Page 1 of 1

Embebed and External Scripts

Posted: Tue Feb 24, 2015 7:11 am
by Eleven Warrior
Hi and to minmay.

Ok I have been trying to read up on Embedded and External Scripts. I want to know:

(a) What is the difference between the two eg: I know with External scripts they are not in the editor like normal Embedded scripts are.
(b) Do you really need External scripts and why they are good?
(c) I fins that external scripts you have to write them outside the editor which can be a pain because you have to minimize the editor window and have note pad or similar text editor running. So I don't really understand why the 2 Scripting ideas???????

Can someone please fill me in as I don't have a clue as usual :oops:

Re: Embebed and External Scripts

Posted: Tue Feb 24, 2015 7:45 am
by minmay
(a) Embedded script entity source is embedded in the dungeon.lua file; each ScriptComponent's source is a string. External scripts are read from a file in the mod's assets when it is loaded.
(b) External scripts are not necessary, but they are very convenient because they are much easier to edit outside the Grimrock editor compared to embedded scripts. In addition, you can compile your external scripts with LuaJIT and the game will still run them, which could be very useful for performance-sensitive code.
(c) If you are familiar with a full-featured text editor, writing and editing long scripts is MUCH faster outside of the editor. The Grimrock editor doesn't have find/replace or tools like grep, sed and awk. (In Grimrock 1 I actually sometimes edited script entity source in dungeon.lua instead of through the editor, despite the inconveniences of needing an escape character every few seconds).

Re: Embebed and External Scripts

Posted: Tue Feb 24, 2015 11:38 am
by Eleven Warrior
Ahhh thxs minmay that makes perfect sense now, yeah your right it is easier to code outside of the editor. I have tried today and yeah the seach, copy and paste is a lot quicker usining the text editor(s) that I use. So thxs again for the info mate :)