|
Kariyana Beginner
Joined: 02 Feb 2004 Posts: 10 Location: Canada
|
Posted: Mon Feb 02, 2004 12:54 am
Scripts with Direction Variables and Looping |
Hi all,
This is my first time posting, and I'll try to explain my problem as best as I can without much confusion.
I play on a MUD where you can mine for items like ore, precious gems, etc. I would like to set up a script to where I can mine in all four cardinal directions (plus up and down) and then move into another room after I've mined out all possible directions.
For instance, I am standing in a room with no exits, meaning I can mine in all six directions. I mine to the north until the wall has been stripped clean, then I would like to change my mining direction to the west (like going in a circle, then up or down as I see fit). When the wall has been cleared out, I receive a certain message. I would like to trigger the change in direction off that message.
I have set up all six directions under different variables (dir0 - dir5). I also have the message "That direction has been completely stripped clean." as the trigger to change the mining direction. But when I set it up, it constantly loops because if more than one direction is mined out, I receive the same message.
So I guess what I would like to know is how I can set up the script to where if north is mined out, it moves west. And then if west is mined out, it moves south. And so on. I have the following set up so far:
#IF {@dir0} {That direction has been completely stripped clean.}
mine @dir1
#IF {@dir1} {That direction has been completely stripped clean.}
mine @dir2
and it goes the same way until mine @dir5 is the last line.
Any help would be appreciative of this :)
P.S. After all six directions are mined out, I would like it to move a certain direction out of that room. I'm not sure how to do this either. Would it have to be a manual move, or can I send a message to the MUD to trigger off of that? Thanks :) |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Feb 02, 2004 5:46 am |
There are many methods. Here's one way which uses a list variable and a numerical variable.
#VAR mines {north|west|south|east|up|down}
#VAR mining 0
#TR {That direction has been completely stripped clean.} {#IF (@mining < 6) {#ADD mining 1;mine %item( @mines, @mining)} {#VAR mining 0;#SAY insert command to leave room here}} |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|