|
RaZ Beginner
Joined: 04 Feb 2002 Posts: 13 Location: USA
|
Posted: Tue Feb 05, 2002 1:06 am
Need help making a trigger to read txt file |
I have a text file named dirshelp.txt
In this text file I have a list of areas and the directions to them
Ex:
miden'nir|.3e8s2w3s
mob factory|.s3wse
moria|.6e6n
holy grove|.8en
elemental canyon|.6e4s2es2eds4und
sewer|.2sd
The list has about 100-125 lines like above.
I want to make a trigger to make a variable to send this command to the mud, to help
people get to an area...
So far I have this:
#TRIGGER {~[~*QUESTION~*~] (*)~: ~'dirs (*)~'}
#file 1 dirshelp.txt
#var helpdir {%lower(%2)}
#var dirtogo {%item( "%grep( 1,"@helpdir")", 2)}
ans ~{R%proper(%1) to get to %2, from ms go @dirtogo
#close 1
note: %1 is player name and %2 is area name
Everything works except the @dirtogo variable....any pointers?
RaZ (v 6.16) |
|
|
|
RaZ Beginner
Joined: 04 Feb 2002 Posts: 13 Location: USA
|
Posted: Tue Feb 05, 2002 1:10 am |
<br>
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Feb 06, 2002 5:55 am |
Try:
#var dirtogo %item(%grep( 1,@helpdir), 2)
Rough work:
#VAR test "elemental canyon|.6e4s2es2eds4und"
#SH @test
elemental canyon|.6e4s2es2eds4und
#SH %item(@test, 2)
.6e4s2es2eds4und
#FILE 4 test
#WRITE 4 {@test}
#READ 4
elemental canyon|.6e4s2es2eds4und
#SH %grep( 4,@test)
elemental canyon|.6e4s2es2eds4und
#SH %item(%grep( 4,@test),2)
.6e4s2es2eds4und
#VAR test2 %item(%grep( 4,@test),2)
#SH @test2
.6e4s2es2eds4und
TonDiening
Uses 6.16 |
|
|
|
RaZ Beginner
Joined: 04 Feb 2002 Posts: 13 Location: USA
|
Posted: Wed Feb 06, 2002 6:35 am |
Its not opening the txt file correctly...
I typed #file 1 dirshelp
it said opened file1 as dirshelp.TXT
I typed #read...it was blank...
I tried it with #file 1 dirshelp.txt
same thing...
RaZ |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Feb 06, 2002 6:46 am |
Is that file in your zMud directory?
The file must be in the directory with zmud.exe.
Default install is c:zmud
// from help FILE:
The filename given in name is restricted to the current directory containing ZMUD.EXE and cannot refer to a EXE, HLP, or MUD file. This protects you from accidentally modifying important files on your disk.
TonDiening
Uses 6.16 |
|
|
|
RaZ Beginner
Joined: 04 Feb 2002 Posts: 13 Location: USA
|
Posted: Wed Feb 06, 2002 7:13 am |
Woot! I solved the problem myself..upon rereading the help file on #file I discovered that it only works when the file is in the same directory as the zmud.exe file....so I just changed the dirs...and presto it works like a charm, thanks for the help though, it helped me get a better understanding of how %item and %grep work.
RaZ |
|
|
|
|
|