inclusive script, need help

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

inclusive script, need help

Post by Malachi » Sat Nov 23, 2002 3:11 pm

<edit>Macro is now posted later in this thread<edit>


Hi all, I'm working on an all-inclusive script (skill to xxx weight, then run to bank, come back, loop). Reason being that my little chanter gets burdened quite easily, and its occasionally possible to macro him so hard he can't move.

I've read the posts about pathing, and I think I have a basic idea how to path from my merchant to the bank, based on /locs.

I'm confused w/ the door command though. I see how to target the door, so I'm guessing autorun to it, and then and I'm guessing just send a $door(open) != 1 {/then OpenDoor

I think before writing the script I'll have to do a /door to find what it's called specifically before I try to target it in the script, unless there's something to target nearest door? that would make the most sense.

but....I don't really know how clicks work? Is there a simpler (native?) way to open the door?

I was going to make it automove to locs, but I think instead I'll have it face a series of NPC's to get to the bank. (falling in the water is the issue w/ just an autorun)

I intentionally did not say what skill or zone this is in because I know we're not supposed to post exploitable info.

So....I could use help on /door ...I've looked (still am looking) at the readme and in the sample macros about this....that's been a big help.

If you don't want to answer this here, PM's are fine. Thanks!

~Malachi
Last edited by Malachi on Mon Nov 25, 2002 12:33 pm, edited 1 time in total.
~Oh danny boy, the pipes the pipes are calling.~

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Update...

Post by Malachi » Sat Nov 23, 2002 6:13 pm

I have the script beta finished, however I will not post it w/o permission from board gods, as it makes it a little too easy to plat macro unattended.

If anyone is interested in helping me debug this script I would be indebted to you greatly. By debug I don't mean beta test, I mean you know what you're looking at and can seriously help me make this work. I don't want you to ask for it just so you can power macro unattended.

Thanks again folks...I sure hope someone wants to help.
Script:
casts a spell (buff, alliance, charisma, whatever)
power skills until 3000 gold acquired
moves to bank in same zone via specific /locs along the way.
checks for 2 open doors, if not open it opens them
converts gold to PP
keeps n pp for repurchacing supplies
moves back to vendor
checks again for doors, opens if necessary
loops
~Oh danny boy, the pipes the pipes are calling.~

macrotoon
a ghoul
a ghoul
Posts: 106
Joined: Wed Sep 18, 2002 4:38 pm

Post by macrotoon » Sat Nov 23, 2002 11:13 pm

why not have your character bind at the banker. then gate back. Wont work for non pure casters, but works wonders for the rest.

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

No one likes my thread, hehe.

Post by Malachi » Sun Nov 24, 2002 1:13 am

No one likes my thread.

Anyway, in response to your answer, this chanter is specifically NOT level 10. Why? in case he's running somewhere w/ a load of gear/money on him I don't have to mess with his corpse. :)

Anyhoo, I wouldn't mind sharing my script with anyone who wants to help w/ its development, my beta is already done. I wouldn't wanna limit it to casters....altho int/cha does that already sorta....

PS-In case anyone didn't know...improving faction from apprehensive to indifferent doesn't change what prices you get for items, assuming charisma is over like 140. My chanter is 160, and he gets the same prices for items whether faction is dubious/apprehensive/indifferent/amiable.

Additionally, bear filllets is 100% useless now. :) I checked it today, and now you lose 12p per stack. :)

~Malachi
~Oh danny boy, the pipes the pipes are calling.~

Ooka_Chokka
a lesser mummy
a lesser mummy
Posts: 63
Joined: Fri Nov 08, 2002 12:27 am

Post by Ooka_Chokka » Sun Nov 24, 2002 2:02 am

an easy fix would be to have your toon face the door, then
/sendkey down "u" or whatever the syntax is.
(havent had time to really do macro stuff lately, lotsa homework)

that should open the door just fine, and then do a check and whatnot to make sure that the door is open, then resume the movement part of the macro.
just a thought :) :shock: 8)

Mazuli
decaying skeleton
decaying skeleton
Posts: 2
Joined: Sun Nov 24, 2002 2:41 am

Post by Mazuli » Sun Nov 24, 2002 2:44 am

This is one of the few times I think clicking would work better than u. You can get a certain distance from the door and click in 1 area. If no go, try clicking another area. After a few clicks and checks, if the door still isn't open, then u should be used.

Just ideas though.

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Ahh, ok.

Post by Malachi » Sun Nov 24, 2002 10:47 am

I was trying to remember if there was an "action button" to open the door, thanks. I considered a /click left <coordinates>, but I'm unfamiliar w/ x/y locs on the screen for cursor position.

~Malachi
~Oh danny boy, the pipes the pipes are calling.~

Lurker_005
a lesser mummy
a lesser mummy
Posts: 51
Joined: Thu Oct 17, 2002 12:08 pm

Post by Lurker_005 » Sun Nov 24, 2002 12:14 pm

Someone else posted this before, not sure who.
Put this in your macroquest.ini file
/mousepos=/echo Your mouse is currently at $mouse(x),$mouse(y)

macrotoon
a ghoul
a ghoul
Posts: 106
Joined: Wed Sep 18, 2002 4:38 pm

Post by macrotoon » Sun Nov 24, 2002 5:46 pm

Facing the next direction or the door and pressing u works great. Just have the toon stop in front of the door and press U to open it.

I added something to sub gotoloc once

Code: Select all

Sub GotoLoc 
   /varset v91 $rand(5) 
   :GotoLocLoop 
      /face loc $p0 
      /if "$p1"=="u" /Press u 
      /call AutoRun 1 
   /if n $distance($p0)>$v91 /goto :GotoLocLoop 
   /call AutoRun 0 
/return 
I just noticed its in the new routines.mac

/call gotoloc (1223,323) u
this repeatedly presses u when heading to the next loc

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Here's the macro

Post by Malachi » Mon Nov 25, 2002 12:20 pm

This code is really bad...and it doesn't have very many /returns which I know will eventually cause it to crash....anyway. See the comments for info about how it's supposed to work.

It looks a lot prettier if you cut/paste to notepad.

This does NOT include the recommended changes for opening the door, just so ya all know.
~Malachi

Code: Select all

|cheesefiend.mac
|By Malachi
|
|Cheese routine stolen from Plazmic and L124RD
|spell section stolen from someones bear.mac
|autorun stolen from hunter.mac
|walk stolen from Macrokit
|bank routine stolen from bank.mac
|
|This code is awful probably doesn't work. All help is appreciated.
|It's very bloated and redundant as I'm *no* good at variables and associated logic
|It would probably run better split into about 5 files
|It's very likely you will get banned w/ this script.
|
|Get near Granger in SH. Decide if you want to cast a spell.
|There are several optional lines in this code:
|Do you want to cast a spell? (default yes)
|What gem slot is your spell in?
|How long does spell take to cast? (default 8 seconds)
|What is spell duration? (default 15m)
|How much money do you want to withdraw after banking? (default 15p)
|
|

#include routines.mac
#define Amount v75
|###################################################################################

sub Main
/varset t10 0


   /afk I'm power baking. Or I've fallen asleep at the keyboard.
   /filter skills none 
   /stand 
   /mqlog 
   /varcalc v50 $char(plat)*10+$char(gold) 
   /varset t0 3000 
   /varset t1 $p0 

   :StartLoop
   /if $char(gold) >= 3000 {
	/call BankThatPlat
	} /else :GetStarted

:GetStarted

   /call FindCombiner Mixing 
   /if $return==99 /return 
   /varset v80 $return 

   /target Granger 
   /if "$target()"=="FALSE" /goto :nogranger 
   /cleanup 
   :cleanuploop0 
    /if "$target()"=="TRUE" /goto :cleanuploop0 
   /click left auto 
   /click right inv $v80 

   /varset v39 0 
   /if "$cursor()"=="TRUE" /click left auto 
   :cleanpack 
   /if $pack($v80,empty)==FALSE /call CleanPack 
   /if n $v39==30 /goto :toofull 
   /varadd v39 1 
   /if $pack($v80,empty)==FALSE /goto :cleanpack 

   /if "$cursor()"=="TRUE" /click left auto 

   /face loc -100,1167 

   /sendkey down ctrl 
   /call MakeCheese2 
   /sendkey up ctrl 

   /if "$cursor()"=="TRUE" /click left auto 

   /call SellBuy 

   /if $t0==0 /call LogStats 

/goto :StartLoop 

:TooFull 
   /echo You are too full on stuff, aborting macro. 
   /mqlog You are too full on stuff, aborting macro 
   /call Logoff 
/return 


Sub CleanPack 
   /varcalc v2 $pack($v80,slots)-1 
   /sendkey down shift 
   /for v1 0 to $v2 
      /if "$item($v80,$v1)"=="NULL" /goto :skipclean 
      /click left pack $v80 $v1 
      :cleanwait0 
       /if "$cursor()"!="TRUE" /goto :cleanwait0 
      /click left auto 
      :cleanwait1 
       /if "$cursor()"=="TRUE" /goto :cleanwait1 
  :skipclean 
   /next v1 
   /sendkey up shift 
/return 

Sub MakeCheese 

   :MakeCheese 

      /finditem "Rennet" 
      /click left pack $v80 0 
      /delay 1 

      /finditem "Bottle of Milk" 
      /click left pack $v80 1 
      /delay 1 

      /finditem "Bottle of Milk" 
      /click left pack $v80 2 
      /delay 1 

      /finditem "Dairy Spoon" 
      /click left pack $v80 3 
      /delay 1 

      /if n $pack($v80,space)>0 /return 

      /click left pack $v80 combine 
      /for v1 1 to 75 
         /if "$cursor()"=="TRUE" /goto :AutoDropCheese 
         /delay 1 
      /next v1 

   /goto :MakeCheese 

   :AutoDropCheese 

      /if "$cursor(name)"=="Dairy Spoon" /goto :AutoDropSpoon 
      /click left auto 
      /delay 1 
      /if "$cursor()"=="TRUE" /goto :AutoDropCheese 

      :AutoDropSpoon 
      /click left auto 
      /if "$cursor()"=="TRUE" /goto :AutoDropSpoon 

   /goto :MakeCheese 

/return 

Sub MakeCheese2 

   :MakeCheese 

      /finditem "Rennet" 
       /if $find()==FALSE /return 
      :rennetwait0 
       /if "$cursor()"!="TRUE" /goto :rennetwait0 
      /click left pack $v80 0 
      :rennetwait1 
       /if "$cursor()"=="TRUE" /goto :rennetwait1 

      /finditem "Bottle of Milk" 
       /if $find()==FALSE /return 
      :milkwait0 
       /if "$cursor()"!="TRUE" /goto :milkwait0 
      /click left pack $v80 1 
      :milkwait1 
       /if "$cursor()"=="TRUE" /goto :milkwait1 

      /finditem "Bottle of Milk" 
       /if $find()==FALSE /return 
      :milkwait0 
       /if "$cursor()"!="TRUE" /goto :milkwait0 
      /click left pack $v80 2 
      :milkwait1 
       /if "$cursor()"=="TRUE" /goto :milkwait1 

      /finditem "Dairy Spoon" 
       /if $find()==FALSE /return 
      :spoonwait0 
       /if "$cursor()"!="TRUE" /goto :spoonwait0 
      /click left pack $v80 3 
      :spoonwait1 
       /if "$cursor()"=="TRUE" /goto :spoonwait1 

      /if n $pack($v80,space)>0 /return 

      /click left pack $v80 combine 
      :cheesewait 
       /if "$cursor()"=="TRUE" /goto :AutoDropCheese 
       /goto :cheesewait 

   /goto :MakeCheese 

   :AutoDropCheese 

      /if "$cursor(name)"=="Dairy Spoon" /goto :AutoDropSpoon 
      /click left auto 
      /goto :AutoDropCheese 

      :AutoDropSpoon 
      /click left auto 
      /if "$cursor()"=="TRUE" /goto :AutoDropSpoon 

   /goto :MakeCheese 

/return 


Sub SellBuy 
/if n $t1==0 /call CastCHA
   | Open merchant 
   /click left auto 
   /target Granger 
   /face 
   /press u 
   /varset v55 0 
   /doevents flush 
   :sellwait 
    /doevents 
    /if n $v55!=1 /goto :sellwait 

   /sendkey down shift 

   | Sell our cheese 
   :SellCheese 
      /finditem "Mature Cheese" 
      /if $find()==FALSE /goto :DoneSelling 
      /call buyitem 
   /goto :SellCheese 

   :DoneSelling 
   /varset v51 0 
   /finditem "Rennet" 
   /if $find()==TRUE /varset v51 1 
   /finditem "Bottle of Milk" 
   /if $find()==TRUE /if n $v80!=$find(pack) /goto :SkipMilk 

   | Buy Bottles of Milk 
   /click left merchant 9 
   /call buyitem 
   /call buyitem 
   /call buyitem 
   /call buyitem 

   | If we had Rennet left, buy extra milk 
   /if n $v51==0 /goto :SkipMilk 
   /call buyitem 
   :SkipMilk 

   | Buy Rennets 
   /click left merchant 10 
   /call buyitem 
   /call buyitem 

   /sendkey up shift 
   /cleanup 
   :cleanuploop1 
    /if "$target()"=="TRUE" /goto :cleanuploop1 

/return 


Sub LogStats 

   | Calc profit in gold 
   /varcalc v51 $char(plat)*10+$char(gold)-$v50 

   | calc plat/hr 
   /varcalc v52 $v51*360/$running 

   | Plat 
   /varcalc v53 $v51/10 

   | left over gold 
   /varcalc v54 $v51%10 

   /echo Profit: $v53.$v54pp, avg: $v52pp/hr 
   /mqlog Run time: $running sec, Profit: $v53.$v54pp, Average = $v52pp/hr 

   /varset t0 3000 

/return 

sub LogOff 
/sit 
/camp 
/afk 
/endmacro 
/return 

Sub BuyItem 
   /varcalc v98 $char(gold)*100+$char(silver)*10+$char(copper) 
   /click left merchant buy 
   :WaitBuy 
      /varcalc v97 $char(gold)*100+$char(silver)*10+$char(copper) 
   /if n $v98==$v97 /goto :WaitBuy 
/return 

Sub Event_Chat 
/if "$p0"=="say" /if "$p1"~~"Granger" /varset v55 1 
/return

|####################################################################################

Sub CastCHA

|If you want to cast a spell on yourself, then syntax is /target myself
|If you want to target NPC then syntax is /target Granger
/varset t10 0
   /target myself 
   /call Event_CastFizzle 
   :LoopFizzle 
      /doevents 
   /if n $t9>0 /goto :LoopFizzle
|This sets how long the spell lasts on target. If you want to up skill fast, let it cast
|every time, set timer to about 1 minute (/varset t1 1m), if you just want to let charisma
|or alliance ride for better prices, then set to spell duration.
   /varset t10 15m 
   /return 
|#####################################################################################
Sub Event_CastFizzle 
   /delay 5
   |Insert spell gem #, if spell gem is number 5, then /cast 5 
     /cast 1
   |Insert casting time for spell here, if 8 seconds, then 8s
   |I addvise adding an extra second or so for lag
     /varset t9 7s 
  /return
|#####################################################################################
Sub AutoRun2
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return
|#####################################################################################
Sub BankThatPlat
| Make sure everything is closed and reset. 
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl 

/doortarget FDOORSL304
/face door
/call AutoRun2 1
/delay 2
/call Autorun2 0
/if $door open == 1 {
	/call StartWalking
	}else {/call OpenDoor}
|#####################################################################################
Sub OpenDoor
|How the heck do I open the door?
/mouseto target
/click left
/call StartWalking 50 3 1
|#####################################################################################
Sub AtBank
/doortarget FMDOOR301
/if $door open == 1 {
	/call Bank
	}else{
	/mouseto target
	/click left
|The following number sets amount of PP to withdraw after banking so that you
|can continue to bake
	/call Bank 15
|#####################################################################################
Sub StartWalking
 /varset a(50,0) 142,1778 
 /varset a(50,1) 86,1770
 /varset a(50,2) 51,1176
 /if n $a(5,1)==1 {
  /face loc $a($a(5,0),$a(5,2))
  /varset p0 $a(5,2)
 } else {
  /face loc $a($a(5,0),0)
 /varset p0 0
 }
 /sendkey down up
 :WalkBigLoop
  /varset a(5,3) $rand(5)
  :WalkLoop
   /face loc $a($a(5,0),$p0)
   /doevents
   /if n $distance($a($a(5,0),$p0))>$a(5,3) /goto :WalkLoop
 /if "$a(5,1)"=="1" {
  /varsub p0 1
 } else {
  /varadd p0 1
 }
 /if n $p0!=$calc($a(5,2)+1) /if n $p0!=-1 /goto :WalkBigLoop
 /sendkey up up
/goto AtBank
|########################################################################################
Sub Bank
   /varcalc Amount $char(plat)+$char(gold)/10+$char(silver)/100+$char(copper)/1000 
   /varcalc v1 $p0 
   /varcalc v2 $p0-1 
   /varcalc v3 $char(plat,bank) - $p0 
   /sendkey down shift 

   /if $p1~~"nd" /goto :Withdrawl 

   :Plat 
      /if n $char(plat)==0 /goto :Gold 
      /click left plat 
      /click left bank plat 

   :Gold 
      /if n $char(gold)==0 /goto :Silver 
      /click left gold 
      /click left bank gold 

   :Silver 
      /if n $char(silver)==0 /goto :Copper 
      /click left silver 
      /click left bank silver 

   :Copper 
      /if n $char(copper)==0 /goto :ConvertCP 
      /click left copper 
      /click left bank copper 

   :ConvertCP 
      /if n $char(copper,bank)==0 /goto :ConvertSP 
      /click left bank copper 
      /click left bank silver 
      /click left bank copper 

   :ConvertSP 
      /if n $char(silver,bank)==0 /goto :ConvertGP 
      /click left bank silver 
      /click left bank gold 
      /click left bank silver 

   :ConvertGP 
      /if n $char(gold,bank)==0 /goto :Done 
      /click left bank gold 
      /click left bank plat 
      /click left bank gold 

   :Withdrawl 
      /if $v2==-1.00 /goto :Done 
      
      /for v5 0 to $v2 
          /if $v5==2001 { 
              /goto :Withdrawl2 
           } 
      /next v5 

      || Method 1 -- for withdrawls of 1-2000pp 
      /sendkey down ctrl 
      /for v6 0 to $v2 
          /click left bank plat 
          /click left auto 
      /next v6 
      /sendkey up ctrl 
      /goto :Done 

   :Withdrawl2      
      /sendkey up shift 
      
      || Method 2 -- for withdrawls of more than 2000pp 
      /echo Performing Withdrawl.  This may take some time. 
      /mouseto bank plat 
      /click left 
      /mouseto + 23 +45 
      /delay 20 
      /for v4 1 to $v3 
         /delay 0 
         /click left 
      /next v4 
      /mouseto + 66 -22 
      /delay 20 
      /click left 
      /delay 5 
      /click left auto 


   :Done 
   /sendkey up shift 

   /if $p1~~"nd" { 
      /echo Withdrawn: $v1pp 
   } else /if $v2==-1.00 { 
      /echo Deposited: $Amountpp 
   } else { 
      /echo Deposited: $Amountpp     ++     Withdrawn: $v6pp 
   } 
/goto BackToBaking
|##############################################################################
sub BackToBaking
| Make sure everything is closed and reset. 
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
/face door
/call AutoRun2 1
/delay 2
/call Autorun2 0
/if $door open == 1 {
	/call StartWalking2 50 3 0
	}else {/call OpenDoor2}
|##############################################################################
sub StartWalking 2
 /varset a(50,0) 142,1778 
 /varset a(50,1) 86,1770
 /varset a(50,2) 51,1176
 /if n $a(5,1)==1 {
  /face loc $a($a(5,0),$a(5,2))
  /varset p0 $a(5,2)
 } else {
  /face loc $a($a(5,0),0)
 /varset p0 0
 }
 /sendkey down up
 :WalkBigLoop
  /varset a(5,3) $rand(5)
  :WalkLoop
   /face loc $a($a(5,0),$p0)
   /doevents
   /if n $distance($a($a(5,0),$p0))>$a(5,3) /goto :WalkLoop
 /if "$a(5,1)"=="1" {
  /varsub p0 1
 } else {
  /varadd p0 1
 }
 /if n $p0!=$calc($a(5,2)+1) /if n $p0!=-1 /goto :WalkBigLoop
 /sendkey up up
/goto AtGranger
|###########################################################################
sub OpenDoor 2
|How the heck do I open the door?
/mouseto target
/click left
/call StartWalking 50 3 0
/goto AtGranger
|############################################################################
sub AtGranger
/doortarget FDOORSL304
/face door
/if $door open == 1 {
	/call MovetoMerch}
	else{ /mouseto target
		/click left
		/call MovetoMerch
|############################################################################
sub MovetoMerch
/target Granger
/call AutoRun2 1
/delay 2
/call Autorun2 0
/goto :GetStarted
~Oh danny boy, the pipes the pipes are calling.~

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Mon Nov 25, 2002 1:09 pm

wow, so much for not posting it because of it being exploitable, eh?

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

hehe

Post by Malachi » Mon Nov 25, 2002 9:28 pm

I sort of changed my mind. besides, ol' rizwank...or someone said macros including selling/buying were legit...I dunno. They'll delete it if they don't like it.

I was tired of waiting for someone to want to help w/ it, hehe.

~Malachi
~Oh danny boy, the pipes the pipes are calling.~

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Tue Nov 26, 2002 12:21 am

I believe rizwank was referring to skill-up macros, not macros intended for making money... oh well, I suppose if he doesn't like this, he can edit it out and lock the topic

Zorg
a lesser mummy
a lesser mummy
Posts: 44
Joined: Fri Oct 18, 2002 7:01 pm

Post by Zorg » Tue Nov 26, 2002 4:42 am

Considering VI has gotten rid of all of the tradeskill combines where you could make plat, I don't think this is a problem anymore.

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

Incorrect, good sir.

Post by Malachi » Tue Nov 26, 2002 10:20 am

Considering VI has gotten rid of all of the tradeskill combines where you could make plat, I don't think this is a problem anymore.
Sorry good sir, you are incorrect. I've been making 120pp/hour w/ my mule while I sleep for the last several nights.

~Malachi

oops. No, I don't macro afk.[/quote]
~Oh danny boy, the pipes the pipes are calling.~