Find closest room with user attribute / env-ID / character?

Share your scripts and packages with other Mudlet users.
Post Reply
Smurf
Posts: 9
Joined: Sat Jul 18, 2020 1:16 pm

Find closest room with user attribute / env-ID / character?

Post by Smurf »

Question: "my" mud has banks. I want to write a function that speed-walks me to the closest bank. Is there a built-in way to do that? (I'm quite flexible in how to designate that a room is a bank.) Alternately does anybody know of a breadth-first room search function I could adapt?

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Find closest room with user attribute / env-ID / character?

Post by demonnic »

I believe I saw you ask this on Discord, and gave an answer there, but I'll repeat it here in case that was someone else:

it's certainly possible, you just have to track which items are banks. you can set roomUserData() on the room to hold the information, but it'll be easier to store the information in a table and save that table using table.save() and table.load()

I'll also add that the IRE mapper has the ability to set 'features' on a room, and provides for a way to walk to the closest room with a given feature, so you may be able to look at their code for inspiration.

Post Reply