Results 1 to 7 of 7

Thread: need halp

  1. #1
    Join Date
    Sep 2007
    Location
    north carolina
    Posts
    612

    Default need halp

    if anyones bored and better then i am at scripting(wich prolly most are) i need npcpick to check all my containers for boxes instead of just my lootsack..

    silence_me

    withdraw_amount = 25000
    close_lootsack = false
    junk_nouns = [ 'lockpick', 'tabard', 'shirt', 'scarf', 'cap', 'hat', 'snood', 'doughnut', 'tart', 'cupcake', 'ribbon', 'cookie', 'horseshoe', 'muffin', 'dress', 'boots', 'skirt', 'harness', 'satchel', 'vest', 'gloves', 'bonnet', 'purse', 'scabbard', 'cloak', 'greatcloak', 'knapsack' ]
    junk_regex = /^(?:scratched|corroded|polished|shiny|tarnished|de nted|rusty|bent) (?:ring|medallion|earring|anklet|bracelet|fork|spo on|plate|coin|cup|nail|doorknob)$|^smooth stone$|^steel shield$|^some tree bark$|^table leg$|^moldy bone$|^some tattered cloth$|^piece of iron$|^chipped brick$|^scratched steel helm$/

    disk = GameObj.loot.find { |obj| obj.name =~ /#{Char.name} disk$/ }

    if UserVars.lootsack.nil? or UserVars.lootsack.empty?
    echo 'error: lootsack is not set (;set change lootsack <container>)'
    exit
    end
    unless lootsack = GameObj.inv.find { |obj| obj.name =~ /#{Regexp.escape(UserVars.lootsack.strip)}/i } || GameObj.inv.find { |obj| obj.name =~ /#{Regexp.escape(UserVars.lootsack).sub(' ', ' .*')}/i }
    echo "error: unable to find your lootsack #{UserVars.lootsack} in your inventory"
    exit
    end
    if lootsack.contents.nil?
    open_result = dothis "open ##{lootsack.id}", /You open|already open/
    close_lootsack = true if open_result =~ /You open/
    if lootsack.contents.nil?
    dothis "look in ##{lootsack.id}", /In the .* you see/
    if lootsack.contents.nil?
    echo 'fixme (1)'
    exit
    end
    end
    end

    unless (GameObj.right_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/) or (GameObj.left_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/) or lootsack.contents.find { |obj| obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/ }
    if disk and disk.contents.nil?
    echo "Waiting On Your Disk To Arrive"
    pause 3
    dothistimeout "look in ##{disk.id}", 2, /^In the|^There is nothing in there\.$/
    end
    unless disk.contents.any? { |obj| obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/ }
    echo 'no boxes'
    exit
    end
    end

    start_script 'go2', [ 'bank', '_disable_confirm_' ]
    wait_while { running?('go2') }
    fput "withdraw #{withdraw_amount} silvers"
    start_script 'go2', [ 'locksmith', '_disable_confirm_' ]
    wait_while { running?('go2') }

    empty_hands

    unless trash = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun =~ /^(?:crate|barrel|wastebarrel|casket)$/ } || trash = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun == 'coffer' }
    echo 'warning: failed to find a trash container'
    end

    unless table = (GameObj.room_desc.to_a + GameObj.loot.to_a).find { |obj| obj.noun =~ /^(?:table|counter)$/ }
    echo 'error: failed to find a table'
    exit
    end

    if table.contents.nil?
    dothistimeout "look on ##{table.id}", 5, /On the .*? you see/
    if table.contents.nil?
    echo 'fixme (2)'
    exit
    end
    end

    if table.contents.find { |obj| obj.noun == 'bell' }
    activator = 'ring bell'
    elsif table.contents.find { |obj| obj.noun == 'keys' }
    activator = 'pull keys'
    elsif table.contents.find { |obj| obj.noun == 'chime' }
    activator = 'ring chime'
    else
    echo 'error: failed to find bell/keys/chime type thing'
    exit
    end

    open_box = proc { |box|
    unless (GameObj.right_hand.id == box.id) or (GameObj.left_hand.id == box.id)
    dothistimeout "get ##{box.id}", 3, /^You remove|^Get what\?$/
    end
    if (GameObj.right_hand.id == box.id) or (GameObj.left_hand.id == box.id)
    put_result = dothistimeout "put ##{box.id} on ##{table.id}", 5, /^You put|^Your .*? won't fit on .*?\.$/
    if (put_result =~ /won't fit/) and table.contents.length > 1
    for obj in table.contents
    if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    fput "get ##{obj.id}"
    sleep 0.1
    fput "drop ##{obj.id}"
    sleep 0.1
    end
    end
    put_result = dothistimeout "put ##{box.id} on ##{table.id}", 5, /^You put|^Your .*? won't fit on .*?\.$/
    end
    if put_result =~ /^You put/
    fput 'unhide' if invisible?
    activator_result = dothistimeout activator, 5, /^You .*? the .*? but .*? ignores you|I'm afraid that you can't pull that.|^You .*? the .*?, and ask .*?/
    if activator_result =~ /^You .*? the .*?, and ask .*?/
    pay_result = dothistimeout 'pay', 5, /^But you don't have enough!|accepts your silvers./
    if pay_result =~ /^But you don't have enough!/
    start_script 'go2', ['bank']
    wait_while { running?('go2') }
    start_script 'go2', [ 'bank', '_disable_confirm_' ]
    wait_while { running?('go2') }
    fput "withdraw #{withdraw_amount} silvers"
    start_script 'go2', [ 'locksmith', '_disable_confirm_' ]
    wait_while { running?('go2') }
    pay_result = dothistimeout "pay", 5, /^But you don't have enough!|accepts your silvers./
    end
    if pay_result = /accepts your silvers./
    get_result = dothistimeout "get ##{box.id}", 5, /^Get what?|^You remove/
    if get_result =~ /^You remove/
    open_result = dothistimeout "open ##{box.id}", 5, /^You open/
    if open_result =~ /^You open/
    get_result = dothistimeout "get coins from ##{box.id}", 5, /^You gather the remaining/
    unless get_result =~ /^You gather the remaining/
    echo 'fixme (9)'
    end
    waitrt?
    for obj in box.contents
    if junk_nouns.include?(obj.noun) or (obj.name =~ junk_regex)
    dothistimeout "get ##{obj.id}", 3, /^You/
    if trash
    dothistimeout "put ##{obj.id} in ##{trash.id}", 3, /^You put|^As you place/
    else
    dothistimeout "drop ##{obj.id}", 3, /^You drop/
    end
    else
    dothistimeout "_drag ##{obj.id} ##{lootsack.id}", 3, /^You put/
    end
    end
    unless box.contents.empty?
    echo 'fixme (10)'
    exit
    end
    if trash
    dothistimeout "put ##{box.id} in ##{trash.id}", 3, /^You put|^As you place/
    else
    dothistimeout "drop ##{box.id}", 3, /^You drop/
    end
    sleep 0.1
    else
    echo 'fixme (8)'
    end
    else
    echo 'fixme (7)'
    end
    else
    echo 'fixme (6)'
    end
    else
    echo 'fixme (5)'
    end
    else
    echo 'fixme (4)'
    fput "drop ##{box.id}"
    end
    else
    echo 'fixme (3)'
    end
    }

    #
    # start when there are no pcs in the room, or the table doesn't change for 10 seconds, or two minutes pass.
    #
    max_wait = Time.now + 120
    after = table.contents.collect { |obj| obj.id }
    while checkpcs
    before = after.dup
    50.times {
    sleep 0.2
    break if checkpcs
    after = table.contents.collect { |obj| obj.id }
    break if before != after
    }
    break if (before == after) or (Time.now > max_wait)
    end

    if GameObj.right_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(GameObj.right_hand)
    end
    if GameObj.left_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(GameObj.left_hand)
    end
    for obj in lootsack.contents
    if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(obj)
    end
    end

    if disk
    50.times { break if GameObj.loot.any? { |obj| obj.id == disk.id }; sleep 0.1 }
    if GameObj.loot.any? { |obj| obj.id == disk.id }
    if disk.contents.nil?
    dothistimeout "look in ##{disk.id}", 2, /^In the|^There is nothing in there\.$/
    end
    for obj in disk.contents
    if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(obj)
    end
    end
    end
    end

    fill_hands

    fput "close ##{lootsack.id}" if close_lootsack

    if anyone wants to help, thanks in advance
    R.I.P Grandma, You Will Always Be Remembered
    __________________
    ~Snoopy/Tune/Psycho

  2. #2

    Default

    Code:
    if GameObj.right_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(GameObj.right_hand)
    end
    if GameObj.left_hand.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(GameObj.left_hand)
    end
    for obj in lootsack.contents
    if obj.noun =~ /^(?:box|strongbox|chest|coffer|trunk)$/
    open_box.call(obj)
    end
    end
    You could just edit the bolded region. Wrap that section in a cycle that iterates over all of your containers (or a list of specific containers). The open_box procedure handles everything, you just need to feed it a game object that's a box. For situations like these, I have a lootoverflow setting and I'm only ever checking two containers for loot. That would make this process ten times easier (having a list of locations rather than not).

  3. #3
    Join Date
    Sep 2007
    Location
    north carolina
    Posts
    612

    Default

    yea that just confused me more, i dont really know anything about gameobj and uservars stuff.. thats why i said if someone wanted to do it lol, but thanks capn i just dont know enough to use that help heh
    R.I.P Grandma, You Will Always Be Remembered
    __________________
    ~Snoopy/Tune/Psycho

  4. #4
    Join Date
    Sep 2007
    Location
    north carolina
    Posts
    612

    Default

    [red] need halp 03-31-2012 08:46 AM no

    get a life, fucking idiot patrol and next time sign it pussy

    and i fixed the problem an easier way, thanks to who offered to help.. fuck off to the lame fag who patrols to neg rep people asking for help
    Last edited by Hilts; 03-31-2012 at 11:44 AM.
    R.I.P Grandma, You Will Always Be Remembered
    __________________
    ~Snoopy/Tune/Psycho

  5. #5
    Join Date
    Apr 2005
    Location
    Close enough to Pittsburgh
    Posts
    1,723

    Default

    I'm late to the party, but why not download and hack the shit out of upickbot2?


    In memory of Ken "Zzentar" Dumas.

    Gibreficul

    AIM = Lord Gibreficul

  6. #6

    Default

    My suggestion was a two-line fix and he didn't seem confident with it. Not sure hacking the shit out of something would seem more promising.

    I would like to know what is easier than my suggestion, though. I hope it's not to change lootsack settings and run the script over and over.

  7. #7
    Join Date
    Apr 2005
    Location
    Close enough to Pittsburgh
    Posts
    1,723

    Default

    Quote Originally Posted by DaCapn View Post
    My suggestion was a two-line fix and he didn't seem confident with it. Not sure hacking the shit out of something would seem more promising.

    I would like to know what is easier than my suggestion, though. I hope it's not to change lootsack settings and run the script over and over.
    The work is done in upickbot2. Fact is... the bulk of my "automated" scripts have used the exact same code for collecting information on any character's containers. It might not be the easiest way to do it... but to me, it's the BEST way.

    Basically...
    status_tags (so you get all the good XML shit, with ID#s and all.)
    inventory container
    match the line, then scan it for ID#s and add them to a global array.... so now ANY script can access that information.

    Although I try to keep my characters as "standardized" as possible, it's not always realistic to expect every character to have a cloak, a pack, a satchel, and a sack. My gnome wizard has a sack and a backpack, my sorcerer has a greatcloak, a pack, a bag, a kit, a satchel and a bandolier for his containers... My shattered rogue has... a badge, a backpack, a sack, a harness, a scabbard, and the keyring that shouldn't really be considered a container, but it is. For an individual character, a hard coded list of containers works just fine. For multiple characters, my way is WAY better. For YOUR benefit, I've included the code below...

    Code:
    $container = [] unless $container
    contruns = 0
    until !$container.empty?
    	break if contruns > 9
    	msg "upickbot2 grabbing container IDs"
    	done = false
    	action = proc{ |grab_this|
    		if grab_this =~ /You are wearing/i
    			$container = grab_this.scan(/a exist\=\"([\d]+)[^\.|,]/).flatten
    			grab_this;nil
    		elsif grab_this =~ /\<prompt time\=/
    			grab_this
    			done = true;nil
    		end
    	}
    	waitrt?
    	DownstreamHook.add('inv_cont', action)
    	status_tags
    	$_SERVER_.puts "inventory cont"
    	t=Time.now
    	wait_until {done or t+3<Time.now}
    	DownstreamHook.remove('inv_cont')
    	status_tags
    	contruns += 1
    end
    unless $i_have_run
    	$i_have_run = true
    	$container.each{|cont|;fput "look in ##{cont}"}
    	msg("That was to make sure all of your items are loaded into item tracking")
    end
    The first chunk of code will populate the $container array with all the ID#s of your containers. The second chunk of code will LOOK in each container to make sure Lich has the XML data of the contents of that container loaded into memory. Assume like-trusted scripts, that bit of code doesn't even have to be in whatever script... run it on startup and have your scripts refer to and cycle through that $container array...


    In memory of Ken "Zzentar" Dumas.

    Gibreficul

    AIM = Lord Gibreficul

Similar Threads

  1. Halp!
    By SpiffyJr in forum World of Warcraft
    Replies: 10
    Last Post: 02-26-2012, 03:44 PM
  2. Halp!
    By subzero in forum The Lich Project
    Replies: 4
    Last Post: 05-13-2011, 07:09 PM
  3. SQL Halp!
    By Danical in forum Off-Topic
    Replies: 2
    Last Post: 08-18-2010, 02:51 PM
  4. my GS is fubar please halp
    By LOL BRIELUS in forum PsiNet
    Replies: 5
    Last Post: 11-28-2009, 05:59 PM
  5. Halp!
    By Ashmoon in forum Off-Topic
    Replies: 9
    Last Post: 10-10-2008, 03:43 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
  •