Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Problem] Guild wars2 problem ze sprzedażą


Rekomendowane odpowiedzi

Opublikowano

Witam mam problem ze skryptem / detekcją pixeli.
Problem polega na tym , ze gdy zostanie sprzedana 1 sztuka jakiegokolwiek itemu ( przy okazji skrypt mimo iz ma obnizac cene o 1c tego nie robi) to zamiast przejsc do odbierania przedmiotów i użycia take all to się resetuje . Nie wiem co mogę z tym zrobic ;/

 

 

Skrypt na detekcje :

#include-once
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Description:    Functions that assist with Image Search
;                 Require that the ImageSearchDLL.dll be loadable
;
; ------------------------------------------------------------------------------

;===============================================================================
;
; Description:      Find the position of an image on the desktop
; Syntax:           _ImageSearchArea, _ImageSearch
; Parameter(s):     
;                   $findImage - the image to locate on the desktop
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of 
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0 
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
;       a desktop region to search
;
;===============================================================================
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
	;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
	if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
	$result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)

	; If error exit
    if $result[0]="0" then return 0
	
	; Otherwise get the x,y location of the match and the size of the image to
	; compute the centre of search
	$array = StringSplit($result[0],"|")
   
   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc

;===============================================================================
;
; Description:      Wait for a specified number of seconds for an image to appear
;     
; Syntax:           _WaitForImageSearch, _WaitForImagesSearch
; Parameter(s):     
;					$waitSecs  - seconds to try and find the image
;                   $findImage - the image to locate on the desktop
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of 
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0 
;
;
;===============================================================================
Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
	$waitSecs = $waitSecs * 1000
	$startTime=TimerInit()
	While TimerDiff($startTime) < $waitSecs
		sleep(100)
		$result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance)
		if $result > 0 Then
			return 1
		EndIf
	WEnd
	return 0
EndFunc

;===============================================================================
;
; Description:      Wait for a specified number of seconds for any of a set of
;                   images to appear
;     
; Syntax:           _WaitForImagesSearch
; Parameter(s):     
;					$waitSecs  - seconds to try and find the image
;                   $findImage - the ARRAY of images to locate on the desktop
;                              - ARRAY[0] is set to the number of images to loop through
;								 ARRAY[1] is the first image
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of 
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns the index of the successful find
;                   On Failure - Returns 0 
;
;
;===============================================================================
Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
	$waitSecs = $waitSecs * 1000
	$startTime=TimerInit()
	While TimerDiff($startTime) < $waitSecs
		for $i = 1 to $findImage[0]
		    sleep(100)
		    $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
		    if $result > 0 Then
			    return $i
		    EndIf
		Next	
	WEnd
	return 0
EndFunc

Ustawienia /skrypt sprzedazy :

#AutoIt3Wrapper_usex64=n
#include <WinAPI.au3>
#include <ImageSearch.au3>

;============================================================================================================================;
;Global Settings for the pixelscripts                                                                                        ;
;============================================================================================================================;

;They key pressed for ANTI-AFK.
Global $ANTI_AFK_KEY = "w"

;The time in Minutes how long to wait before pressing an ANTI-AFK key.
Global $ANTI_AFK_SLEEP_MINUTES = "5"

;The time to wait between 2 fast actions aka. your average lag.
Global $LAG_AVG = 200

;Set this to "True" if you want your Script to undercut by 1c while selling Items
Global $SELL_ITEM_DO_UNDERCUT = False


;============================================================================================================================;
;Dont expect support if you change anything below this line                                                                  ;
;============================================================================================================================;

Global $WIN_TITLE = "Guild Wars 2"
Global $RES_X = 1280
Global $RES_Y = 960
Global $OLD_WINDOW_TITLE = ""
Global $SELL_ITEM_UNDERCUT_X_DEVASTATION = -20
Global $SELL_ITEM_X_DEVASTATION = 60
Global $SELL_ITEM_Y_DEVASTATION = -60
Global $SELL_ITEM_WAIT_TIME = 5000
Global $HISTORY_DROPDOWN_X_DEVASTATION = 10
Global $HISTORY_DROPDOWN_Y_DEVASTATION = 50

Func killSwitch()
   Exit(0)
EndFunc

HotKeySet("{F10}", "killSwitch") 

Func GameToForeground()
   $OLD_WINDOW_TITLE = WinGetTitle("")
   WinActivate("Guild Wars 2")
   Sleep($LAG_AVG * 5)
EndFunc

Func GameToBackground()
   WinActivate($OLD_WINDOW_TITLE)
   Sleep($LAG_AVG)
EndFunc

Func resize()
    WinMove($WIN_TITLE, "",0 ,0 , $RES_X, $RES_Y)
 EndFunc
  
Func antiAFK()
   GameToForeground()
   Sleep($LAG_AVG * 5)
   Send($ANTI_AFK_KEY)
   GameToBackground()
EndFunc

Func getImageDir()
   $s = @ScriptDir
   Return $s & "\Images\"
EndFunc

Func findAndClick($imageName)
   gameToForeground()
   Local $x
   Local $y
   $result = _ImageSearch( getImageDir() & $imageName,1,$x,$y,20)
   if $result == 1 Then
	  MouseMove($x, $y)
	  Sleep($LAG_AVG)
	  MouseClick("left")
	  Return True
   EndIf
   Return False
EndFunc

Func openAuctionHouse() 
   $result = findAndClick("BLACK_LION.PNG")
   if ($result == False) then
	  Send("o")
   EndIf   
EndFunc

Func openSalesTab()
   openAuctionHouse()
   findAndClick("SALES.PNG")
   findAndClick("SALES_ACTIVE.PNG")
EndFunc

Func sellItems()
   While True
	  openSalesTab()
	  $x =  _WinAPI_GetMousePosX()
	  $x = $x + $SELL_ITEM_X_DEVASTATION
	  $y = _WinAPI_GetMousePosY()
	  $y = $y + $SELL_ITEM_Y_DEVASTATION
	  MouseMove($x, $y)
	  Sleep($LAG_AVG)
	  MouseClick("left")
	  Sleep($LAG_AVG * 3)
	  $res = findAndClick("SELL_MAXIMUM.PNG")
	  $res = findAndClick("MATCH_LOWEST_SELLER.PNG")
	  if ($SELL_ITEM_DO_UNDERCUT == True) Then
		 $res = findAndClick("COPPER.PNG")
		 $xUndercut = _WinAPI_GetMousePosX() + $SELL_ITEM_UNDERCUT_X_DEVASTATION
		 MouseMove($xUndercut, _WinAPI_GetMousePosY())
		 MouseClick("left")
		Sleep($LAG_AVG)
		 Send("{DOWN}")		 
	  EndIf
	  $res = findAndClick("SELL.PNG")
	  if $res == False Then
		 $return = lootMailbox()
		 if ($return == True) Then
			sellItems()
		 Else
			Return False
		 EndIf		 
	  EndIf
	  Sleep($SELL_ITEM_WAIT_TIME)
	  MouseClick("left")
   WEnd
EndFunc

Func lootMailbox()
   $res = findAndClick("MAILBOX_NEW.PNG")
   if $res == True Then
	  Sleep($LAG_AVG)
	  findAndClick("TAKE_ALL.PNG")
	  Return True
   Else
	  Return False
   EndIf
EndFunc

Func openHistoryTab()
   
   openAuctionHouse()
   findAndClick("HISTORY_ACTIVE.PNG")
   Sleep($LAG_AVG)
   findAndClick("HISTORY.PNG")
EndFunc

Func historyDropdownProceed()
   openHistoryTab()
   Sleep($LAG_AVG)
   findAndClick("HISTORY_DROPDOWN_ACTIVE.PNG")
   findAndClick("HISTORY_DROPDOWN.PNG")
   Sleep($LAG_AVG)
   $x =  _WinAPI_GetMousePosX()
   $x = $x + $HISTORY_DROPDOWN_X_DEVASTATION
   $y = _WinAPI_GetMousePosY()
   $y = $y + $HISTORY_DROPDOWN_Y_DEVASTATION
   MouseMove($x, $y)
   Sleep($LAG_AVG)
   MouseClick("left")
EndFunc

Func cancelOrders()
   historyDropdownProceed()
   Sleep($LAG_AVG)
   $res = findAndClick("REMOVE.PNG")
   $cancel = findAndClick("NO_RESULTS_FOUND.PNG")
   while ($cancel == False)
	  $cancel = findAndClick("NO_RESULTS_FOUND.PNG")
	  MouseClick("left")
	  Sleep(100)
   WEnd
EndFunc

 

Kocham mpcforum.pl!!!

18706.png

Opublikowano

Opisz jakoś bardziej problem bo przynajmniej ja patrząc na ten kod nic nie widze, może dziś ta zła pogoda... :unsure:

1387536187-U112334.png

Jeśli Ci pomogłem mógłbyś wynagrodzić lajkiem :)

Opublikowano

No więc tak . Gdy sprzedaje jeden item :

Func openSalesTab()
   openAuctionHouse()
   findAndClick("SALES.PNG")
   findAndClick("SALES_ACTIVE.PNG")
EndFunc
 
Func sellItems()
   While True
      openSalesTab()
      $x =  _WinAPI_GetMousePosX()
      $x = $x + $SELL_ITEM_X_DEVASTATION
      $y = _WinAPI_GetMousePosY()
      $y = $y + $SELL_ITEM_Y_DEVASTATION
      MouseMove($x, $y)
      Sleep($LAG_AVG)
      MouseClick("left")
      Sleep($LAG_AVG * 3)
      $res = findAndClick("SELL_MAXIMUM.PNG")
      $res = findAndClick("MATCH_LOWEST_SELLER.PNG")
      if ($SELL_ITEM_DO_UNDERCUT == True) Then
         $res = findAndClick("COPPER.PNG")
         $xUndercut = _WinAPI_GetMousePosX() + $SELL_ITEM_UNDERCUT_X_DEVASTATION
         MouseMove($xUndercut, _WinAPI_GetMousePosY())
         MouseClick("left")
        Sleep($LAG_AVG)
         Send("{DOWN}")      
      EndIf
      $res = findAndClick("SELL.PNG")
      if $res == False Then
         $return = lootMailbox()
         if ($return == True) Then
            sellItems()
         Else
            Return False
         EndIf       
      EndIf
      Sleep($SELL_ITEM_WAIT_TIME)
      MouseClick("left")
   WEnd
EndFunc

Skrypt resetuje się i nie przechodzi do kolejnej funkcji a mianowicie :

Func lootMailbox()
   $res = findAndClick("MAILBOX_NEW.PNG")
   if $res == True Then
      Sleep($LAG_AVG)
      findAndClick("TAKE_ALL.PNG")
      Return True
   Else
      Return False
   EndIf
EndFunc

W trakcie sprzedaży również nie obniża ceny o 1c mimo iż funkcja jest uruchomiona i powinna działać

if ($SELL_ITEM_DO_UNDERCUT == True) Then
         $res = findAndClick("COPPER.PNG")
         $xUndercut = _WinAPI_GetMousePosX() + $SELL_ITEM_UNDERCUT_X_DEVASTATION
         MouseMove($xUndercut, _WinAPI_GetMousePosY())
         MouseClick("left")
        Sleep($LAG_AVG)
         Send("{DOWN}")      
      EndIf

Kocham mpcforum.pl!!!

18706.png

Opublikowano

W twoim programie są same funkcje, nie ma nigdzie kodu, który się wykona po włączeniu programu. Po prostu nic nie robi.

 

Nie odejmuje bo masz

Global $SELL_ITEM_DO_UNDERCUT = False

Opublikowano

Global $SELL_ITEM_DO_UNDERCUT = False zmienione na true , tylko tutaj przekopiowalem całkowicie czysty kod bez wlasnych ustawień z początku.
Skoro mówie , że SPRZEDAJE się tylko 1 ITEM , to znaczy , że skrypt działa, resetuje się w momęcie gdy powinien pobrac itemy z mailboxa

Kocham mpcforum.pl!!!

18706.png

  • 2 tygodnie później...
Opublikowano

Napisalem ze jest to czysty confing po prostu , powtarzasz to co kolega wczesniejj ...
Opcja ta nie dziala bez roznicy czy jest na true czy false, pozatym glownym problem jest to co opisalem wczesniej w wątku..

Kocham mpcforum.pl!!!

18706.png

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...