|
Foam Novice
Joined: 08 Nov 2000 Posts: 44 Location: Australia
|
Posted: Mon Sep 09, 2002 6:02 am
A trigger and alias question |
Hiyas
I cant seem to capture the directions that are listed in each room
eg.
Exits: north south northeast northwest
Of course there could be less exits or more sometimes, and there could be up or down also. What i'd like to do is capture all the possible exits when i enter a room, and move in one of the valid directions at random. I was planning to use a #case %random to do this, but i cant seem to capture the directions to begin with :)
My second question is... how can i expand alias's regardless of where they appear in a sentance.... to convert mudslang to the full words, eg You say ' I'm busy atm, brt in a tick' to be sent as I'm busy at the moment, be right there in a tick
Tnx for your time |
|
|
|
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Mon Sep 09, 2002 9:58 am |
You could use something like:
#TRIGGER {^Exits: (*)$} {#VAR CurrentExits %replace("%1", " ", "|");#EXEC %item(@CurrentExits,%random(1, %numitems(@CurrentExits)))}
As for your second question,
#ONINPUT {(%*)} {#EXEC {%replace(%replace("%1", "atm", "at the moment"), "brt", "be right there")}}
should work (untested). For large numbers of things to expand, this method can quickly become unwieldy, however.
So something like this could be used (also untested):
#ONINPUT {(%*)} {#VAR CurrentCommand "%1";#VAR CurrentCommand %replace(@CurrentCommand, "atm", "at the moment");#VAR CurrentCommand %replace(@CurrentCommand, "brt", "be right there");#EXEC {@CurrentCommand}}
- Charbal |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Sep 09, 2002 7:41 pm |
If you don't insist on limiting yourself to one trigger this becomes an easy problem.
#TR {Exits:} {#VAR exits %null}
#TR {Exits: (%w)} {#ADDITEM exits %1}
#TR {Exits: (%w) (%w)} {#ADDITEM exits %1;#ADDITEM exits %2}
#TR {Exits: (%w) (%w) (%w)} {#ADDITEM exits %1;#ADDITEM exits %2;#ADDITEM exits %3}
and so on, for however many exits you might expect to encounter.
Just make sure the trigger which clears the variable comes first, the order of the others won't matter since #ADDITEM doesn't create duplicate entries.
LightBulb
Senior Member |
|
|
|
|
|
|
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
|
|