I have a question about disabling exits. I want to make it unavailable to get to a certain room at some point in the game. I can do this one exit at a time, but I wanted something more general.
The following code almost works–except MYDIR is identified differently.
[code]“avalanche” by Andrew
room 1 is a room. “Exits in diagonals”
room 2 is northwest of room 1. “This room is a trap”
room 3 is northeast of room 1.
room 4 is southwest of room 1.
room 5 is southeast of room 1.
when play begins:
say “An unfair avalanche strikes!”;
repeat with X running through rooms:
repeat with MYDIR running through directions:
if the room MYDIR from X is room 1:
now nowhere is mapped MYDIR of X; [if I change to southeast it compiles but doesn’t work]
Other things like “now the room MYDIR of X is nowhere” don’t work either.
Any suggestions as to how to keep the code clean and neat and still work this? Thanks!
Yeah, 6.14 lets you look at the map, but it doesn’t let you change it. I actually found this example by going through the “Maps” section of the Recipe Book – first time I’d ever really used the RB, which I understand can be hard to find things in sometimes, but it was nice that it worked this time.
I was able to at first–and I used it in other parts of the code, so I assumed it worked everywhere.
I’ve never used it, but I like it, since it gives a different way to sort through things than just searching and hoping. It takes some getting used to, though.
At any rate, I really like the “change the X exit to” a lot better. It looks much cleaner and more like real English than what I was trying.
While this example’s probably a one-off coding thing (I agree with the recipe book that we don’t want to do this sort of thing too often,) I got some practice not just relying on the documentation. I’d sort of assumed the documentation was “it” and even ignored the difference between WI and RB in the examples. It was pretty hit and miss. The main frustration I have with all this is that I’ll have 10 questions that should be easily answerable–and 9 are, and the one that isn’t usually could have been easy if only I’d looked at it right.