Directions Script

Posted by Sediket on Thu 20 Aug 2015 06:07 AM — 4 posts, 20,472 views.

#0
Hello,

I'm new to MUSH client and I've run into a situation. I have my directions all saved in a txt file from other another mud client (CMUD) where the directions are separated by semi-colons. The problem is that I have script commands in the txt file as well and they don't mix well so far in MUSHClient.

so for example as a test:

tested commands:

f = io.open ("runs\\\\100k.txt")
/Execute (f:read("*l"))

txt file:

2 nw;2 n;3 w;/Send ("hi")

I've noticed that the directions would execute properly with the command stacking operator, but the script commands wouldn't be processed as script commands and just sent to the mud unless the script commands were at the beginning of the line, but then any semi-colons error because the semi-colons aren't recognized in the scripting language.

The reason why I'm doing this is because I would like certain commands to easily be executed when entering certain rooms. Like updating target variables or other similar functions. Also I'm looking for an organized way of doing this. In the past I tried using conditional statements, but it got all crazy and convoluted especially if I had to modify my directions because all the conditional statements would need to be shifted, like room 23 became room 26, etc.

I also tried then having an extra line after each direction line in the file for script commands, but then the script commands couldn't be stacked in one line.

Any suggestions?
Australia Forum Administrator #1
See: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6572

You may have to rework a bit.

One approach would be to be for you to convert the ";" into newlines in the script, then the Execute call might work. Or just break it into lines, and do an Execute() on each one.
#2
Thanks Nick, I'll give it a shot.
USA #3
If there's a mud command equivalent to that Send ("hi) (ie, say hi) you're trying to use you can just use the mud command. It's also worth noting that MC speedwalk doesn't need ; separators between directions like you had in cmud.

As an example, here's a couple of the more interesting but less convoluted speedwalks I have aliased:

<aliases>
<alias
match="draco"
enabled="y"
sequence="100"
>
<send>5n6w6ses2enes8e;open door;3s3en2e;take key;unlock door;open door;drop key;n;close door</send>
</alias>
</aliases>

<aliases>
<alias
match="necro"
enabled="y"
sequence="100"
>
<send>#3s3w4s2e;take key;unlock gate;open gate;drop key;#5sesd2wnene2sd8sd2se4swsed3n2w</send>
</alias>
</aliases>