get exits from room

Posted by finnish on Thu 18 Sep 2003 04:53 AM — 4 posts, 18,201 views.

Russia #0
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)
Australia Forum Administrator #1
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.
Greece #2
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>
Russia #3
okay, thanks, i'll see what i can do.