User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
start [2020/04/28 18:23] – [More info on:] maximestart [2020/05/06 18:31] maxime
Line 9: Line 9:
   * ** [[changelog|Changelog]] **   * ** [[changelog|Changelog]] **
   * ** [[migration|Migration Notes]] **   * ** [[migration|Migration Notes]] **
-  * ** [[guides|Guides]] **+  * ** [[guides|Community Guides]] **
  
 ===== More info on: ===== ===== More info on: =====
   * [[data-types|Data types]]   * [[data-types|Data types]]
   * [[enumerations|Enumerations]]   * [[enumerations|Enumerations]]
 +  * [[example-mods|Example Mods]]
 +
 +  * [[mod-management-functions|Mod management functions]]
 +  * [[mod-io-functions|Mod IO functions]]
 +
 +  * [[dependencies|Mod Dependencies]]
   * [[components|Components and custom components]]   * [[components|Components and custom components]]
 +  * [[asset-override|Game asset override]]
 +  * [[building-asset-processor|Building asset processor]]
 +  * [[level-of-detail|Level Of Detail (LOD)]]
 +
   * [[workplaces|Create workplaces]]   * [[workplaces|Create workplaces]]
   * [[monuments|Create monuments and bridges]]   * [[monuments|Create monuments and bridges]]
   * [[walls|Create walls]]   * [[walls|Create walls]]
   * [[particle-effects|Create particle effects]]   * [[particle-effects|Create particle effects]]
-  * [[asset-override|Game asset override]] 
-  * [[building-asset-processor|Building asset processor]] 
-  * [[logs|Mod individual log file]] 
-  * [[mod-functions:io|IO functions]] 
-  * [[dependencies|Mod Dependencies]] 
-  * [[example-mods|Example Mods]] 
-  * [[level-of-detail|Level Of Detail (LOD)]] 
   * [[material-sets|Material sets]]   * [[material-sets|Material sets]]
  
Line 54: Line 57:
  
 In order to include another LUA file, you can call the ''dofile'' function on your mod: In order to include another LUA file, you can call the ''dofile'' function on your mod:
-<code lua>+<code lua somescript.lua>
 myMod:dofile("anotherscript.lua") myMod:dofile("anotherscript.lua")
 </code> </code>
  
 This will execute the script ''anotherscript.lua'' from your mod folder. This will also pass the mod variable ''myMod'' to the script. So you will be able to access ''myMod'' from ''anotherscript.lua'' this way: This will execute the script ''anotherscript.lua'' from your mod folder. This will also pass the mod variable ''myMod'' to the script. So you will be able to access ''myMod'' from ''anotherscript.lua'' this way:
-<file lua anotherscript.lua>+<code lua anotherscript.lua>
 local myMod = ... -- retrieve arguments passed to the script local myMod = ... -- retrieve arguments passed to the script
  
 -- do stuff with myMod -- do stuff with myMod
 -- ... -- ...
-</file>+</code>
  
 In addition, you can pass any number of variable to the called script: In addition, you can pass any number of variable to the called script:
-<code lua>+<code lua somescript.lua>
 myMod:dofile("anotherscript.lua", 42, "A Super String", { 1, 4, 12 }) myMod:dofile("anotherscript.lua", 42, "A Super String", { 1, 4, 12 })
 </code> </code>
  
-<file lua anotherscript.lua>+<code lua anotherscript.lua>
 local myMod, anInteger, aString, anArray = ... -- retrieve arguments passed to the script local myMod, anInteger, aString, anArray = ... -- retrieve arguments passed to the script
-</file>+</code>
  
 ===== Enabling / Disabling a mod ===== ===== Enabling / Disabling a mod =====
Line 82: Line 85:
 If you want to fully ignore a mod, you can either remove it from your mods folder, or rename the ''mod.lua'' file into something else (''mod_.lua'' for instance). If you want to fully ignore a mod, you can either remove it from your mods folder, or rename the ''mod.lua'' file into something else (''mod_.lua'' for instance).
 ===== Logging / Debugging ===== ===== Logging / Debugging =====
 +
 +==== Log ====
  
 You can log your own logs into foundation log file: You can log your own logs into foundation log file:
 +
 <code lua> <code lua>
-myMod:log("Hello World!"+myMod:log("Hello World!"-- creates an INFO log entry 
-myMod:logWarning("This is a warning!"+myMod:logWarning("This is a warning!"-- creates a WARNING log entry 
-myMod:logError("This is an error!")+myMod:logError("This is an error!"-- creates an ERROR log entry
 </code> </code>
  
-You can also open a blocking message box for debugging purpose:+In order to isolate mods related logs, Foundation will log most of mod related information in a specific log file located in ''Documents/Polymorph Games/Foundation/mod-%NAME%.log'' 
 + 
 +However, keep in mind that a mod can interact with the game in various indirect way, and some valuable information could still  be hidden in the global game log in ''Documents/Polymorph Games/Foundation/foundation.log''
 + 
 +==== Message box ==== 
 + 
 +You can also open a blocking message box for debugging purpose. This function is recommended for mod development only. 
 <code lua> <code lua>
 myMod:msgBox("Hello there!") myMod:msgBox("Hello there!")
 </code> </code>
 +
 +For this function to work, the user must manually set the field ''ModMsgBoxEnabled'' to ''true'' in the user settings file (''usersetting.config''). Otherwise, it will only create a new log entry, like the ''log'' function.
  
 ===== What is this generated_ids.lua file? =====  ===== What is this generated_ids.lua file? ===== 
start.txt · Last modified: 2022/03/30 10:53 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki