Page 1 of 1

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

Posted: Sat Jul 18, 2020 1:20 pm
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?

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

Posted: Sat Jul 18, 2020 2:59 pm
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.