Results 1 to 9 of 9

Thread: Waitfor Oddity

  1. #1

    Default Waitfor Oddity

    WTF?!? All line matches for my containers are FUBAR'd!

    Code:
    fput "look in my cloak"
    line = waitfor("In the (.+) you see", "nothing in there")
    echo line
    exit
    --- Lich: test active.
    [test]>look in my cloak
    There is nothing in there.
    >
    [test: In the cloak: nothingThere is nothing in there.]
    --- Lich: test has exited.



    Code:
    fput "wave"
    line = waitfor("wave")
    echo line
    exit
    --- Lich: test active.
    [test]>wave
    You wave.
    >
    [test: You wave.]
    --- Lich: test has exited.

  2. #2

    Default

    It probably has to do with the SF xml tags... when you look in a container this is what is sent:

    Code:
    <container id='135289295' title='Sheath' target='#135289295' location='right'/><clearContainer id="135289295"/><inv id='135289295'>In the <a exist="135289295" noun="sheath">sheath</a>:</inv><inv id='135289295'> nothing</inv>There is nothing in there.
    Basically lich is ignoring the fact that <inv> tags are not streamed to your story window, they're streamed to an inventory window, so technically the echo of the single "line" sent to you when you type "Look in (container)" was correct.

  3. #3

    Default



    This is problematic . . . HOW TO FIX?

  4. #4

    Default

    Wait, so, if I don't have my inventory window open will this fix ze problem?

  5. #5

    Default

    Also, you're never on AIM anymore so I can't get expert advice for a nooblet like me

    OR ARE YOU GHOSTING?

  6. #6

    Default

    Don't really use AIM anymore... that and I don't use Lich so I wouldn't really be able to provide too much help.

    What is it you're trying to do with the variable that having that extra (albiet stupid looking) text attached? Can you check to see if it's in that format and work around it?

  7. #7

    Default

    I have the code at home but it would be something like this . . .

    line = waitfor("In the (.+) you see", "nothing").gsup(/ and (:?an|a|some)|,/)
    line.split(/,/).scan(/#{variable}/).times { fput "get #{variable} from #{container}" ; fput "sell #{variable}" }

    If I try to split the string, the first element in the array is EVERYTHING in the container and everything else follows suit as expected. So, if I have 55 items in my container array[0] is all 55 with the actual first item coming at the very last instance of the string and array[1] is the second item in the container.

    I tried to add a .delete_at(0) so it would get rid of that retarded huge first element but it's not working properly.

    When I get home, I can be more precise if need be.

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

    Default

    I hate dealing with the inconsistencies between SF and Wizard... try this:

    Code:
    line = matchafter("In the [^,]+ you see", "There is nothing in there.")
    if line.empty? or line.nil?
      # There's nothing in it... the "matchafter" command returned an empty string, meaning it saw the second option and there's nothing on the line after "There is nothing in there."
      exit
    end
    
    array_of_items = parse_list(line)
    echo array_of_items
    Should put an array of all the items in "array_of_items" with no weirdness being part of it, but it's off-the-cuff and untested, so take it with a grain of salt. If you're not familiar with it, the "matchafter" function just returns whatever came after the matching portion of the line.
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

  9. #9

    Default

    Thank You!


Similar Threads

  1. how do you make a multi waitfor script?
    By Intel in forum The Lich Project
    Replies: 0
    Last Post: 07-11-2014, 05:23 PM
  2. Waitfor? Match?
    By Intel in forum The Lich Project
    Replies: 6
    Last Post: 03-13-2013, 04:09 AM
  3. Waitfor being skipped
    By TheOne in forum The Lich Project
    Replies: 13
    Last Post: 08-27-2012, 09:29 PM
  4. Waitfor?
    By Kaelozim in forum The Lich Project
    Replies: 3
    Last Post: 09-30-2010, 06:26 PM
  5. wizard fe crashes with waitfor command
    By VotedAfkScrippr in forum Scripting Discussion
    Replies: 4
    Last Post: 08-13-2006, 01:16 AM

Posting Permissions

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