Skip to content

DRCC.get_crafting_item says it is stopping the script but returns nil instead #1551

Description

@simtel12

Summary

DRCC.get_crafting_item says it is stopping the script when a required item is missing, then returns nil and lets the caller carry on. The skip_exit parameter no longer skips an exit, because there is no longer an exit to skip.

Where

lib/dragonrealms/commons/common-crafting.rb:340-349 on main:

when GET_CRAFTING_NOT_FOUND_WHAT, GET_CRAFTING_NOT_FOUND_WERE
  pause 2
  return if DRCI.in_hands?(name)

  DRC.beep
  Lich::Messaging.msg('bold', "DRCC: You seem to be missing: #{name}")
  return nil if skip_exit

  Lich::Messaging.msg('bold', 'DRCC: Cannot continue crafting without required item. Stopping script.')
  return nil

Both branches return nil. skip_exit now only selects which message prints.

When it changed

git log -L on those lines points at 9bc7914, refactor(dr): Comprehensive DR modules refactor (#1231, 2026-02-26):

-          echo("You seem to be missing: #{name}")
-          exit unless skip_exit
+          Lich::Messaging.msg('bold', 'DRCC: Cannot continue crafting without required item. Stopping script.')
+          return nil

The exit unless skip_exit was replaced with return nil, and the "Stopping script" wording was added in the same commit. So the message has described behaviour the code does not have since that refactor.

What it looks like in play

;remedy on a character whose configured container is not reachable. The script announces that it is stopping, then keeps going with an empty hand:

[custom/remedy]>get my lapis bowl
What were you referring to?
>
[custom/remedy: BELL ]
DRCC: You seem to be missing: lapis bowl
DRCC: Cannot continue crafting without required item. Stopping script.
[custom/remedy]>tap my ojhenik from my haversack
You tap some crushed ojhenik inside your leather haversack.
>
[custom/remedy]>get my ojhenik from my haversack
You get some crushed ojhenik from inside your leather haversack.
>
[custom/remedy]>count my ojhenik
You count out 25 pieces of material there.
>
[custom/remedy]>combine my ojhenik
You must be holding both substances to combine them.  For more information, see HELP VERB COMBINE.
>
[custom/remedy]>put ojhenik in my lapis bowl
What were you referring to?

Every command after the beep is wasted, and the character ends up holding herbs with no container to put them in.

The [custom/remedy] prefix is my own copy of remedy.lic in scripts/custom/. The only line it changes is the one that picks the container out of alchemy_tools, which runs earlier and succeeded here — the container was listed, so it resolved to lapis bowl exactly as stock remedy.lic does. Everything from get my lapis bowl onward is stock behaviour, and the failure is in DRCC, not in the script.

Steps to reproduce

  1. Put a container in alchemy_tools that the character cannot reach with get my <name>.
  2. Run a remedy that uses that container, for example ;remedy remedies 2 "some eye wash" "blue flower" aevaes bar bowl wash.
  3. get my <container> fails, both DRCC messages print, and the script continues into the herb steps.

Scale

DRCC.get_crafting_item has 88 call sites on elanthia-online/dr-scripts main that use the default, and 4 that pass skip_exit. Every one of the 88 expects the script to stop, because that is what the message says and what the code did before the refactor. Anything that fetches a tool is affected, not only remedies.

Suggested fix

Make the code match the message and restore what skip_exit names:

exit unless skip_exit

That is a behaviour change for callers that currently limp on after a missing tool, so it is worth calling out in the release notes.

If the intent was in fact to keep going, then the message should say so instead, for example "continuing without it". I would rather it stopped: a crafting script that carries on with an empty hand produces the nonsense commands above, and the failure is harder to read than an outright halt.

I am happy to open the PR either way — say which behaviour you want.

Environment

  • lich-5 main at 4ed650b
  • Ruby 4.0.5
  • DragonRealms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions