Jump to content

help with fixing error in this script :(


Recommended Posts

Can anyone tell me how to fix this script, i got it off some site and when i try to run it , it say "error incorect number of parameter" ?!?! It a bot btw

#include <ImageSearch.au3>

HotKeySet("{ESC}", "Terminate")

MsgBox(0,"Welcome to the Feeder.")

If Not WinActive("[CLASS:Mabinogi]") Then WinActivate("[CLASS:Mabinogi]")

; coordinates of "is hungry" not sure why I'm storing this
Global $hcoordx, $hcoordy ; coordinates for "is hungry"
Global $shopx, $shopy ; coordinates for shop button
Global $tabx, $taby ; coordinates for shop tab
Global $itemx, $itemy ; coordinates of the feed item
Global $buyx, $buyy ; coordinates of the buy button
Global $spacex, $spacey ; coordinates of the space to put feeding item into
Global $endconvox, $endconvoy ; location of "end conversation"
Global $givex, $givey ; location of "give item"
Global $continuex, $continuey ; location of "continue"
Global $feedx, $feedy ; location of #1 slot item to be fed
Global $okayx, $okayy ; location of "okay"


While 1 
   GetWindowSize()
   
   HungerCheck()
   
   BuyEgoFood ()

   FeedEgo ()

WEnd

;===================================================================================
Func GetWindowSize()
   
   ; gets info of Mabinogi and stores them into a 4 element array
   $windowSize=WinGetPos(WinGetTitle("[CLASS:Mabinogi]"))
   
   ; determines specific locations
   If IsArray($windowSize) Then
   $topleftcorner[0] = $box[0]+$F1x
   $topleftcorner[1] = $box[1]+$F1y
   $bottomrightcorner[0] = $box[2]
   $bottomrightcorner[1] = $box[3]
   $center[0] = ($bottomrightcorner[0] + $topleftcorner[0]) / 2
   $center[1] = ($bottomrightcorner[1] + $topleftcorner[1]) / 2
EndFunc

;===================================================================================
Func HungerCheck()
   
   While 1
   ; Displays a tooltip that shows the user that the bot is searching for the words "is hungry"
   ToolTip "Checking for hungry ego..." , 0,@desktopheight-20
   
   ; Waits 15min for a "wants to chat" to appear
   _WaitForImageSearch("ishungry.bmp", 900, 1,$hcoordx, $hcoordy, 20)
      $found=_ImageSearch("ishungry.bmp", 1, $hcoordx, $hcoordy, 30) 
      
      If $found > 0 Then
      
 
      Else`
         
      EndIf
      
      
EndFunc


;===================================================================================
Func BuyEgoFood ()
   ; holds down control so that the NPC may be selected
   Send("{CTRLDOWN}")
   
   ; clicks in the middle of the screen to initiate a conversation with the NPC
   MouseClick ("primary" , $center[0] , $center[1] )
   
   ; releases control key
   Send("{CTRLUP}")
   
   ; searches for shop button and clicks it
   _ImageSearch("shop.bmp", 1, $shopx, $shopy, 30)
   MouseClick("Primary", $shopx, $shopy, 1)
   
   ; search for "tab" and clicks it
   ; tab.bmp may be changed depending on which npc you are feeding from
   ; for the sake of this experiment, I am using Malcolm
   _ImageSearch("tab.bmp", 1, $tabx, $taby, 20)
   MouseClick("Primary", $tabx, $taby, 1)
   
      
      ; buys said item 5 times
         $count = 0
         
         While $count <=5
            
            ; search for "item" you wish to feed
            ; item.bmp may be changed depending on which item you want to feed
            ; for the sake of this experiment, I am using Sandals, as I have a female sword ego
            _ImageSearch("item.bmp", 1, $itemx, $itemy, 30)
            MouseClick("Primary", $itemx, $itemy, 1)
         
         
            ;////// need to find a better way to determine the item as the item
            ; will change colors daily
         
            _ImageSearch("buy.bmp", 1, $buyx, $buyy, 5)
            MouseClick("Primary", $buyx, $buyy, 1)
         
         
            ;////// need to find a better way to determine where to place bought objects
            ; space.bmp is the slot in your inventory where you will place the bought item
            ; it may be modified according to the size of the item you wish to feed
            ; for the sake of this experiment, I will be using 2 x 2 as sandals are that size
            _ImageSearch("space.bmp", 1, $spacex, $spacey, 30)
            MouseClick("Primary", $spacex, $spacey, 1)
            
            $count + 1
            
            ToolTip "Item Count= " & $count , 0,@desktopheight-20
            
         WEnd

      ; end conversation with NPC
      _ImageSearch("endconvo.bmp", 1, $endconvox, $endconvoy, 30)
      MouseClick("Primary", $endconvox, $endconvoy, 1)

   ; proceed to feed ego
   FeedEgo ()

EndFunc

;===================================================================================
Func FeedEgo ()
   
   ; press ego hotkey
   Send("{/}")
   
   ; give item to ego
   _ImageSearch("give.bmp", 1, $givex, $givey, 30)
   MouseClick("Primary", $givex, $givey, 1)
   
   ; continue
   _ImageSearch("continue.bmp", 1, $contrinuex, $continuey, 30)
   MouseClick("Primary", $continuex, $continuey, 1)


   $feedcount = 0
   
   While $feedcount <= 5
      
      ; feeds item in #1 slot
      _ImageSearch("feed.bmp", 1, $feedx, $feedy, 30)
      MouseClick("Primary", $feedx, $feedy, 1)
      
      ; presses okay to feed item in #1 slot
      _ImageSearch("ok.bmp", 1, $okx, $oky, 30)
      MouseClick("Primary", $okx, $oky, 1)
      
      ; presses continue
      _ImageSearch("continue.bmp", 1, $contrinuex, $continuey, 30)
      MouseClick("Primary", $continuex, $continuey, 1)
      
      ; presses continue
      _ImageSearch("continue.bmp", 1, $contrinuex, $continuey, 30)
      MouseClick("Primary", $continuex, $continuey, 1)
      
      $feedcount + 1
      
      ToolTip "Ego has been fed: " & $feedcount "item(s)" , 0,@desktopheight-20
      
   WEnd
   
   ; Closes Ego Window and pauses for 30seconds before searching for "is hungry"
   
   Send("{/}")
   Sleep(30000)

EndFunc

;===================================================================================
Func Terminate()
   
   Exit 0
   
EndFunc
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...