Results 1 to 5 of 5

Thread: Lich question

  1. #1

    Default Lich question

    match "StunManSweepToolrackPut", "You have completed this Stun Maneuvers task."
    match "StunManSweepMoveAddNM", "repetition(s) remaining."
    match "StunManSweepMoveAddNM", "isn't full yet."
    fput "Put my bag in bin"
    matchwait

    What the lines are I'm trying to find...

    [You have # repetition(s) remaining.]
    -or-
    [You have completed this Stun Maneuvers task.]

    It's not finding them... I think it's because of the []'s
    Discord: Valendr0s#6885

  2. #2

    Default

    It's not the [], it's the (s)...
    Discord: Valendr0s#6885

  3. #3
    Join Date
    Jul 2003
    Location
    St. Louis, MO
    Posts
    4,271

    Default

    Yeah, parens don't convert correctly to matches. I can't even get "\(string\)" to work and escaping them SHOULD WORK! Note, this a problem with Ruby, not lich. There should be a option like /string/i or /string/g to not interpret any metas in a regex.
    Quote Originally Posted by Patrick McGoohan
    I am not a number, I am a free man!

  4. #4

    Default

    <slow, monotone voice>I believe everything and anything rainbow crotch tells me... I will find other way to match what I need... All hail rainbow crotch...</slow, monotone voice>
    Last edited by Deathravin; 04-05-2008 at 05:21 PM.
    Discord: Valendr0s#6885

  5. #5
    Join Date
    Nov 2004
    Location
    Upstate NY
    Posts
    428

    Default

    Off-hand... this is how I'd do it.

    Code:
    lines_to_look_for = [ "You have \d+ repetition(s) remaining",
      "You have completed this Stun Maneuvers task",
    ]
    line_that_matched = waitfor( *lines_to_look_for )
    reps_remaining = line_that_matched.slice(/\d+/)
    The lines_to_look_for variable is an array; this way to add a line that matches, all you have to do is paste it in on a new line. Without going into agonizingly over-descriptive detail, if you put an asterisk in front of an array when passing the array as an argument to a method, then the array isn't passed as a single variable -- its elements are themselves passed as the arguments. Ruby likes to call it "splat" something or other...

    e.g., in the above code, that waitfor method will receive exactly the same arguments as it would if you instead wrote it this way:
    Code:
    line_that_matched = waitfor( "You have \d+ repetition(s) remaining", "You have completed this Stun Maneuvers task" )
    It may help you to understand whatever isn't working as expected if you bear in mind that most of the very basic methods (match, waitfor, pause, etc.) are meant to be very forgiving and very flexible. That said, I have no idea why a string with parentheses in it wouldn't work; that should be just fine. Make sure it isn't the period that's screwing it up, since it's being interpreted as a "lite" regular expression.
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

Similar Threads

  1. Lich question.
    By Vindicate in forum The Lich Project
    Replies: 0
    Last Post: 05-03-2018, 06:08 PM
  2. Lich question
    By undernolights in forum The Lich Project
    Replies: 16
    Last Post: 10-18-2014, 01:47 PM
  3. Lich question
    By Vindicate in forum The Lich Project
    Replies: 3
    Last Post: 05-19-2010, 10:01 AM
  4. Lich question
    By Drew in forum Scripting Discussion
    Replies: 2
    Last Post: 10-15-2007, 01:33 AM
  5. Lich question
    By LordThoranios in forum Scripting Discussion
    Replies: 36
    Last Post: 03-27-2006, 02:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •