Exemple #1
0
def main():
    while True:
        p = check_prayer()
        print("{:.2f}".format(p))
        if p <= .25:
            if not RS.is_button_selected('inventory'):
                RS.press_button('inventory')
            find_prayer_pot()
        if p == 0:
            print('NO POTIONS FOUND, TERMINATING MACRO!')
            return
        time.sleep(3)
Exemple #2
0
def find_template(template_name):  #pass template to function
    global imd
    #checks to see wheater to add cur dir or not
    x1, y1 = RS.position()  #Get runescapes top-left coords

    x1 += 557  #make The Bag's top-left, and btm-right coords
    y1 += 229  #x2,y2 == btm-right coord, width and height
    x2 = x1 + 173
    y2 = y1 + 253

    if not RS.is_button_selected('inventory'):
        #RS.press_button('inventory')
        init_x = random.randint(x1, x2)
        init_y = random.randint(y1, y2)

        Mouse.moveTo(init_x, init_y)
        autopy.key.tap(autopy.key.K_F1)

    # image of bag
    rs_bag = Screenshot.shoot(x1, y1, x2, y2)  #Screenshot taken here,
    # cv2.imshow('bag', rs_bag)
    # cv2.waitKey(0)

    #template
    template = imd.pickled_dict[template_name]
    #imd.showImg('salmon')
    color_mode, w, h = template.shape[::-1]
    # change img to grayscale
    if color_mode == 3:
        template = cv2.cvtColor(template, cv2.COLOR_RGB2GRAY)
    res = cv2.matchTemplate(rs_bag, template, cv2.TM_CCOEFF_NORMED)
    threshold = .8  #default is 8
    loc = np.where(res >= threshold)
    for pt in zip(*loc[::-1]):  #goes through each found image
        btmX = pt[
            0] + w - 5  #pt == top-left coord of template, bottom-right point of of template image
        btmY = pt[1] + h - 5
        #moving the pt coord of the template a bit to the right, so options menu get brought up
        pt = (pt[0] + 5, pt[1] + 2)

        x, y = gen_coords(
            pt, btmX, btmY
        )  #gets random x, y coords relative to RSposition on where to click
        #Mouse.moveClick(x,y, 3)#right clicks on given x,y coords

        # using new method to drop. holding shift
        autopy.key.toggle(autopy.key.K_SHIFT, True)
        Mouse.moveClick(x, y, 1)  #right clicks on given x,y coords
        autopy.key.toggle(autopy.key.K_SHIFT, False)

        #RS.findOptionClick(x,y,'drop')

    RandTime.randTime(2, 0, 0, 2, 9, 9)
Exemple #3
0
while True:
    if counter >= nats+souls+bodys:
        print('done!')
        break
#        
    if nats:
        spell('alch')
        nats -= 1
        RandTime.randTime(0,1,9,0,3,9)
    if souls:
        spell('stun')
        souls -= 1
    if bodys and not souls:
        spell('curse')
        bodys -= 1
    if (counter % (random.choice([2,3])) == 0 or counter == 0) and ((souls > 0) or (bodys > 0)):
        print(counter,'Finding Monk')
        x1,y1,x2,y2 = findMonk()
    if (souls > 0) or (bodys > 0): 
        if not RS.is_button_selected('magic'):
            RS.press_button('magic')
        x, y = genCoords(x1,y1,x2, y2)
        Mouse.moveClick(x,y,1)
        if random.randint(1,100) == 0:
            RandTime.randTime(0,0,0,9,9,9)
        else:
            RandTime.randTime(0,0,0,1,2,3)

    counter += 1 
    RS.antiban('magic')
Exemple #4
0
        print('done!')
        break
#
    if nats:
        spell('alch')
        nats -= 1
        RandTime.randTime(0, 1, 9, 0, 3, 9)
    if souls:
        spell('stun')
        souls -= 1
    if bodys and not souls:
        spell('curse')
        bodys -= 1
    if (counter %
        (random.choice([2, 3])) == 0 or counter == 0) and ((souls > 0) or
                                                           (bodys > 0)):
        print(counter, 'Finding Monk')
        x1, y1, x2, y2 = findMonk()
    if (souls > 0) or (bodys > 0):
        if not RS.is_button_selected('magic'):
            RS.press_button('magic')
        x, y = genCoords(x1, y1, x2, y2)
        Mouse.moveClick(x, y, 1)
        if random.randint(1, 100) == 0:
            RandTime.randTime(0, 0, 0, 9, 9, 9)
        else:
            RandTime.randTime(0, 0, 0, 1, 2, 3)

    counter += 1
    RS.antiban('magic')