|
Valdar Novice
Joined: 17 May 2003 Posts: 30 Location: USA
|
Posted: Sat Nov 15, 2003 3:29 am
Binding exits to keypad |
My problem is my trigger only fires for the first instance on the line when there could be any were from 1 to 3 per line... here is an example output from the MUD:
Underground <UG> Orchards <NE> Mountain Blvd <W>
What i'm trying to do is map the exits (inside the <>) to the keypad (there is never more than 9 exits per room which works out fine) So this is how i'd want it turning out... (and the - around e5 is possible)
Exit1 desc <E1> Exit2 <E2> another exit <E3>
yet another exit <E4> And another -e5-
and this is how they would map out on the keypad...
E1 = 7
E2 = 8
E3 = 9
E4 = 4
E5 = 5
E6 = 6
E7 = 1
E8 = 2
E9 = 3
Currently my trigger ~<(%w)>~> with the action #say %1(a sample to try and get the basics worked out)...all it does is gives the first thing of each line (E1, E4, and E7)
I could probably figure it out if i could get it to trigger multiple times per line but it doesnt seem to want to do that... |
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
|
|
|
Valdar Novice
Joined: 17 May 2003 Posts: 30 Location: USA
|
Posted: Sun Nov 16, 2003 6:44 am |
It seems like it would work but.... any time i set my trigger to 'reparse' it makes zMUD lock up... probably due to how i'm not using #COND or it keeps re-evaluating the same line infinitly or somthing...
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Nov 16, 2003 9:53 pm |
I find it's usually simplest to handle multiple possibilities with multiple triggers.
I'm assuming that the first three exits would go on the first line, the next three on the second line, and the last three on the third line. This means that there would never be a second line unless the first line had three exits, and there would never be a third line unless the first and second lines both had three exits. I've also assumed that there will always be at least two lines between one set of exit lines and the next. If not, you'll have to figure out some other way to reset the variable.
#VAR ExitLine 1 1
#TR {^[a-z 1-9] {~<|-}(%a){~>|-}$} {#CASE @ExitLine {#KEY KEY7 {%1}} {#KEY KEY4 {%1}} {#KEY KEY1 {%1}};#VAR ExitLine 1}
#TR {^[a-z 1-9] {~<|-}(%a){~>|-} [a-z 1-9] {~<|-}(%a){~>|-}$} {#CASE @ExitLine {#KEY KEY7 {%1};#KEY KEY8 {%2}} {#KEY KEY4 {%1};#KEY KEY5 {%2}} {#KEY KEY1 {%1};#KEY KEY2 {%2}};#VAR ExitLine 1}
#TR {^[a-z 1-9] {~<|-}(%a){~>|-} [a-z 1-9] {~<|-}(%a){~>|-} [a-z 1-9] {~<|-}(%a){~>|-}$} {#CASE @ExitLine {#KEY KEY7 {%1};#KEY KEY8 {%2};#KEY KEY9 {%3};#VAR ExitLine 2;#T+ NewExits} {#KEY KEY4 {%1};#KEY KEY5 {%2};#KEY KEY6 {%3};#VAR ExitLine 3} {#KEY KEY1 {%1};#KEY KEY2 {%2};#KEY KEY3 {%3};#VAR ExitLine 1}}
#TR NewExits {*} {}
#COND {} {#VAR ExitLine 1;#T- NewExits} {Skip|Param=2}
This is, obviously, for command line entry. |
|
|
|
Valdar Novice
Joined: 17 May 2003 Posts: 30 Location: USA
|
Posted: Sun Nov 16, 2003 11:28 pm |
Thanks Lightbulb! Had to modify a few things (like making it so it would detect the variable amount of spaces at the end of each line) and changed the lineskip from 2 to 3 (wouldnt detect the third line of exits otherwise) but now its working like a charm :)
|
|
|
|
|
|