 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Sun Feb 19, 2006 5:25 am
Creating a #LOOP alias thing |
Ok, so, I want to have an alias for my MUD so that I can type 'sp (direction)' and the MUD will execute that direction repeatedly until I get the message 'You can't go that way.' or the message 'There is a door in your way and it is shut!'. So far I've got an alias for 'sp' that sends #LOOP 2000 {%1}
I have it set to 2000 because the MUD picks up commands slowly and I only actually move around 5 rooms with that high of a number... But I want the #LOOP to stop if I get one of the above stopping messages, and can't figure out how to do it.
Could someone either show me how to stop the #LOOP, or how to set it up to where it simply repeats the direction until it gets one of the stop messages?
Help is muchly appreciated, this is driving me batty... |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Feb 19, 2006 5:56 am |
Use two or more triggers:
1)trigger on a message indicating successful movement. When it fires, it will send the next direction.
2)trigger on a stringlist of stop messages ({item1|item2|etc}). When this trigger fires, it does the stuff you need to do, and after that sends the next direction.
No need to use #LOOP in this example. |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Sun Feb 19, 2006 6:03 am |
I don't have any messages indicating a succesful movement to a new room. There is my prompt, it shows after the description of the room, but my prompt shows after every command I enter, so that'd be excessive. And I don't want to always move as far in a direction as possible, only when going on a long stretch, that's why I had the alias set up, so I could choose when to go long distances.
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Feb 19, 2006 3:40 pm |
Please copy and paste an example of you walking through 3 rooms. That should give us enough to figure it out.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Sun Feb 19, 2006 4:30 pm |
Alright, here's what walking looks like:
s
Forestal Stone Road
This wide stone road leads in a straight line north and south, with a junction
a short distance to the north, and the walls of a city in evidence to the
south. You can hear running water nearby, but the trees obscure your vision
and prevent you from seeing the source.
Obvious exits: north south east west
A diamond, an amethyst
1850 1041 >s
Forestal Stone Road
You are on a well travelled, wide road leading in a line from north to south.
Northwards, a junction is visible, and southwards you can see the gates of
Tylorus, and behind them the Great Oak climbing into the sky above the city.
The edges of the road are covered with banks of wild flowers.
Obvious exits: north south east west
1850 1041 >s
Road Approaching Tylorus
This road seems extremely well maintained, though with the close proximity of
the Elven city Tylorus to the south, this is unsurprising. The road also
continues to the north, and is lined with beds full of wild flowers.
Obvious exits: north south east west southeast
The Elysium Games Arena, a small iron key, a small iron key
1850 1041 >
I don't usually have command echo on though, so it looks like this (I showed with echo so you'd know which direction I was going):
Forestal Stone Road
This wide stone road leads in a straight line north and south, with a junction
a short distance to the north, and the walls of a city in evidence to the
south. You can hear running water nearby, but the trees obscure your vision
and prevent you from seeing the source.
Obvious exits: north south east west
A diamond, an amethyst
1850 1041 >Forestal Stone Road
You are on a well travelled, wide road leading in a line from north to south.
Northwards, a junction is visible, and southwards you can see the gates of
Tylorus, and behind them the Great Oak climbing into the sky above the city.
The edges of the road are covered with banks of wild flowers.
Obvious exits: north south east west
1850 1041 >Road Approaching Tylorus
This road seems extremely well maintained, though with the close proximity of
the Elven city Tylorus to the south, this is unsurprising. The road also
continues to the north, and is lined with beds full of wild flowers.
Obvious exits: north south east west southeast
The Elysium Games Arena, a small iron key, a small iron key
1850 1041 > |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Feb 19, 2006 7:25 pm |
#CLASS SpeedRunner
#VARIABLE Direction {} {}
#ALIAS sp {#IF (%numparam=0) {#SHOW "Usage:sp ~<direction~>"} {Direction="%-1";#T+ SPtrig;#EXECUTE {@Direction}}}
#TRIGGER "SPtrig" {^{Obvious exits:|You can't go that way.|There is a door in your way and it is shut!}} {#IF (%begins(%line,"Obvious")) {#EXECUTE Direction} {#T- SPtrig}}
#CLASS 0 |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Sun Feb 19, 2006 8:51 pm |
Ok, I put that into the MUD, and it made the trigger and alias and such, but whenever I use 'sp n' or whatever direction, I just move once in that direction. Did I put it in wrong? Or is the MUD not taking up things fast enough?
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Feb 19, 2006 10:02 pm |
I am missing an at in this section '%line,"Obvious")) {#EXECUTE Direction} {#T- SPtrig}}'
Correction is '%line,"Obvious")) {#EXECUTE @Direction} {#T- SPtrig}}'
If there really is a problem with speed and the mud dropping commands then another method can be employed:
#DELCLASS SpeedRunner
#CLASS SpeedRunner
#VARIABLE Direction {} {}
#ALIAS sp {#IF (%numparam=0) {#SHOW "Usage:sp ~<direction~>"} {Direction="%-1";#T+ SPtrig;#EXECUTE {@Direction}}}
#ALARM "SPtrig" {*.6} {#EXECUTE {@Direction}} "" {disable}
#TRIGGER {^{You can't go that way.|There is a door in your way and it is shut!}} {#T- SPtrig}
#CLASS 0 |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Mon Feb 20, 2006 12:16 am |
I think maybe it's just not attainable in the MUD I play. I tried re-entering your first script with the @ sign in place and I still only moved one room. The second one created an incessant string of 'You can't go that way.'... Thanks for all the help, I'm pretty prepared to give up though. Isn't worth the headache I think
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 20, 2006 6:27 am |
Try this.
#variable direction {}
#variable StopMessages {You can't go that way|There is a door in your way and it is shut!}
#trigger {Obvious exits: *@direction*} {@direction}
#trigger {({@stopmessages})} {#case %ismember("%1", @stopmessages) {#noop whatever you want to do} {#noop whatever you want to do}}
#alias sp {direction = %1;%1} |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Mon Feb 20, 2006 2:42 pm |
Sweet, it worked! Thank you!
----------------
Ack, the thing stops moving if I hit a door or a nonexistant exit, but then if I move a different direction and that exit is available in that room, I'm forced that way.
For example, I sprint east, stop because 'You cannot go that way." I then go north, and am forced east from the new room... What am I supposed to put for those #noop things? |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 20, 2006 10:50 pm |
For the first one, what do you want to do when you get "You cannot go that way"? Do you want it to stop and wait for another SP alias? Do you want it to pick another direction to travel in (and if so, do it randomly or based on some predetermined path?)
For the second one, I have no idea what you want to do when you hit a door either. Wanna open it and continue in the same direction if possible? Wanna go in a different direction?
You never said, so I left it up to you to figure out. To make it stop, you can include Direction = "". That will not prevent the trigger from firing, but now it's literally going to do nothing until you again use SP. |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Tue Feb 21, 2006 4:23 am |
I put in
#variable direction {}
#variable StopMessages {You can't go that way|There is a door in your way and it is shut!}
#trigger {Obvious exits: *@direction*} {@direction}
#trigger {({@stopmessages})} {#case %ismember("%1", @stopmessages) {#noop direction = ""} {#noop direction = ""}}
#alias sp {direction = %1;%1}
And I still get an incessant sprint, if I sprint north, then hit a door, then go south, I instantly go north and then hit the door again. For some reason the trigger isn't stopping... I want it to just stop moving when I hit a door or a "You can't go that way." so I can either sprint a different direction or move only once in a direction manually, or just sit in that room.
Also, if the sun is down in the MUD I just get 'It is dark.' when I enter a room. To factor that into the trigger would I just change it to #trigger {It is dark.|Obvious exits: *@direction*} {@direction} ? |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 21, 2006 4:46 am |
#noop direction = ""
I suppose I should have been a little clearer, but you had to replace the whole line. Thus:
#NOOP whatever you want to do
becomes:
Direction = "" |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Sir_Jaisen Newbie
Joined: 19 Feb 2006 Posts: 8
|
Posted: Tue Feb 21, 2006 9:55 pm |
#class Sprint
#variable direction {}
#variable StopMessages {You can't go that way|There is a door in your way and it is shut!}
#trigger {Obvious exits: *@direction*} {@direction}
#trigger {({@stopmessages})} {#case %ismember("%1", @stopmessages) {direction = ""} {direction = ""}}
#alias sp {direction = %1;%1}
#class 0
I put in the above and still keep getting the weird stopping I've mentioned... Am I still putting it in wrong? (Sorry, I'm really new at all this coding stuff) |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 21, 2006 10:13 pm |
There's nothing wrong with the code, so my guess is that you have extra variables or triggers that are interfering with the script. If you see extras, delete them and everything should start behaving normally.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
|
|