casino.mac

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

Moderator: MacroQuest Developers

User avatar
FreQuency
a hill giant
a hill giant
Posts: 215
Joined: Tue Sep 23, 2003 6:03 pm

casino.mac

Post by FreQuency » Sun Mar 21, 2004 2:18 am

SHOULD be workign again

***last itm i write a macro at 2:30am revisions are buggy will fix them tomorrow
**original post had a logic flaw fixed untested though
Usage /macro casino
MUST have NPC you wish to trade with in range and targeted

Code: Select all

#event small_Prize "here is your small prize." 
#event no_Win "Lady Luck is not on your side today." 
#event medium_Win "Not a bad hand for you" 
#event illusion_Win "mask your appearance" 
#event good_Win "That is a good hand!" 
#event pretty_Good "That is a pretty good hand" 

Sub Main 
/declare lose global 
/declare smallPrize global
/declare mediumPrize global
/declare good global 
/declare prettyGood global 
/declare illusion global 
/declare unknowns global 

/declare tokensGiven local 
/declare TradeSlot local
/declare tokensWon global	
/declare CasinoNPC local 
/declare turnInsLeft local 
/declare delay local 
	/varset lose 0
   	/varset smallPrize 0    
   	/varset mediumPrize 0 
   	/varset good 0 
   	/varset prettyGood 0 
	/varset illusion 0 
	
	/varset tokensGiven 0 
   	/varset TradeSlot 0   	
   	/varset unknowns 0 
   	/varset tokensWon 0 
   	/varset CasinoNPC "$target(id) 
   	/varset turnInsLeft 0 
	/varset delay 2 
	
	/if @CasinoNPC=="NULL" {
   		/echo You need to target an NPC you wish to run the casino with
   		/endmacro 
	}

:Loop 
	/if n $count("King's Court Token")==0 /goto :Done 
        /if n $count("King's Court Token")>=4 /varset turnInsLeft 3 
        /if n $count("King's Court Token")<4 /varset turnInsLeft $calc($count("King's Court Token")-1) 
	/sendkey down ctrl 
	/for TradeSlot 0 to @turnInsLeft 
	:GetToken 
        	/sendkey down ctrl 
        	/if n $count("Gold Ticket")>0 /goto :Done 
        	/varadd tokensGiven 1 
        	/finditem "King's Court Token" 
        	/delay 1 
        	/if "$cursor(name)"!="King's Court Token" /goto :GetToken 
        	/sendkey up ctrl 
        	/if n @TradeSlot!=0 /click left npctrade @TradeSlot 
        	/delay @delay 
        	/target id @CasinoNPC 
        	/if n @TradeSlot==0 /click left target 
        	/delay @delay 
	/next TradeSlot 
   	/click left npctrade give 
   	/delay @delay 
   	/doevents 
:clearCursor 
	/if "$cursor(name)"=="King's Court Token" /varcalc tokensWon @tokensWon+$cursor(stack)
   	/autoinv 
   	/delay @delay 
   	/if $cursor()!="NULL" /goto :clearCursor 
/goto :Loop 
:Done 
/call Log "Tokens Played: $int(@tokensGiven)" 
/call Log "Wins: $int($calc(@tokensGiven-@lose))" 
/call Log "Small Stat Food: $int(@smallPrize)" 
/call Log "Medium Stat Food: $int(@mediumPrize)" 
/call Log "Gem: $int(@prettyGood)" 
/call Log "Large Item $int(@good)" 
/call Log "Illusion Potions: $int(@illusion)" 
/call Log "Tokens Won: $int(@tokensWon)" 
:BeepLooP
	/beep
	/goto :BeepLoop
/return 

Sub Event_no_Win 
   /varadd lose 1 
/return 

Sub Event_illusion_Win 
   /varadd illusion 1 
/return 

Sub Event_small_Prize 
   /varadd smallPrize 1 
/return 

Sub Event_medium_Prize 
   /varadd mediumPrize 1 
/return 

Sub Event_good_Win 
   /varadd good 1 
/return 

Sub Event_pretty_Good 
   /varadd prettyGood 1 
/return 

Sub Log 
   /mqlog "@Param0" 
   /echo "@Param0" 
/return
Last edited by FreQuency on Sun Mar 21, 2004 4:02 pm, edited 1 time in total.

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Sun Mar 21, 2004 3:32 am

Only problems I now see are the stats being a little muddled. Other than that, good mac. Now let's see if I can get it to stop on a golden ticket. ;-)
-Elric

Mental
orc pawn
orc pawn
Posts: 16
Joined: Mon Jun 02, 2003 5:55 pm

Post by Mental » Sun Mar 21, 2004 10:27 am

his code auto inventory's everything, then does an inventory check for a golden ticket, and ends the maco if one is found.

Very nice code, i like the stats counter. I have dropped over 200k trying for a ticket, wish I had this thing since the start :D

edit: bleh, now that I have ran it, there seems to be a problem with this line

Code: Select all

/if "$cursor(name)=="King's Court Token" /varset tokensWon $calc(@tokensWon+$cursor(stack))
Right after the hand in, it locks up and ends the macro