Overriding_settings - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
LateralGM has several settings/preferences which can be changed, but currently it lacks a settings panel to do this. Prior to r473 (wayyyy back when LGM still used SVN Revisions) the only way to change these settings was by #Changing the settings inside the Jar. Although this didn't require a rebuild, it still required modification of the JAR, which meant that if you ever replaced the JAR (e.g. fetched a newer version/revision of LGM), your settings would be undone. Now, with most non-anceint LGM installs (as of r473), you can override these settings with Java Preferences. This page enumerates the many ways that you can achieve this.
Before changing settings, please ensure that no instances of LGM are currently running (e.g. Close LGM). This not only ensures that your modifications don't screw up the current running instance, but primarily it ensures that your changes aren't reverted by the running instance of LGM.
Determine which settings you wish to override and what value you would like to override it with. If you aren't completely sure, see the #Settings List.
Once you know your property name and value, the next step is to inject that into Java Preferences. You can do this by choosing any one of the methods below. Notice that none of the methods require a compile/rebuild of LGM, but some of the methods require that you have the JDK installed. If you do not have the JDK, consider one of the other methods.
Also worth noting, Linux users suffer from a Java bug (7035369) where Desktop.edit is not implemented, meaning that they will get an error whenever they try to use the default external editors for resources like sprites and sounds. Because of this, it would be useful to override the defaults with editors of your choosing, at least as a long-term temporary solution until Java gets its act together.
- Open LGM.jar like a zip file (e.g. with a half-decent archive manager)
- Browse to org/lateralgm/main/preferences.properties
- Open preferences.properties with a text editor of your choosing.
Each property will be a `name: value` pair, and #comments have a hash sign (#) before them to explain what each setting is and how to format your values.
For an example of the contents of preferences.properties, see #Settings List
Disclaimer: This is provided for convenience, but it's preferred that you use the standard #Java approach.
This method requires that you have JDK installed.
echo 'import java.util.prefs.Preferences; public class Inject{ public static void main(String[] args) {Preferences.userRoot().node("/org/lateralgm").put("settingName","new value");}}' > Inject.java
javac Inject.java
java Inject
rm -f Test.java Test.class
Watch out for wordwrapping. The first line is one line. Copy into a text editor, replace settingName and new value with your desired setting and value, and then copy into a terminal.
This method requires that you have the JDK installed.
import java.util.prefs.Preferences;
public class Inject { public static void main() {
Preferences.userRoot().node("/org/lateralgm").put("NEWKEY","My New Value"); System.out.println("Done.");
}}
Change NEWKEY with the property name, and My New Value with the new property value. Name the file "Inject.java". Compile and run it:
javac Inject.java
java Inject
If all goes well, the only thing you should see output is "Done." (if you run from command line). LGM should pick it up on next run.
These methods do not require the JDK to be installed.
gedit ~/.java/.userPrefs/org/lateralgm/prefs.xml &
Note that .java and .userPrefs are hidden directories, so you won't see them by default in the file browser. The file should look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<map MAP_XML_VERSION="1.0">
<entry key="KEY1" value="value1"/>
<entry key="KEY2" value="value2"/>
...
</map>
So it will be a simple matter of adding a new line before the , which reads as follows:
<entry key="NEWKEY" value="My New Value"/>
Change NEWKEY with the property name, and My New Value with the new property value. Save the file, and close it. LGM should pick it up on next run.
Since I don't use Windows, I don't know the specifics of how this works, but you should be able to figure it out. The starting point would be to open the Registry Editor, and locate: HKCU\Software\Javasoft\Prefs\org\lateralgm and presumably you'd just add your Key/Value pair.
Browse to ~/Library/Preferences/org/lateralgm and figure it out from there. The Linux method might provide some insights.
If anybody can provide more information for these methods, by all means, go ahead.
This is duplicated from inside the LGM jar as of LateralGM r487.
org/lateralgm/main/preferences.properties
#Allow Root Nodes in the resource tree to be renamed (e.g. Sprites and Backgrounds)
renamableRoots = false
#Only permit resources to be placed in a tree folder of their kind (e.g. sprites in Sprites folder)
groupKind = true
#Groups in the resource tree under Sprites will display the icon of their first sprite
iconizeGroup = false
#Default prefixes for newly created resources, followed by their number, e.g. "spr_" => "spr_8"
# ?,object,sprite,sound,room,?,background,script,path,font,?,?,timeline
prefixes = OBJECT>obj_ SPRITE>spr_ SOUND>snd_ ROOM>rm_ \
BACKGROUND>bkg_ SCRIPT>scr_ PATH>path_ FONT>font_ \
TIMELINE>time_
#Settings for the GML Code Editor
codeFontName = Monospaced
codeFontSize = 12
tabSize = 4
#Library settings
defaultLibraryPath = org/lateralgm/resources/library/lib/
userLibraryPath = ./lib
#D&D Actions in objects show a tooltip of their settings. Set these to 0 to disable.
actionToolTipColumns = 30
actionToolTipLines = 10
#External Resource Editors (include %s for the filename)
#Specify "null" to use the editor provided with LGM (if available)
externalBackgroundEditorCommand = gimp %s
externalSpriteEditorCommand = gimp %s
#externalScriptEditorCommand = gedit %s
externalScriptEditorCommand = null
externalSoundEditorCommand = null