First Macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

mh79
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Apr 05, 2004 1:54 pm

First Macro

Post by mh79 » Mon Apr 05, 2004 1:58 pm

Hi this is my first ever bit of coding (based on someone elses casino)

basically I wanted to only give the npc one tolken at a time on the basis that giving 4 at a time could result in duplicate gold tickets... one being lost to lore (yeah I know the chances of this are phenominally slim) and also to go buy new tolkens when I ran out.... I'm not sure what's causing it but occassionally the macro doesn't seem to be autoinventorying properly


Code: Select all

Code: 

|MSN is maxheinze@hotmail.com

|USAGE: /macro casino 

Sub Main 
/declare l0 local 

    :Loop 
   /if "$cursor()"!="NULL" /goto :cursorclear
   /if n $count("Gold Ticket")>0 /endmacro 
   /sendkey down ctrl 
   /for l0 1 to 1
   /finditem "King's Court Token" 
   /if $find()==FALSE /goto :Done
   /delay 3
   /if n @l0==1 /click left target 
   /delay 3 
   /if n @l0>1 /click left npctrade cancel 
   /sendkey up ctrl 
   /delay 3 
   /click left npctrade give 
   /delay 3 
   /goto :Loop
    
    
   :Done 
   /sendkey up ctrl 
   /delay 5 
   /click left npctrade give 
   /end  

:Buymore
   /target Nayda
   /face fast
   /sendkey down Up
   /goto :loop1

    :loop1
   /if $target(distance)<10 /goto :continue
   /goto :loop1

    :continue
   /sendkey up Up
   /click right target
   /goto :purchase

    :purchase
   /buyitem 20
   /finditem "King's Court Token" 
   /if $find()==FALSE /goto :purchase
   /target Therin
   /face fast
   /sendkey down Up
   /goto :loop2

    :loop2
   /if $target(distance)<13 /goto :end
   /goto :loop2

    :end
   /sendkey up Up
   /goto :Loop
   
    :cursorclear 
   /autoinv 
   /delay 5 
   /if "$cursor()"!="NULL" /goto :cursorclear 
   /delay 5
   /goto :Loop 



any help'd be appreciated

mh79
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Apr 05, 2004 1:54 pm

Post by mh79 » Mon Apr 05, 2004 2:02 pm

bah worked out where i was going wrong the first loop should have ended with a goto cursorclear rather than looping back onto itself DOH!

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Mon Apr 05, 2004 4:54 pm

You may not want to post your email address in your macro.

Just a little tip.

:D