bazaar.mac - Complete Bazaar Buy and Sell Script

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

se7en
orc pawn
orc pawn
Posts: 21
Joined: Sun Dec 14, 2003 6:51 pm

Post by se7en » Thu Jan 01, 2004 3:12 am

For those having trouble not finding the routine.. its linked here:

http://macroquest2.com/phpBB2/viewtopic ... movetotarg

Also, was curious if it is possiible to purchase all of an item that is available from the currently tracked vendor with lowest prices.. say he or she has 16 or 20 of something that sells for a 5pp profit, instead of having it run back and forth buying one at a time, could it shift+/click left? is that all it would take? Going to try it as soon as I get back from the hospital tommorow.


Code: Select all

sub buyitem(item)
   /sendkey down Shift
   /selectitem "@item" merchant
   /click left merchant buy
   /delay 20
   /sendkey up Shift
   /click left merchant done
   /return
Look good?

Zacaria
orc pawn
orc pawn
Posts: 19
Joined: Wed Dec 03, 2003 5:47 pm

Post by Zacaria » Thu Jan 01, 2004 2:52 pm

Here is my version of the script, i made it run some checks etc. make sure your buying it from the right person and have the right item before you click buy.

Also checks if you have enough money and if you dont it outputs it to a file.

Also did a modifcation to the syntax so you can specify the value to go to. (since my file has like 5000 entries)

Try it out...

Code: Select all

#turbo 

sub main(counter)
/zapvars
/declare file global 
/declare isle global 
/declare l1 local 
/declare traderid local 
/declare price local 

/varset file bazaar.ini 

/if $defined(counter)==false {
/echo format /mac dumpsterdive <Variable  Number to Start At> ex. /mac dumpsterdive 1
/return
}
:mainloop 

/if "$ini(@file,names,val@counter)"=="NOTFOUND" { 
    /echo ---------------------------------------
    /echo ----------Starting Search Over--------- 
    /echo ---------------------------------------
    /echo Script has Ben running: $int($calc($running/60)) Minutes $calc($running%60) Seconds
    /delay 30s
    /varset counter 1 
    /goto :mainloop 
    } 
/echo ======Searching for $ini(@file,names,val@counter) #@counter
/bzsrch race any class any $ini(@file,names,val@counter)

| is request done? 
:loop 
/delay 1  
/if "$bazaar()"=="FALSE" /goto :loop 

/if n $bazaar(count)==0 { 
    /echo $ini(@file,names,val@counter) not found, continuing on... 
    /varadd counter 1 
    /varset counter $int(@counter) 
    /goto :mainloop       
} else { 
    /echo Found $bazaar(count) items for sale.
} 

/varset price $bazaar(0,price) 
/varset traderid $bazaar(0,trader) 


/if n $bazaar(count)>=1 { 
    /for l1 1 to $calc($bazaar(count)-1)
    	/if "$bazaar(@l1,name)"=="$ini(@file,names,val@counter)" {
        	/echo Item #@l1 price $bazaar(@l1,price) 
        	/if n @price>$bazaar(@l1,price) { 
        		/varset price $bazaar(@l1,price) 
        		/varset traderid $bazaar(@l1,trader) 
        	}
        }
    /next l1 
} 

/if "$bazaar(@l1,name)"=="$ini(@file,names,val@counter)" {
	/goto :itsok
	
} else {
/varadd counter 1
/varset counter $int(@counter)
/goto :mainloop
}
:itsok
/if n @price>=$ini(@file,prices,val@counter) { 
    /varadd counter 1 
    /varset counter $int(@counter) 
    |/echo @counter 
    /goto :mainloop 
    } 
|/echo targeting @traderid 
/if n $char(cash)<@price {
	/echo YOU DONT HAVE ENOUGH MONEY FOR THIS ITEM!!!!! writing it to a log file and going to next item
	/ini "nomoney.ini" "$ini(@file,names,val@counter)" @price
	/varadd counter 1
	/varset counter $int(@counter)
	/goto :mainloop
}

/echo Going to Go make me $int($calc($calc(1-$calc(@price/$ini(@file,prices,val@counter)))*100))% profit!!
/target id @traderid 
/face 
/call traderisle $target(x) $target(y) 
/call movetoisle @isle 
/face 
/call movetotarg 10 
/click right target 
/delay 20 
/call buyitem "$ini(@file,names,val@counter)" 
/call moveback @isle 
/call sellitem "$ini(@file,names,val@counter)"
/goto :mainloop 
/return 


Sub movetoisle(isle) 
   /if n @isle==61 /call walkpath 61 10 
   /if n @isle==62 /call walkpath 62 10 
   /if n @isle==81 /call walkpath 81 10 
   /if n @isle==82 /call walkpath 82 10 
   /if n @isle==91 /call walkpath 82 10 
   /if n @isle==92 /call walkpath 92 10 
   /if n @isle==51 /call walkpath 51 10 
   /if n @isle==52 /call walkpath 52 10 
   /if n @isle==21 /call walkpath 21 10 
   /if n @isle==22 /call walkpath 22 10 
   /if n @isle==31 /call walkpath 31 10 
   /if n @isle==32 /call walkpath 32 10 
   /return 

Sub traderisle(xloc,yloc) 
   /if n @xloc>95 /if n @xloc<129 /if n @yloc>-770 /if n @yloc<-589 /varset isle 61 
   /if n @xloc<95 /if n @xloc>62 /if n @yloc>-770 /if n @yloc<-589 /varset isle 62 
   /if n @xloc>-104 /if n @xloc<-72 /if n @yloc>-772 /if n @yloc<-590 /varset isle 81 
   /if n @xloc<-104 /if n @xloc>-145 /if n @yloc>-772 /if n @yloc<-590 /varset isle 82 
   /if n @xloc>-203 /if n @xloc<-171 /if n @yloc>-713 /if n @yloc<-527 /varset isle 91 
   /if n @xloc<-203 /if n @xloc>-250 /if n @yloc>-713 /if n @yloc<-527 /varset isle 92 
   /if n @xloc>-118 /if n @xloc<107 /if n @yloc<-541 /if n @yloc>-571 /varset isle 51 
   /if n @xloc>-118 /if n @xloc<107 /if n @yloc>-541 /if n @yloc<-514 /varset isle 52 
   /if n @xloc>95 /if n @xloc<129 /if n @yloc>-495 /if n @yloc<-296 /varset isle 21 
   /if n @xloc<95 /if n @xloc>62 /if n @yloc>-495 /if n @yloc<-296 /varset isle 22 
   /if n @xloc>-104 /if n @xloc<-72 /if n @yloc>-495 /if n @yloc<-296 /varset isle 31 
   /if n @xloc<-104 /if n @xloc>-145 /if n @yloc>-495 /if n @yloc<-296 /varset isle 32 
    
   /return 


Sub moveback(isle) 
   /if n @isle==61 /call walkpath 61b 10 
   /if n @isle==62 /call walkpath 62b 10 
   /if n @isle==81 /call walkpath 81b 10 
   /if n @isle==82 /call walkpath 82b 10 
   /if n @isle==91 /call walkpath 82b 10 
   /if n @isle==92 /call walkpath 92b 10 
   /if n @isle==51 /call walkpath 51b 10 
   /if n @isle==52 /call walkpath 52b 10 
   /if n @isle==21 /call walkpath 21b 10 
   /if n @isle==22 /call walkpath 22b 10 
   /if n @isle==31 /call walkpath 31b 10 
   /if n @isle==32 /call walkpath 32b 10 
   /return 

sub sellitem(item)
	/call walkpath merch 10 
	/target "Merchant Tekram" 
	/face 
	/delay 10 
	/click right target 
	:tryitagain
	/delay 20 
	/selectitem "@item" self 
	/delay 1s
	/if "$selecteditem()"=="@item" {
		/sendkey down shift 
		/click left merchant sell 
		/sendkey up shift 
	} else {
		/goto :tryitagain
	}
	/delay 20 
	/click left merchant done 
	/call walkpath merchb 10 
/return

sub buyitem(item) 
	/declare wrongbuyer local
	/varset wrongbuyer 1
	/if @wrongbuyer>=5 {
		/goto :mainloop
	}
	:buyitagain
	/selectitem "@item" merchant	
	/if "$selecteditem()"=="@item" {
		/sendkey down shift
		/click left merchant buy 
		/sendkey up shift
	} else {
	/delay 2s
	/varadd wrongbuyer 1
	/varset wrongbuyer $int(@wrongbuyer)
	/goto :buyitagain
	}
	/delay 20 
	/click left merchant done 
/return 

Sub walkpath 
    |Initialization 
    
    |Note -- Edit the following line to represent the full path where you want your Paths.ini file 
    |        to be stored. Like: "c:\macroquest\macros\data\Paths.ini" 
    /declare gINIFile local 
    /declare gPathNumber local 
    /declare gStartPoint local 
    /declare gEndPoint local 
    /declare gStep local 
    /declare gThreshold local 
    /declare tEchoTimer timer 
    /declare l0 local 
    /declare l1 local 
    /declare l2 local 
    /declare l3 local 
    /declare pointface local 

    /declare MyXLOC local 
    /declare MyYLOC local 
    /declare ObstCount local    

    /varset gINIFile "path.ini" 
    
    /varset gPathNumber @Param0 
    
    /varset gThreshold @Param1 
    /varset gStartPoint @Param2 
    /varset gEndPoint @Param3 
    /varset pointface 0 
    
    /if @gThreshold=="" { 
        /echo No Threshold specified -- using 3. 
        /varset gThreshold 2 
    } 
    
    /if n @gStartPoint==0 { 
        /varset gStartPoint 1 
        /varset gEndPoint $int($ini("@gINIFile","@gPathNumber","numpoints")) 
    } 
    
    /if n @gStartPoint==-1 { 
        /varset gEndPoint 1 
        /varset gStartPoint $int($ini("@gINIFile","@gPathNumber","numpoints")) 
    } 
    
    /varset l0 @gStartPoint 
    
    /if @gStartPoint<@gEndPoint { 
        /varset gStep 1 
    } else /if @gStartPoint>@gEndPoint { 
        /varset gStep -1 
    } 
    
    /varset l1 $int($ini("@gINIFile","@gPathNumber","$int(@l0) Y")) 
    /varset l2 $int($ini("@gINIFile","@gPathNumber","$int(@l0) X")) 

    /face loc @l1, @l2 

    /call AutoRun 1 
    
    :MainLoop 
         /varset l1 $int($ini("@gINIFile","@gPathNumber","$int(@l0) Y")) 
         /varset l2 $int($ini("@gINIFile","@gPathNumber","$int(@l0) X")) 

        
        /varset tEchoTimer 5 
        |/if @l0==@gStartPoint /echo $distance(@l1,@l2) 
        /varset MyXLOC $char(x) 
        /varset MyYLOC $char(y) 
        /varset ObstCount 0 
        :MainLoop2 
            /doevents 
            
            /if @tEchoTimer==0 { 
                /varset tEchoTimer 1s 
                |/echo $distance(@l1,@l2) 
            } 
            
            |The 'fast' paramater of the /face function prevents the command 
            |from smoothing out the turn, and instead immediately turns your 
            |character to face the specified direction. It is commented out here 
            |in favor of the smoothed /face, because it looks more natural and 
            |realistic. However, you will see problems with high-resolution paths 
            |(ie, paths in which the distances in between snapshots is very low) where 
            |your character will run in circles around points. There are two things 
            |you can do about this. The first is to increase the DistanceThreshold 
            |number that you pass when you start the script. The second is to uncomment 
            |the "/face fast nopredict" line, and comment the "/face nopredict" line. 
            |This will look a little less natural, but if you're using a high- 
            |resolution path in the first place, it really shouldn't matter. 
            
            |Another time where you might want to use /face fast is in dungeons or 
            |other tight areas where precision is important. 
            
            /face fast nopredict loc @l1, @l2 
            |/if n pointface<=1 /face loc @l1, @l2 
            /varadd pointface 1 
      
            /varadd ObstCount 1 
            /if n @ObstCount>=10 { 
               /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) { 
                  /sendkey up up 
                  /sendkey down down 
                  /if n $rand(99)>50 { 
                    /delay 1s 
                    /sendkey up down 
                    /sendkey down Right 
                    /delay 5 
                    /sendkey up Right 
                    /sendkey down up 
                    /delay 1s 
                    /sendkey up up 
                  } else { 
                    /delay 1s 
                    /sendkey up down 
                    /sendkey down left 
                    /delay 5 
                    /sendkey up left 
                    /sendkey down up 
                    /delay 1s 
                    /sendkey up up        
                  } 
                 /face loc @l1, @l2    
                 /call autorun 1 
                 /sendkey up Right 
                 /sendkey up Left 
                        
             } 
             /varset MyXLOC $char(x) 
             /varset MyYLOC $char(y) 
             /varset ObstCount 0 
         } 
            /if n $distance(@l1,@l2)>@gThreshold /goto :MainLoop2 
        
        |/echo Point @l0 Reached. 
        /varset pointface 0 
        /varset l0 $int($calc(@l0+@gStep)) 
        
        /if @l3==1 /goto :MainLoopExit 
        /if @l0==@gEndPoint /varset l3 1 
        
        /goto :MainLoop 
    
    :MainLoopExit 
    
    /call AutoRun 0 
    |/echo Destination reached. Exiting. 
/return 

Sub AutoRun 
   /if @Param0==1 /sendkey down up 
   /if @Param0==0 /sendkey up up 
/return 

Sub movetotarg(distance) 
  /declare MyXLOC local 
  /declare MyYLOC local 
  /declare ObstCount local 

  /varset MyXLOC $char(x) 
  /varset MyYLOC $char(y) 
  /varset ObstCount 0 
  /face 
  :mobloop 
  /if n $target(distance)>=@distance { 
    /call autorun 1 
    /face 
    /varadd ObstCount 1 
    /if n @ObstCount>=3 { 
      /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) { 
          /sendkey up up 
          /sendkey down down 
          /if n $rand(99)>50 { 
            /delay 1s 
            /sendkey up down 
            /sendkey down Right 
            /delay 5 
            /sendkey up Right 
            /sendkey down up 
            /delay 1s 
            /sendkey up up 
          } else { 
            /delay 1s 
            /sendkey up down 
            /sendkey down left 
            /delay 5 
            /sendkey up left 
            /sendkey down up 
            /delay 1s 
            /sendkey up up        
         } 
        
         /sendkey up down 
         /sendkey up Right 
         /sendkey up Left          
     } 
     /varset MyXLOC $char(x) 
     /varset MyYLOC $char(y) 
     /varset ObstCount 0 
    }  
    
  /goto :mobloop 
  } 
  /call autorun 0 
/return

Onezero
a ghoul
a ghoul
Posts: 95
Joined: Thu Jan 01, 2004 1:19 pm
Location: Normal, IL
Contact:

Post by Onezero » Fri Jan 02, 2004 3:25 am

I modified the code a tiny bit near the top so the user can specify if they want to use a different file than bazaar.ini when running the macro.

Code: Select all

#turbo

sub main(counter,bazfile)
/zapvars
/declare file global
/declare isle global
/declare l1 local
/declare traderid local
/declare price local

| Check for different bazaar file than default
/if $defined(bazfile)==false {
	/varset file bazaar.ini
} else {
	/varset file @bazfile
}
/echo Using file: @file

/if $defined(counter)==false {
/echo format /mac dumpsterdive <Variable  Number to Start At> ex. /mac dumpsterdive 1
/return
}
:mainloop

/if "$ini(@file,names,val@counter)"=="NOTFOUND" {
    /echo ---------------------------------------
    /echo ----------Starting Search Over---------
    /echo ---------------------------------------
    /echo Script has Ben running: $int($calc($running/60)) Minutes $calc($running%60) Seconds
    /delay 30s
    /varset counter 1
    /goto :mainloop
    }
/echo ======Searching for $ini(@file,names,val@counter) #@counter
/bzsrch race any class any $ini(@file,names,val@counter)

| is request done?
:loop
/if "$gm"=="TRUE" /endmacro
/delay 1
/if "$bazaar()"=="FALSE" /goto :loop

/if n $bazaar(count)==0 {
    /echo $ini(@file,names,val@counter) not found, continuing on...
    /varadd counter 1
    /varset counter $int(@counter)
    /goto :mainloop
} else {
    /echo Found $bazaar(count) items for sale.
}

/varset price $bazaar(0,price)
/varset traderid $bazaar(0,trader)


/if n $bazaar(count)>1 {
    /for l1 1 to $calc($bazaar(count)-1)
    	/if "$bazaar(@l1,name)"=="$ini(@file,names,val@counter)" {
        	/echo Item #@l1 price $bazaar(@l1,price)
        	/if n @price>$bazaar(@l1,price) {
        		/varset price $bazaar(@l1,price)
        		/varset traderid $bazaar(@l1,trader)
        	}
        }
    /next l1
}

/if "$bazaar(@l1,name)"=="$ini(@file,names,val@counter)" {
	/goto :itsok

} else {
/varadd counter 1
/varset counter $int(@counter)
/goto :mainloop
}
:itsok
/if n @price>=$ini(@file,prices,val@counter) {
    /varadd counter 1
    /varset counter $int(@counter)
    |/echo @counter
    /goto :mainloop
    }
|/echo targeting @traderid
/if n $char(cash)<@price {
	/echo YOU DONT HAVE ENOUGH MONEY FOR THIS ITEM!!!!! writing it to a log file and going to next item
	/ini "nomoney.ini" "$ini(@file,names,val@counter)" @price
	/varadd counter 1
	/varset counter $int(@counter)
	/goto :mainloop
}

/echo Going to Go make me $int($calc($calc(1-$calc(@price/$ini(@file,prices,val@counter)))*100))% profit!!
/target id @traderid
/face
/call traderisle $target(x) $target(y)
/call movetoisle @isle
/face
/call movetotarg 10
/click right target
/delay 20
/call buyitem "$ini(@file,names,val@counter)"
/call moveback @isle
/call sellitem "$ini(@file,names,val@counter)"
/goto :mainloop
/return


Sub movetoisle(isle)
   /if n @isle==61 /call walkpath 61 10
   /if n @isle==62 /call walkpath 62 10
   /if n @isle==81 /call walkpath 81 10
   /if n @isle==82 /call walkpath 82 10
   /if n @isle==91 /call walkpath 82 10
   /if n @isle==92 /call walkpath 92 10
   /if n @isle==51 /call walkpath 51 10
   /if n @isle==52 /call walkpath 52 10
   /if n @isle==21 /call walkpath 21 10
   /if n @isle==22 /call walkpath 22 10
   /if n @isle==31 /call walkpath 31 10
   /if n @isle==32 /call walkpath 32 10
   /return

Sub traderisle(xloc,yloc)
   /if n @xloc>95 /if n @xloc<129 /if n @yloc>-770 /if n @yloc<-589 /varset isle 61
   /if n @xloc<95 /if n @xloc>62 /if n @yloc>-770 /if n @yloc<-589 /varset isle 62
   /if n @xloc>-104 /if n @xloc<-72 /if n @yloc>-772 /if n @yloc<-590 /varset isle 81
   /if n @xloc<-104 /if n @xloc>-145 /if n @yloc>-772 /if n @yloc<-590 /varset isle 82
   /if n @xloc>-203 /if n @xloc<-171 /if n @yloc>-713 /if n @yloc<-527 /varset isle 91
   /if n @xloc<-203 /if n @xloc>-250 /if n @yloc>-713 /if n @yloc<-527 /varset isle 92
   /if n @xloc>-118 /if n @xloc<107 /if n @yloc<-541 /if n @yloc>-571 /varset isle 51
   /if n @xloc>-118 /if n @xloc<107 /if n @yloc>-541 /if n @yloc<-514 /varset isle 52
   /if n @xloc>95 /if n @xloc<129 /if n @yloc>-495 /if n @yloc<-296 /varset isle 21
   /if n @xloc<95 /if n @xloc>62 /if n @yloc>-495 /if n @yloc<-296 /varset isle 22
   /if n @xloc>-104 /if n @xloc<-72 /if n @yloc>-495 /if n @yloc<-296 /varset isle 31
   /if n @xloc<-104 /if n @xloc>-145 /if n @yloc>-495 /if n @yloc<-296 /varset isle 32

   /return


Sub moveback(isle)
   /if n @isle==61 /call walkpath 61b 10
   /if n @isle==62 /call walkpath 62b 10
   /if n @isle==81 /call walkpath 81b 10
   /if n @isle==82 /call walkpath 82b 10
   /if n @isle==91 /call walkpath 82b 10
   /if n @isle==92 /call walkpath 92b 10
   /if n @isle==51 /call walkpath 51b 10
   /if n @isle==52 /call walkpath 52b 10
   /if n @isle==21 /call walkpath 21b 10
   /if n @isle==22 /call walkpath 22b 10
   /if n @isle==31 /call walkpath 31b 10
   /if n @isle==32 /call walkpath 32b 10
   /return

sub sellitem(item)
	/call walkpath merch 10
	/target "Merchant Tekram"
	/face
	/delay 10
	/click right target
	:tryitagain
	/delay 20
	/selectitem "@item" self
	/delay 1s
	/if "$selecteditem()"=="@item" {
		/sendkey down shift
		/click left merchant sell
		/sendkey up shift
	} else {
		/goto :tryitagain
	}
	/delay 20
	/click left merchant done
	/call walkpath merchb 10
/return

sub buyitem(item)
	/declare wrongbuyer local
	/varset wrongbuyer 1
	/if @wrongbuyer>=5 {
		/goto :mainloop
	}
	:buyitagain
	/selectitem "@item" merchant
	/if "$selecteditem()"=="@item" {
		/sendkey down shift
		/click left merchant buy
		/sendkey up shift
	} else {
	/delay 2s
	/varadd wrongbuyer 1
	/varset wrongbuyer $int(@wrongbuyer)
	/goto :buyitagain
	}
	/delay 20
	/click left merchant done
/return

Sub walkpath
    |Initialization

    |Note -- Edit the following line to represent the full path where you want your Paths.ini file
    |        to be stored. Like: "c:\macroquest\macros\data\Paths.ini"
    /declare gINIFile local
    /declare gPathNumber local
    /declare gStartPoint local
    /declare gEndPoint local
    /declare gStep local
    /declare gThreshold local
    /declare tEchoTimer timer
    /declare l0 local
    /declare l1 local
    /declare l2 local
    /declare l3 local
    /declare pointface local

    /declare MyXLOC local
    /declare MyYLOC local
    /declare ObstCount local

    /varset gINIFile "path.ini"

    /varset gPathNumber @Param0

    /varset gThreshold @Param1
    /varset gStartPoint @Param2
    /varset gEndPoint @Param3
    /varset pointface 0

    /if @gThreshold=="" {
        /echo No Threshold specified -- using 3.
        /varset gThreshold 2
    }

    /if n @gStartPoint==0 {
        /varset gStartPoint 1
        /varset gEndPoint $int($ini("@gINIFile","@gPathNumber","numpoints"))
    }

    /if n @gStartPoint==-1 {
        /varset gEndPoint 1
        /varset gStartPoint $int($ini("@gINIFile","@gPathNumber","numpoints"))
    }

    /varset l0 @gStartPoint

    /if @gStartPoint<@gEndPoint {
        /varset gStep 1
    } else /if @gStartPoint>@gEndPoint {
        /varset gStep -1
    }

    /varset l1 $int($ini("@gINIFile","@gPathNumber","$int(@l0) Y"))
    /varset l2 $int($ini("@gINIFile","@gPathNumber","$int(@l0) X"))

    /face loc @l1, @l2

    /call AutoRun 1

    :MainLoop
         /varset l1 $int($ini("@gINIFile","@gPathNumber","$int(@l0) Y"))
         /varset l2 $int($ini("@gINIFile","@gPathNumber","$int(@l0) X"))


        /varset tEchoTimer 5
        |/if @l0==@gStartPoint /echo $distance(@l1,@l2)
        /varset MyXLOC $char(x)
        /varset MyYLOC $char(y)
        /varset ObstCount 0
        :MainLoop2
            /doevents

            /if @tEchoTimer==0 {
                /varset tEchoTimer 1s
                |/echo $distance(@l1,@l2)
            }

            |The 'fast' paramater of the /face function prevents the command
            |from smoothing out the turn, and instead immediately turns your
            |character to face the specified direction. It is commented out here
            |in favor of the smoothed /face, because it looks more natural and
            |realistic. However, you will see problems with high-resolution paths
            |(ie, paths in which the distances in between snapshots is very low) where
            |your character will run in circles around points. There are two things
            |you can do about this. The first is to increase the DistanceThreshold
            |number that you pass when you start the script. The second is to uncomment
            |the "/face fast nopredict" line, and comment the "/face nopredict" line.
            |This will look a little less natural, but if you're using a high-
            |resolution path in the first place, it really shouldn't matter.

            |Another time where you might want to use /face fast is in dungeons or
            |other tight areas where precision is important.

            /face fast nopredict loc @l1, @l2
            |/if n pointface<=1 /face loc @l1, @l2
            /varadd pointface 1

            /varadd ObstCount 1
            /if n @ObstCount>=10 {
               /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) {
                  /sendkey up up
                  /sendkey down down
                  /if n $rand(99)>50 {
                    /delay 1s
                    /sendkey up down
                    /sendkey down Right
                    /delay 5
                    /sendkey up Right
                    /sendkey down up
                    /delay 1s
                    /sendkey up up
                  } else {
                    /delay 1s
                    /sendkey up down
                    /sendkey down left
                    /delay 5
                    /sendkey up left
                    /sendkey down up
                    /delay 1s
                    /sendkey up up
                  }
                 /face loc @l1, @l2
                 /call autorun 1
                 /sendkey up Right
                 /sendkey up Left

             }
             /varset MyXLOC $char(x)
             /varset MyYLOC $char(y)
             /varset ObstCount 0
         }
            /if n $distance(@l1,@l2)>@gThreshold /goto :MainLoop2

        |/echo Point @l0 Reached.
        /varset pointface 0
        /varset l0 $int($calc(@l0+@gStep))

        /if @l3==1 /goto :MainLoopExit
        /if @l0==@gEndPoint /varset l3 1

        /goto :MainLoop

    :MainLoopExit

    /call AutoRun 0
    |/echo Destination reached. Exiting.
/return

Sub AutoRun
   /if @Param0==1 /sendkey down up
   /if @Param0==0 /sendkey up up
/return

Sub movetotarg(distance)
  /declare MyXLOC local
  /declare MyYLOC local
  /declare ObstCount local

  /varset MyXLOC $char(x)
  /varset MyYLOC $char(y)
  /varset ObstCount 0
  /face
  :mobloop
  /if n $target(distance)>=@distance {
    /call autorun 1
    /face
    /varadd ObstCount 1
    /if n @ObstCount>=3 {
      /if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) {
          /sendkey up up
          /sendkey down down
          /if n $rand(99)>50 {
            /delay 1s
            /sendkey up down
            /sendkey down Right
            /delay 5
            /sendkey up Right
            /sendkey down up
            /delay 1s
            /sendkey up up
          } else {
            /delay 1s
            /sendkey up down
            /sendkey down left
            /delay 5
            /sendkey up left
            /sendkey down up
            /delay 1s
            /sendkey up up
         }

         /sendkey up down
         /sendkey up Right
         /sendkey up Left
     }
     /varset MyXLOC $char(x)
     /varset MyYLOC $char(y)
     /varset ObstCount 0
    }

  /goto :mobloop
  }
  /call autorun 0
/return
.[b].[/b]:[b]:[/b] Onezero
"[i]Health is merely the slowest rate at which you can die.[/i]"

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Fri Jan 02, 2004 3:58 pm

Nice to see you guys working on my little project. I am on christmas break and kinda fell behind in the going on in MQ since well I dont really have a computer right now. When I get back I will plya with it a bit more, I got some cool ideas for movement.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Fri Jan 02, 2004 3:58 pm

Nice to see you guys working on my little project. I am on christmas break and kinda fell behind in the going on in MQ since well I dont really have a computer right now. When I get back I will plya with it a bit more, I got some cool ideas for movement.

listmon
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Jan 20, 2004 10:45 pm

hey all

Post by listmon » Tue Jan 20, 2004 10:46 pm

This is my first post on this board, and Ive been trying to learn all that I can about the macroquest program =) anyway, I like this bazaar script, but (im still very new) I dont know what to cross out so that I just buy the item from traders, and not sell them to merchants (I basically am looking to find some equipment cheap for my main)

could anyone help me?

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Wed Jan 21, 2004 9:32 am

Ive been trying to learn all that I can about the macroquest program
My first suggestion is to read the entirity of a thread prior to posting on it.
I dont know what to cross out so that I just buy the item from traders, and not sell them to merchants
BillyBumbler_01 said on page 3:
and commented out the sellback code
Just use his code posted or determine what he commented out.

Bob

listmon
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Jan 20, 2004 10:45 pm

found the post

Post by listmon » Wed Jan 21, 2004 10:21 am

ok I got the post, and Im going to try it tonight. However, Ive read all of the bazaar threads as well as the manual and got a little overwhelmed... I compiled macroquest and I know how to get it running etc, but what is the format of the .ini for this program? Im completely new =( how do I set an item to buy and it's price in the .ini?

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Wed Jan 21, 2004 10:25 am

what is the format of the .ini for this program
Page 1 ....

Code: Select all

[names] /this is where all the names of the items you will be looking for 
val1=words of poop 
val2=rune of crap 
val3=page of diareah 

/I could probably make it so you dont have to have the .00 after every item past 1 but...it doesnt bother me so I dont care/ 

[prices] /this is were you put the sell back value of the items above 
val1=1000 /sellback value of words of poo 1pp 
val2=3456 /sellback value of rune of crap 3pp 4gp 5sp 5cp 
val3=234 /sellback value of  rune of diareah 2gp 3sp 4cp 
Ive read all of the bazaar threads
You positive? cause its posted page 1.

Also, make sure you set the INI correctly in the mac. The INI can be anyname and go on any drive letter or the same directory as your mac using \<file_name>.ini

Code: Select all

/varset file C:\macroquest2\release\macros\newini.ini 
Bob

listmon
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Jan 20, 2004 10:45 pm

Post by listmon » Wed Jan 21, 2004 1:28 pm

thank you for your help bob. I understand how the .ini's work now ... I just wasn't sure what the code was for at the top of the first post (I actually stuck it in the macro itself <stupid me > )

I see that there's a place to stick [price] but it seems like the price is only for sellback value to merchants... therefore, where do I stick in the price at which I would like to buy the items?

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Wed Jan 21, 2004 1:37 pm

where do I stick in the price at which I would like to buy the items?
This is "really" a sell back script for buying low and selling at predetermined value to a merchant.

By default the macro wil buy anything LESS than what is in the INI file. Even by 1 copper.

Bob

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Sat Jan 24, 2004 2:23 pm

Odd, When I try to do this, when it does the bzsrch it just hangs instead f actually searching the bazaar.... Yes, I have the plugin loaded.

Puretone
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Jan 29, 2004 3:18 am

Post by Puretone » Fri Jan 30, 2004 6:38 pm

What this script needs is to check the price before actually buying an item.
Cause right now a macro that changes the item price in like 30 second intervals could make you a bundle. Get scanned at low price, buyer_bot starts making its way to you, meanwhile your macro changed to price from 1pp to 1k a piece, buyer_bot forks out 2k for a stack of spider silks. Whee!

AlphaBeta
a ghoul
a ghoul
Posts: 126
Joined: Sat Nov 09, 2002 12:35 am

getting an error

Post by AlphaBeta » Mon Feb 02, 2004 1:35 pm

I am getting an error and am not sure how to fix it :?

Code: Select all

/call movetotarg 10
seems to be the problem. Can anyone help as it can't be found.

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Mon Feb 02, 2004 1:41 pm

AlphaBeta,

Check out my post 3rd page 5 posts from the bottom.

I had to add an #include

The call is "calling" movetotarg inside of the INC

Bob