Celestial Knights Banner

Commands Reference - CKMud Android Client

Terminal commands, advanced examples, and FAQ

Terminal Commands

Type these directly in the input box:

#var — List Variables

#var

Shows all variables (persistent in cyan, temporary in white) with their current values.

#msdp — List MSDP Values

#msdp #msdp POWERLEVEL // Show single value

Displays all MSDP values the server provides. Useful for finding variable names to use in scripts.

#msdp connect — Renegotiate MSDP

#msdp connect

If MSDP values stop updating, use this to resend MSDP negotiation to the server.

#msdp disconnect — Disable MSDP

#msdp disconnect

Turn off MSDP protocol (if causing issues with the server).

#help — Show Help

#help

Display all terminal commands and syntax help in-game.

#N Prefix — Repeat Command

#40 drink flask // Execute 40 times #1000 train str // Execute 1000 times #5 focus 'kenjutsu' // Execute 5 times

Repeat a command N times (1–1000 max). Useful for grinding, training, or bulk actions.

Complete Syntax Reference

Special Commands (in aliases, triggers, timers)

Syntax Description Example
#var {n} {v} Create/update variable #var {count} {10}
#math {n} {expr} Evaluate arithmetic #math {total} {50 + 25}
#note text Display text (not sent to server) #note Hello @msdp.ROOM_NAME
#if {cond} {cmd} Conditional execution #if {@health < 50} {heal}

Variable References

Syntax What It Is Example
@varname Session variable say @greeting
@msdp.KEY MSDP server value #note PL: @msdp.POWERLEVEL
%1, %2, %3 Regex capture groups #math {dmg} {%1}

Comparison Operators (#if)

Operator Meaning Example
< Less than #if {@pl < 500000}
> Greater than #if {@pl > 1000000}
<= Less than or equal #if {@pl <= 300000}
>= Greater than or equal #if {@pl >= 800000}
== Equal to #if {@combo == 0}
!= Not equal to #if {@combo != 0}

Math Operators (#math)

Operator Operation Example
+ Addition #math {sum} {10 + 5}
- Subtraction #math {diff} {10 - 5}
* Multiplication #math {prod} {10 * 5}
/ Division (integer) #math {quot} {10 / 5}

Regex Special Characters

Pattern Matches Example
\d+ One or more digits takes (\d+) damage
\w+ Word characters (letters, numbers, _) (\w+) has arrived
.* Any characters Boss: (.*)
(group) Capture group (→ %1, %2) (\w+) killed (\w+)
^ Start of line ^You arrive
$ End of line success.$

Advanced Examples

Example 1: Combat Damage Accumulator

Goal: Track total damage dealt and received during combat.

Setup: 1. Create two persistent variables: - total_dmg_dealt = 0 - total_dmg_received = 0 2. Create trigger (Damage Dealt): Pattern: You (\w+) (\w+) for (\d+) damage Use Regex: ON Commands: #math {total_dmg_dealt} {@total_dmg_dealt + %3}; #note [OUT] %3 damage (Total: @total_dmg_dealt) 3. Create trigger (Damage Received): Pattern: takes (\d+) damage Use Regex: ON Commands: #math {total_dmg_received} {@total_dmg_received + %1}; #note [IN] %1 damage (Total: @total_dmg_received) 4. Create alias to display: Name: combat_report Commands: #note ━━━━━━━━━━; #note Dealt: @total_dmg_dealt; #note Received: @total_dmg_received; #note ━━━━━━━━━━

Example 2: Smart Health Management

Goal: Auto-heal when health is low, escalate for critical.

1. Create trigger: Pattern: PL drops below Use Regex: OFF Commands: #if {@msdp.POWERLEVEL < 300000} {focus heal; #note CRITICAL HEAL}; #if {@msdp.POWERLEVEL < 600000} {focus heal; #note Healing} 2. Create timer (periodic check): Name: Health Monitor Interval: 15 Commands: #if {@msdp.POWERLEVEL < 500000} {focus regen} Result: Takes multiple healing approaches based on PL level

Example 3: Progress Tracker with Percentage

Goal: Track quest progress and show percentage completion.

Setup: 1. Create persistent variable: quest_kills = 0 2. Create trigger: Pattern: You slay (.+)! Use Regex: ON Commands: #math {quest_kills} {@quest_kills + 1}; #math {pct} {(@quest_kills * 100) / 50}; #note Quest: @quest_kills/50 kills (@pct%) 3. Create alias for reset: Name: quest_reset Commands: #var {quest_kills} {0}; #note Quest reset! Result: Every kill increments counter and shows percentage toward 50 kills

Example 4: Buff Rotation

Goal: Cast different buffs on rotation.

1. Create alias (single command, rotate manually via alias): Name: buff1 Commands: focus 'energy shield'; #note Buff cycle 1 2. Create timer (auto-buff every 60 seconds): Name: Auto Buff Cycle Interval: 60 Commands: focus 'energy shield'; focus 'barrier'; focus 'zanzoken'; #note Buffs reapplied Result: Timer keeps buffs fresh; alias adds tactical buffer on demand

Example 5: Conditional Spell Casting

Goal: Cast different spells based on opponent health.

1. Create alias: Name: attack Commands: #if {@msdp.OPPONENT_HEALTH > 75} {focus heavy; #note Heavy damage}; #if {@msdp.OPPONENT_HEALTH > 25} {focus medium}; #if {@msdp.OPPONENT_HEALTH <= 25} {focus finish; #note FINISHING BLOW} Result: Type "attack" and the spell changes based on opponent health %

Example 6: Mana/Resource Management

Goal: Track resource usage and warn when low.

Setup: 1. Create persistent variable: mana_used = 0 2. Create trigger (focus skill): Pattern: You focus (.+) using (\d+) ki Use Regex: ON Commands: #math {ki_used} {@ki_used + %2}; #if {@ki_used > 5000} {#note WARNING: High ki usage!} 3. Create alias to reset: Name: mana_reset Commands: #var {mana_used} {0}; #note Mana tracking reset Result: Tracks cumulative mana usage per session and warns on high usage

FAQ

Q: Can I use variables in regular commands?

A: Yes! Use @varname syntax in any alias or command. Variables are automatically substituted before sending to the server.

Q: What's the difference between #var and persistent variables?

A: #var creates temporary session variables (lost on restart). Persistent variables are created in Tools → Variables and saved with your character profile. Both are visible with #var command (cyan = persistent, white = temporary).

Q: How do I use regex captures in triggers?

A: Enable "Use Regex" on the trigger, then use regex groups: takes (\d+) damage captures the number as %1. Use in commands: #math {dmg} {%1}

Q: Can I use #if in the terminal?

A: No, #if only works in triggers, aliases, and timers. For terminal, create an alias with #if logic and type the alias name.

Q: What happens if I reference an undefined variable?

A: It defaults to empty string (""). In math operations, it's treated as 0.

Q: How do I see all available MSDP keys?

A: Type #msdp in terminal to list all MSDP values the server provides. Use @msdp.KEY syntax to reference them in scripts.

Q: Can I have multiple characters on the same MUD?

A: Yes! Each character at (host, port) is a separate session. Settings, scripts, and variables are per-character, so you can maintain different configurations for each character.

Q: How many aliases/triggers/timers can I create?

A: No hard limit enforced, but performance degrades with extremely large numbers (100+ triggers). Keep them reasonably organized and disable unused ones.

Q: Do triggers run on inactive sessions?

A: Yes. Triggers, timers, and MSDP updates run on background sessions too. Only the terminal rendering is skipped for inactive sessions (to save CPU).

Q: Can I have triggers that trigger other triggers?

A: Yes, it's possible for one trigger to execute a command that matches another trigger. Be careful to avoid infinite loops!

Q: What's the maximum repeat count?

A: #N is capped at 1000 (e.g., #1000 train str). Typing #1001 cmd will fail or cap at 1000.

Q: Can I backup my scripts?

A: Scripts are stored in SharedPreferences JSON per character. There's no built-in export yet, but you can manually recreate them on a new device or request a feature. Consider keeping a notepad document of your complex scripts.

Q: Do timers keep running when the app is backgrounded?

A: Yes, if you've enabled "Background Connection" in Settings. Timers continue executing on background sessions. If backgrounding is disabled, timers pause.

Q: How do I debug a trigger that isn't firing?

A: Check the pattern carefully. Test with #help to see if your syntax is correct. Try a simpler pattern first (e.g., plain text without regex). Ensure "Use Regex" toggle matches your pattern type.

Q: Can I use special characters in variable names?

A: Stick to letters, numbers, and underscores (e.g., my_var_1). Avoid spaces and special characters in variable names.

Q: What's the performance impact of running many triggers?

A: Triggers run on background threads so they don't block the UI. Performance depends on regex complexity and command count. Complex regex patterns on every line can add latency, so optimize regex patterns when possible.

Troubleshooting Tips

Trigger Not Firing

  • Check if pattern matches exactly (case-sensitive by default)
  • If using regex, verify regex is valid (test online at regex101.com)
  • Ensure "Use Regex" toggle matches your pattern type
  • Try a substring instead of full line match
  • Test with a simpler pattern first

Math Result Not What Expected

  • Remember: Results are integers. Division is integer: 9 / 2 = 4, not 4.5
  • Check variable spelling (@varname, not @var name)
  • Undefined variables default to 0 in math
  • Use parentheses for clarity: (@pl * 100) / @max

Variables Disappearing

  • #var created in terminal are temporary (lost on restart) → use Variables tab for persistence
  • Variables are per-session (each character has independent variables)
  • Check you're on the right session/character

MSDP Values Not Updating

  • Try #msdp connect to renegotiate
  • Check #msdp to see if key exists (server may not support that key)
  • Server may not report that value

Alias/Trigger Not Running

  • Check spelling of alias name (case-sensitive)
  • Try typing a test alias with just #note test to verify execution works
  • Check for syntax errors in commands