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
➜ Perlscript
➜ get exits from room
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| finnish
Russia (18 posts) Bio
|
Date
| Thu 18 Sep 2003 04:53 AM (UTC) |
Message
| hello.
i just need help
here's the string with exits from room i get from mud:
[Exits: none]
or
[Exits: west south]
or even
[Exits: north south west east up down]
here's my problem:
i wann tell my script which exits does current room have.
that's for kinda autowalking.
maybe form an array of avaiable exits or empty if none.
i can't figure out how to do it.. will ya help?
(using perlscript and regexp's, of course) |
she never loved me why should anyone | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 18 Sep 2003 07:10 AM (UTC) |
Message
| Probably the trick would be to match on:
[Exits: *]
Then use Perl to break up the wildcard into as many words as it can, at the space character, and process those. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #2 on Thu 18 Sep 2003 12:31 PM (UTC) |
Message
| A walker plugin i made, just change the "Exits: " trigger:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, September 08, 2003, 7:44 PM -->
<!-- MuClient version 3.42 -->
<!-- Plugin "Walker" generated by Plugin Wizard -->
<muclient>
<plugin
name="Walker"
author="Poromenos"
id="7dea598620724627aca3629a"
language="VBscript"
purpose="Randomly walks around."
save_state="y"
date_written="2003-09-08 19:44:07"
requires="3.42"
version="1.0"
>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
enabled="n"
group="grpWalk"
keep_evaluating="y"
match="Exits: *"
match_text_colour="y"
script="subWalk"
sequence="100"
text_colour="15"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
<trigger
enabled="n"
group="grpWalk"
keep_evaluating="y"
match="(It\'s locked\.|Alas\, you cannot go that way\.)$"
match_text_colour="y"
regexp="y"
sequence="100"
text_colour="15"
other_text_colour="black"
other_back_colour="black"
>
<send>glance</send>
</trigger>
<trigger
enabled="n"
group="grpWalk"
keep_evaluating="y"
match="You can\'t do that sitting down\.$"
match_text_colour="y"
regexp="y"
sequence="100"
text_colour="15"
other_text_colour="black"
other_back_colour="black"
>
<send>stand
glance</send>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<alias
script="subSetInterval"
match="^Walker\:SetInterval[ ]+(\d+)$"
enabled="y"
regexp="y"
ignore_case="y"
sequence="100"
>
</alias>
<alias
script="subToggle"
match="^Walker\:Enable[ ]+(0|1)$"
enabled="y"
regexp="y"
ignore_case="y"
sequence="100"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
Sub subToggle(strName, strLine, strWildcards)
EnableTriggerGroup "grpWalk", Int(strWildcards(1))
If Int(strWildcards(1)) = 1 Then
Note "Walker: Enabled plugin."
Else
Note "Walker: Disabled plugin."
End If
End Sub
Sub subWalk(strName, strLine, strWildcards)
Dim intDirection
Dim strDirection
Randomize
varDirs = Split(strWildcards(1), " ", -1, 1)
strDirection = varDirs(Int(UBound(varDirs) * Rnd))
If Left(strDirection, 1) = "[" Then
strDirection = Right(Left(strDirection, Len(strDirection) - 1), Len(strDirection) - 2)
Send "pick " & strDirection
Send "open " & strDirection
End If
If Int(GetVariable("Interval")) < 1 Then
Send strDirection
Else
DoAfter Int(GetVariable("Interval")), strDirection
End If
End Sub
Sub subSetInterval(strName, strLine, strWildcards)
SetVariable "Interval", strWildcards(1)
Note "Walker: Interval set to " & strWildcards(1) & "."
End Sub
]]>
</script>
</muclient>
|
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| finnish
Russia (18 posts) Bio
|
Date
| Reply #3 on Thu 18 Sep 2003 08:37 PM (UTC) |
Message
| okay, thanks, i'll see what i can do. |
she never loved me why should anyone | 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.
14,059 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top