Tips and Tricks

Here you'll find important modding tips and tricks to help you on your modding endeavors. This page is unfinished, so there's not much information in it as of now, but modders will update the page often (did I say often?) about techniques and jank.

getequipmentlist in generators

As discovered by codyfun123.

Want to access getequipmentlist in generators? It's a function reserved for combat scripts, but that won't stop you. Creating new instances of classes is always permitted, so just create an enemy and a skill that stores the results of getequipmentlist somewhere, then have the enemy execute the skill. The most obvious place to store this is the fighter's “innate” array, which accepts only strings.

var skill = new elements.Skill("Against all odds_old");
skill.script = "self.innate = getequipmentlist(null);";
//when a fighter uses this skill, their innate field will be
//overwritten with equipment names from getequipmentlist
var dummy = new elements.Fighter("Robobot");
skill.execute(dummy,dummy);
var allitems = dummy.innate;

For more info on creating things, and making dummies execute scripts, see Doing Things the Hard Way#Creating objects from template.

DTTHW

General page about janky internal stuff the base game equipment/rule/item scripts never touch: Doing Things the Hard Way. Includes actuators, modifying map nodes, and more.

Jinx syntax

jinx(
	name,
	effect description starting in lowercase,
	effect description starting in uppercase,
	script when activated,
	target,
	user,
	turn count,
	%VAR% value
);

Note that tabs and newlines here are purely for readability, and scripts in a spreadsheet should never use newlines. Jinxes themselves are one of the less complicated features in Dicey Dungeons.

Further control over jinxes

Consider the following jinx for a hypothetical equipment “Rattlesnake Oil”, whose function is to heal and poison you by the inserted dice in 2 turns. (This makes no sense as an actual equipment.)

jinx(
	"Rattlesnake Oil",
	"heal [heal]%VAR%[;] gain [poison]%VAR% poison",
	"Heal [heal]%VAR%[;] gain [poison]%VAR% poison",
	"
		inflict(\"poison\",%VAR%);
		attack(-%VAR%);
		sfx(\"_heal\");
		sfx(\"_poison\");
	",
	self,
	self,
	2,
	d
);

Quite manageable. but say you want the upgrade to Rattlesnake Oil to have one dice slot determining how much you poison yourself, and one slot determining how much you heal yourself. How? %VAR% is only one variable! (Yes, you could make %VAR% a two-digit number and have the script manually break it down, but hold on.)

The trick is that you can manually substitute values into the script and description strings, so %VAR% isn't actually necessary in any context except for convenience.

jinx(
	"Rattlesnake Oil+",
	"heal [heal]" + actualdice[0].basevalue + "[;] gain [poison]" + actualdice[1].basevalue + " poison",
	"Heal [heal]" + actualdice[0].basevalue + "[;] gain [poison]" + actualdice[1].basevalue + " poison",
	"
		inflict(\"poison\"," + actualdice[1].basevalue + ");
		attack(-" + actualdice[0].basevalue + ");
		sfx(\"_heal\");
		sfx(\"_poison\");
	",
	self,
	self,
	2,
	d
);

The non-backslashed double quotes in the above script mark interruptions in the string to substitute external values.

What do those darn dollar $ign$ in Jester powercard scripts mean?

It means the script within is run as soon as the button is clicked, before the card is counted by the game as out of the deck - before “before execute”. If the Inventor powercard did not have dollar signs surrounding its script, the game would freak out when the script is run because the card is no longer in the deck and its position compared to other cards is unknown. The reason it looks like the script is being executed when the card actually leaves the screen is because replacemewith and the card-replacing Deck functions will wait to replace it until the card is done animating.

Unfortunately, this only works with powercards (cards with a button on them). If you want a non-powercard to do something like this, put your script in the “before execute” column, and if you need the card's position relative to other cards in the deck, check self.equipment.

How, may I ask, do I add commas to, for example, equipment names, or gadgets?

| and [;] both mess things up because they are always rendered as a literal comma, so trying to give yourself an equipment named “Awesome[;] Incredible Sword” will instead give you an equipment named “Awesome” and an equipment named “ Incredible Sword” (and crash if either equipments do not exist). The special symbol [comma] was introduced for this purpose, and should be used wherever you want a comma in equipment/gadget names, e.g. “Awesome[comma] Incredible Sword”.

How do I know whose turn it is?

getactivefighter(). Returns an actual fighter, not a fighter's name. If you want to check if it's the player's turn, check that self == getactivefighter().

If you look at some older mods they do self.dicepool.length > 0 to determine if it's your turn, which probably isn't right.


User Tools