Skip to content

Instantly share code, notes, and snippets.

View MattMcFarland's full-sized avatar

Matt McFarland MattMcFarland

  • Software Engineer
  • Dayton, OH
View GitHub Profile
@MattMcFarland
MattMcFarland / xml
Last active December 30, 2023 08:28
RimGPT Personas
<personas>
<li>
<name>Simon</name>
<azureVoice>en-US-DavisNeural</azureVoice>
<azureVoiceStyleDegree>0.3</azureVoiceStyleDegree>
<speechRate>0.07</speechRate>
<speechPitch>-0.01</speechPitch>
<phrasesLimit>100</phrasesLimit>
<phraseBatchSize>100</phraseBatchSize>
<phraseDelayMin>1200</phraseDelayMin>

Adding a new ware

Please consider every mentioning of {WARE_ID} to be replaced of what ware we want to add, and it must be lowercase to ensure compatibility across systems. Generally, we will be prefixing every ware we add with something unqiue to avoid any collision issues with other mods. This is mentioned as {PREFIX}

UPDATE: you can simplify this process by automating majority of the work using this tool.

Create new assets

To add a ware and the production of the ware to the game, the following files need to be created from scratch:

@MattMcFarland
MattMcFarland / readme.md
Last active August 1, 2023 10:11
Run X4 Foundations in debug mode with timestamped file names so you don't lose them.

Run X4 Foundations in debug mode.

The handy script below (x4-debug.bat) can be used as a shortcut to start x4 in debug mode. You get:

  • All debug messages turned on
  • All debug logs sent to a timestamped file, so you dont lose anything

Setup

Copy paste the code in the file below, then update the value for X4_EXE_PATH - change it to wherever X4.exe is located.

@MattMcFarland
MattMcFarland / Create a tree with path string.js
Created June 30, 2017 20:55
Create a tree with path string created by MattMcFarland - https://repl.it/JC8r/22
const pathString = 'one/two/three';
function buildTree(pathString) {
const pathArray = pathString.split('/')
let pathList = {}
for (var i = pathArray.length - 1; i >= 0; i--) {
let newObj = Object.assign({}, pathList);
pathList = {
[pathArray[i]]: newObj
@MattMcFarland
MattMcFarland / random-dungeon.lua
Created April 21, 2017 20:53
pico8 - random dungeon
-- Copyright(c) Matt McFarland - 2017
-- MIT LICENSE
-- This will create rooms using the BSP method
rooms = {}
function _init()
local main_container = container(0, 6, 127, 121)
local max_depth = 6
local container_tree = split_container(main_container, max_depth)
@MattMcFarland
MattMcFarland / Grid.js
Created April 14, 2017 03:12
A 2d grid library (with unit tests)
const assert = require('assert')
const transpose = (array) => array.reduce((p, n) => n.map((item, i) => [...(p[i] || []), n[i]]), [])
/**
* @class Grid
*/
class Grid {
/**
* @static transpose
* @param grid - grid to transpose
@MattMcFarland
MattMcFarland / test.lua
Created April 5, 2017 11:17
functional pico8
function _init()
my_grid = make_grid(10,10)
.map(set_wall)
my_grid.each(log)
room = my_grid
.select(4, 4, 7, 7)
.map(set_blank)
@MattMcFarland
MattMcFarland / js verify with chance.js
Created March 15, 2017 00:14
js verify with chance
const jsc = require('jsverify')
const Chance = require('chance')
const chance = new Chance()
chance.mixin({
user: () => ({
first: chance.first(),
last: chance.last(),
email: chance.email()
})
})
@MattMcFarland
MattMcFarland / jsverify with random user.js
Created March 15, 2017 00:12
jsverify with random user
const emailGenerator = jsc.asciinestring.generator.map(str => `${str}@example.com`)
const arbUser = jsc.record({
first: jsc.asciinestring,
last: jsc.asciinestring,
email: jsc.bless({ generator: emailGenerator })
})
// lets test our user here:
const checkOptions = {
rngState: '074e9b5f037a8c21d6',
tests: 2
}
// lets test our user here:
jsc.check(jsc.forall(jsc.integer, arbUser, (a, user) => {
console.log({a, user})
return true
}), checkOptions)