Custom Arguments
Custom arguments let you bundle a condition and a set of effects into a reusable effect argument, so you can share common logic between effects. They are handy for richer messages or adding sounds to make actions more immersive. Each custom argument is a config file, and you call it with a custom_ prefix. This page covers creating one, naming it, its structure, and how to use it.
Quick start
Open the
/plugins/libreforge/arguments/folder.Copy
_example.ymland rename it, e.g.named_mana.yml. The file name (without.yml) is the argument's ID.Set the
is-metconditions and theif-met/if-not-meteffects.Run
/libreforge reload.Add
custom_named_mana:to an effect'sargs, then trigger that effect and confirm the argument's effects run.
Naming and IDs
The file name without .yml is the argument's ID. A file named named_mana.yml has the ID named_mana, which you call as custom_named_mana inside an effect's args.
The structure of a custom argument
| Part | What it controls |
|---|---|
| is-met | The conditions that decide which effects run |
| if-met / if-not-met | The effects to run for each outcome |
| Using the argument | How you call it from an effect |
# === is-met: the conditions to check ===
is-met:
- id: above_magic
args:
type: mana
amount: "%amount%" # %amount% comes from where the argument is called
# === if-met / if-not-met: the effects for each outcome ===
if-met: # Runs when is-met passes
- id: give_magic
args:
type: mana
amount: "- %amount%"
- id: send_message
args:
message: "-%amount% %ecoskills_mana_name% &f(%reason%)" # %reason% also comes from the call
if-not-met: [ ] # Runs when is-met fails; leave empty for nothing
is-met
The conditions that decide whether the argument's if-met or if-not-met effects run. These are configured exactly like any other conditions.
is-met:
- id: above_magic
args:
type: mana
amount: "%amount%" # Values passed in at the call site are available as placeholders
if-met / if-not-met
The effects to run depending on the outcome of is-met. Leave if-not-met as [ ] to do nothing when the condition fails.
if-met: # Effects to run when the condition is met
- id: give_magic
args:
type: mana
amount: "- %amount%"
if-not-met: [ ] # Effects to run when the condition is not met
Using the argument
Call a custom argument like a normal argument, but with a custom_ prefix. Any keys you nest under it become placeholders (%amount%, %reason%, etc.) inside the argument's conditions and effects.
args:
custom_named_mana: # Calls arguments/named_mana.yml
amount: 10 # Available as %amount% inside the argument
reason: Instant Transmission # Available as %reason% inside the argument
Where to go next
Effects: Configuring an Effect for the conditions and effects inside an argument.
Chains: Configuring an Effect Chain for another way to reuse complex logic.
Placeholders: Custom Placeholders to share values across configs.