My jewelcrafting macro is (has trouble selecting gems)

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

Moderator: MacroQuest Developers

greggor
orc pawn
orc pawn
Posts: 28
Joined: Tue Jun 17, 2003 2:30 pm

My jewelcrafting macro is (has trouble selecting gems)

Post by greggor » Sun Sep 07, 2003 1:13 pm

I'm having some trouble selecting a gem for my Jewelcraft raising macro... I'm using a long series of if statements based on skill / trivial levels. For some reason it works fine up to silver bloodstone, but then quits selecting a gem. Any suggestions on this problem or input on the macro in general would be helpful :)




Here is the entire macro, the offending portion is under :skillcheck I would assume...

Thanks to all that inspired this and posted their ideas in macro depot to give me material to work with.




Code: Select all

|  jewelc.mac
|  by greggor (with alot of borrowed ideas)
|
|
|  based on
|  PowerArrows.mac 
|  Original by macrotoon 
|
|  Also contains parts from metalrings.mac Created by Wassup 
|
|  I hope you two don't hate me too much for what I did to your original code :)
|
|  Also probably contains parts from other macro and ideas generated from 
|  them that I have not forgotton the source.
|
|
| 1. Put your Jeweling kit in your FIRST inventory slot 
| 2. Target the merchant you wish to use but do not open merchant...
| 
| 
|   DO NOT AFK MACRO 
| 

#turbo 
#define DelayValue v40
#define curjewelskill v1 
#define LastFail v4 
#define LastSuc v5 
#define CombinerID v88 
#define curbar v7
#define curgem v9
#event ErrorCombine "You cannot combine these items in this container type!" 
#event FailedCombine "You lacked the skills to fashion the items together." 
#event SuccessCombine "You have fashioned the items together to create something new!" 
#event triv "You can no longer advance

Sub Main 
/varset DelayValue 1
/varset CombinerID 99 
/if "$pack(0,combine)"=="Jewelry Making" /varset CombinerID 0 
/if n $CombinerID==99 { 
   /echo The jewelry kit *MUST* be in the first inventory slot 
   /return 
   /endmacro 
   } 


:SkillCheck 

/varset curjewelskill $char(skill,"Jewelry making") 
/echo $curjewelskill
	/if n $curjewelskill<44 /varset curbar "Silver Bar"
	/if n $curjewelskill<119 /if n $curjewelskill>=45 /varset curbar "Electrum Bar"
	/if n $curjewelskill<199 /if n $curjewelskill>=119 /varset curbar "Gold Bar"

	/if n $curjewelskill<22 /if n $curjewelskill>=0 /varset curgem "hematite" 
	/if n $curjewelskill<26 /if n $curjewelskill>=22 /varset curgem "bloodstone"
	/if n $curjewelskill<28 /if n $curJewelskill>=26 /varset curgem "onyx"
	/if n $curJewelskill<30 /if n $curJewelskill>=28 /varset curgem "jasper"
	/if n $curJewelskill<32 /if n $curJewelskill>=30 /varset curgem "carnelian"
	/if n $curJewelskill<35 /if n $curJewelskill>=32 /varset curgem "amber"
	/if n $curJewelskill<40 /if n $curJewelskill>=35 /varset curgem "Jade"
	/if n $curJewelskill<42 /if n $curJewelskill>=40 /varset curgem "Pearl"
	/if n $curJewelskill<44 /if n $curJewelskill>=42 /varset curgem "topaz"

	/if n $curJewelskill<74 /if n $curJewelskill>=44 /varset curgem "Malachite"
	/if n $curJewelskill<82 /if n $curJewelskill>=74 /varset curgem "Hematite"
	/if n $curJewelskill<87 /if n $curJewelskill>=82 /varset curgem "bloodstone"
	/if n $curJewelskill<90 /if n $curJewelskill>=87 /varset curgem "onyx"
	/if n $curJewelskill<92 /if n $curJewelskill>=90 /varset curgem "jasper"
	/if n $curJewelskill<95 /if n $curJewelskill>=92 /varset curgem "carnelian" 
	/if n $curJewelskill<100 /if n $curJewelskill>=95 /varset curgem "amber"
	/if n $curJewelskill<106 /if n $curJewelskill>=100 /varset curgem "Jade"
	/if n $curJewelskill<108 /if n $curJewelskill>=106 /varset curgem "Pearl"
	/if n $curJewelskill<111 /if n $curJewelskill>=108 /varset curgem "topaz"
	/if n $curJewelskill<114 /if n $curJewelskill>=111 /varset curgem "Peridot"
	/if n $curJewelskill<116 /if n $curJewelskill>=114 /varset curgem "Emerald"
	/if n $curJewelskill<119 /if n $curJewelskill>116 /varset curgem "Opal"

	/if n $curJewelskill<146 /if n $curJewelskill>=119 /varset curgem "Malachite"
	/if n $curJewelskill<154 /if n $curJewelskill>=146 /varset curgem "Hematite"
	/if n $curJewelskill<159 /if n $curJewelskill>=154 /varset curgem "bloodstone"
	/if n $curJewelskill<162 /if n $curJewelskill>=159 /varset curgem "onyx"
	/if n $curJewelskill<164 /if n $curJewelskill>=162 /varset curgem "jasper"
	/if n $curJewelskill<167 /if n $curJewelskill>=164 /varset curgem "carnelian" 
	/if n $curJewelskill<172 /if n $curJewelskill>=167 /varset curgem "amber"
	/if n $curJewelskill<178 /if n $curJewelskill>=172 /varset curgem "Jade"
	/if n $curJewelskill<180 /if n $curJewelskill>=178 /varset curgem "Pearl"
	/if n $curJewelskill<183 /if n $curJewelskill>=180 /varset curgem "topaz"
	/if n $curJewelskill<186 /if n $curJewelskill>=183 /varset curgem "Peridot"
	/if n $curJewelskill<188 /if n $curJewelskill>=186 /varset curgem "Emerald"
	/if n $curJewelskill<191 /if n $curJewelskill>188 /varset curgem "Opal"
	/if n $curJewelskill<196 /if n $curJewelskill>191 /varset curgem "Fire Opal"
	/if n $curJewelskill<199 /if n $curJewelskill>191 /varset curgem "Star ruby"

/echo $curgem
/echo $curbar



/call makeitem

/if n $curJewelskill>=199 { 
   /echo Your skill cannot be increased more than 199 with this script If you wish to raise skill higher you can change the script to do so. 
   /cleanup 
   /endmacro 
   } 
/goto :SkillCheck 

Sub makeitem 
      /call BuyItemSingle "$curgem" 0 
      /call findbar 
      
      /call Makejewel 
      /call SellItem $curbar 
      /return 



Sub BuyitemSingle
      /press u
      /delay 20
      /if "$item($CombinerID,$p1,name)"=="$p0" /return 
      /selectitem "$p0" merchant 
      /delay 1 
      /sendkey up shift 
      /buyitem 1 
    :WaitBuy 
      /delay 1 
      /if "$item($CombinerID,$p1,name)"!="$p0" /goto :WaitBuy 
      /click left merchant done
      /delay 1
/return 

Sub Makejewel 
      /if $pack($CombinerID,closed)==TRUE { 
        /echo You *MUST* have your Jewelry kit open.. 
        /endmacro 
        } 

      /varset LastFail 0 
      /varset LastSuc 0 
      /click left pack $CombinerID combine 

      :WaitForCombine 
         /delay 1 
         /if $pack($CombinerID,empty)==FALSE /goto :WaitForCombine 

      /for v75 1 to 10 
         /delay 1 
         /doevents 
         /if n $LastFail==1 /return 
         /if $cursor()==TRUE /goto :PutAwayArrows 
      /next v75 

      :PutAwayArrows 
         /click left auto 
      :WaitDrop 
         /delay 1 
         /if $cursor()==TRUE /goto :WaitDrop 
      /return 



Sub SellItem 
   /doevents 
   /if n $LastFail==1 /return 
   /finditem similar "$curgem" 
   /for v75 1 to 10 
      /delay 1 
      /doevents 
      /if n $LastFail==1 /return 
      /if n $LastSuc==1 /goto :DoSellItem 
   /next v75 

   /if $getlasterror==FIND_NOTFOUND /return 
:DoSellItem 
  
   /sendkey down shift 
   /delay 1 
  | This check is to make sure the items actually landed in the inventory and not 
   | somewhere else. 
   /if "$item($CombinerID,0,name)"~~"$curgem" /click left merchant buy 
   | 
   | 

:WaitForSale 
   /if "$item($CombinerID,0,name)"~~"$curgem" { 
       /delay 1 
       |/echo $item($CombinerID,0,name) 
       /goto :WaitForSale 
       } 
   /sendkey up shift 
   /click left merchant done
/return 

Sub Event_ErrorCombine 
   /endmacro 
/return 

Sub Event_FailedCombine 
   /varset LastFail 1 
   |/echo Detected Fail 
/return 

Sub Event_SuccessCombine 
   /varset LastSuc 1 
   |/echo Detected Combine 
    /press u
   /delay 20
/return 


sub findbar
/sendkey down ctrl
   /finditem similar "$curbar" 
   /delay $DelayValue 
   /if $cursor()!=True /goto :EndIt 

   :ReClick1 
|Place Jewel 
   /click left pack 0 1 
   /delay $DelayValue 
   /if "$cursor(name)"~~"$curbar" /goto :ReClick1 
/sendkey up ctrl
/return

sub event_triv

/endmacro
/return








Thanks in advance for any help :)

edit: Valerian likes code brackets

Consilium
Contributing Member
Contributing Member
Posts: 100
Joined: Wed Oct 02, 2002 10:42 pm

thanks

Post by Consilium » Sun Sep 07, 2003 10:51 pm

Great macro I will start playing with it and see what I can do to help.
-SH
+Student
digitalsavior.com

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Possible cause ...

Post by MacroFiend » Mon Sep 08, 2003 10:49 am

Just from reading your macro ... I see one thing that could be your problem.

Code: Select all

   /if n $curjewelskill<26 /if n $curjewelskill>=22 /varset curgem "bloodstone" 
   /if n $curjewelskill<28 /if n $curJewelskill>=26 /varset curgem "onyx" 
   /if n $curJewelskill<30 /if n $curJewelskill>=28 /varset curgem "jasper" 
If you look at your variable names, for all the ones that work, you have $curjewelskill (all lower case) but on the line that stops working, you start having a mixed case version and every instance after that appears to be mixed case.

I haven't looked at the MQ code but in most higher-level languages, variables and commands are case sensative. Try making all your $curjewelskill the same and give it a shot.

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

Post by Valerian » Mon Sep 08, 2003 9:19 pm

good deduction. #defines are case-sensitive.

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Bars and gems on same vendor?

Post by SimpleMynd_01 » Thu Sep 11, 2003 8:10 am

Hey greggor... Where did you find a single vendor with both bars and all the gems?

-SimpleMynd

greggor
orc pawn
orc pawn
Posts: 28
Joined: Tue Jun 17, 2003 2:30 pm

Post by greggor » Sat Sep 13, 2003 1:17 pm

Wow I will try the case thing later this week I have to be out of town but that is a great catch on your part and I appreciate the info :) I think what happened there is I had one variable as curjewel and the other as curjewelskill... unfortunately this caused a conflict as the curjewelskill var was being halfway replaced by my other variable. So anyway I used find replace not thinking that if I didn't check the box it would replace curjewelskill with curgemskill and later went back and fixed the first few that I screwed up... Once I get it working I'll throw it up to all to use.

Consilium
Contributing Member
Contributing Member
Posts: 100
Joined: Wed Oct 02, 2002 10:42 pm

Re: Bars and gems on same vendor?

Post by Consilium » Thu Sep 18, 2003 12:18 am

SimpleMynd_01 wrote:Hey greggor... Where did you find a single vendor with both bars and all the gems?

-SimpleMynd
As far as I can tell there are none.

You can check for yourself here...assuming that this is up to date...

http://www.eqtraders.com/sources/source ... 0080000000
-SH
+Student
digitalsavior.com

greggor
orc pawn
orc pawn
Posts: 28
Joined: Tue Jun 17, 2003 2:30 pm

Post by greggor » Fri Sep 19, 2003 12:20 pm

There is no single vendor that sells both to my knowledge, thats why the macro currently generates a ton of spam, opening and closing vendor for each combine, but it does it a a reasonably slow speed that you could probably do the clicking yourself, of course do not afk macro.