Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Directions Script

Directions Script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Sediket   (10 posts)  Bio
Date Thu 20 Aug 2015 06:07 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 20 Aug 2015 09:37 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Sediket   (10 posts)  Bio
Date Reply #2 on Thu 20 Aug 2015 11:08 AM (UTC)
Message
Thanks Nick, I'll give it a shot.
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Fri 21 Aug 2015 01:19 AM (UTC)

Amended on Fri 21 Aug 2015 01:40 AM (UTC) by Meerclar

Message
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>

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,071 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.