Advanced Casino Spender .mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

zoobish
a lesser mummy
a lesser mummy
Posts: 40
Joined: Tue Apr 18, 2006 6:59 am

Advanced Casino Spender .mac

Post by zoobish » Sat May 26, 2007 11:16 am

Well, I posted one script, I'll post this other...

History: When I first joined, I noticed the casino script. "YEAH", I thought...

But yah needed to buy a heap of tokens first, then it just stood there and gambled... yay...

I got bored too...

INTRODUCING advCASINO.MAC v1.0

You set how much pp you want to spend, how many tokens you want on you Max, and maybe set some items you want destroyed, then run it...

ENTERTAINMENT PLUS !!!
Watch as your toon gets pp from the bank, buys tokens, then gambles them all away!!! If you win a GOLD TICKET it will stop and alert.

FUN FUN FUN !!!

Modified: 28-May-2007 = Now correctly selects the token in the merchant window.

Code: Select all

|***************************************************************|
| advCasino.mac v1.1                                            |
|                                                               |
| Made coz I was bored, much the same reason as the original    |
|  casino money waster.                                         |
| I made this also to learn some of the targeting, and methods  |
|  for windows, such as trade and inventory manipulation =)     |
|                                                               |
| Start in the casino room =) everything is there...            |
|                                                               |
| The only variables you will want to change are the CASINO_NPC,|
|  and PP_TO_PLAY, set that to the amount you want to gamble =) |
| CASINO_NPC is set to Tirac Goldbender, the enc, nec, wiz,     |
|  mage casino dude.  You may want to change MAX_PP_HELD, this  |
|  controls how much you get out of the bank at one time =))    |
| You can change things to trash in the CheckPrize Sub...       |
| Enjoy...                                                      |
|                                                               |
| by zoobish                                                    |
|***************************************************************|


#turbo

Sub Main
	| Declares, set CASINO_NPC, should be all u have to do =)
	/declare CASINO_NPC string outer Tirac Goldbender
	/declare TOKEN_NPC string outer Nayda Winterwind
	/declare BANKER_NPC string outer Yeren Ironback
	/declare PP_TO_PLAY int outer 50000
	/declare MAX_PP_HELD int outer 10000
	/declare MAX_TOKENS_HELD int outer  40
	/declare CURRENT_PP int outer
	/declare PLAY_COUNT int outer 0
	/declare FOUND_TOKEN int outer 0
	/declare dupe int outer

	/echo Starting MyCasino.mac... Enjoy =)

	| First find how much pp you have on you...
	/varcalc CURRENT_PP ${Me.Platinum}
	/varcalc dupe ${CURRENT_PP}+${Me.PlatinumBank}+${Me.PlatinumShared}
	/if (${dupe}<${PP_TO_PLAY})  {
		/echo *******   ALERT   *******
		/echo  You don't have enough 
		/echo  plat to play, please  
		/echo  adjust script variable
		/echo  PP_TO_PLAY to the plat
		/echo  available to you =//  
		/echo ******  END ALERT  ******
		/endmacro
	}
	/varcalc dupe ${dupe}-${PP_TO_PLAY}
	/echo You will have ${dupe} plat left after this is done.
	/varcalc PP_TO_PLAY ${PP_TO_PLAY}-${CURRENT_PP}

	| The main loop...
	:Start
		/call CheckPP
		/call BuyTokens
		/call Gamble
	|	/call IsFinished
	|	/if ( ${Macro.Return} ) /goto :Done
		/if ( ${PP_TO_PLAY}<100 ) /goto :Done
	/goto :Start

	:Done
	/echo DONE
	/endmacro

/return


Sub CheckPrize
	| Looks at the prize, trashes if no good =), Dont have to 
	| put in full name if trash item, just a part.
	| Add "BAD" items here to be trashed, follow the pattern =) 
	| Make sure u adjust total number in array
	/declare i int local
	/declare BAD[4] string local
	/varset BAD[1] Bread
	/varset BAD[2] Gnomish Firework
	/varset BAD[3] Crushed
	/varset BAD[4] Flawed


	/declare flag int local
	:START
	/varset flag 0
	/for i 1 to ${BAD.Size}
		/if ( ${Cursor.Name.Find[${BAD[${i}]}]} )  /varset flag 1
	/next i
	/if ( ${Cursor.Name.Find[Ticket]} )  {
		/for i 1 to 10
			| WOOOT!!!
			/beep
			/delay 7
		/next i
		/echo YOU WON !!!!
		/echo YAY !!!!
		/endm
	}
	/if ( ${flag} ) {
		/echo destroying ${Cursor.Name}
		/destroy
	} else {
		/autoinv
	}
	/delay 3s ( ${Cursor.ID} )
	/if ( ${Cursor.ID} ) /goto :START
/return


Sub Gamble
	| Start Gambling!!
	/declare i int local
	/declare ToGamble int local 4
	/target ${CASINO_NPC}
	/face nolook
	/call MoveToTarget
	/call ToggleBags
	
	:Start
		/if ( ${FindItemCount[=King's Court Token]}<1 )  /goto :Done
		/for i 0 to 3
			/call PickUpToken
			/click left target
			/delay 2s ( !${Cursor.ID} )
			/varcalc PLAY_COUNT ${PLAY_COUNT}+1
			/if ( ${FindItemCount[=King's Court Token]} == 0 ) /varset i 4
		/next i
		/delay 1s
		/notify GiveWnd GVW_Give_Button leftmouseup
		/delay 2s
		/call CheckPrize
	/goto :Start
	
	:Done
	/call ToggleBags
/return


Sub ToggleBags
	| Opens bags, or closes if already open...
	/declare i int local
	/for i 1 to 8
		/itemnotify pack${i} rightmouseup
	/next i
/return


Sub PickUpToken
	/ctrl /itemnotify ${FindItem[=King's Court Token].InvSlot} leftmouseup
	/delay 1s ( ${Cursor.ID} )
/return
	


Sub BuyTokens
	| Buys one lot of tokens
	/if ( ${FindItemCount[=King's Court Token]}>${MAX_TOKENS_HELD} ) /return
	/declare NumBuys int local
	/varcalc NumBuys ${MAX_TOKENS_HELD}-${FindItemCount[=King's Court Token]}
	/if ( ${Math.Calc[${NumBuys}*100]}>${CURRENT_PP} )  /varcalc NumBuys ${CURRENT_PP}/100
	/declare NumBought int local ${NumBuys} 
	/target ${TOKEN_NPC}
	/face nolook
	/call MoveToTarget
	/click right target
	/delay 3s
	/echo Buying ${NumBuys} tokens
	/notify MerchantWnd MW_ItemList listselect ${Window[MerchantWnd].Child[MW_ItemList].List[King's Court Token,2]}
	/notify MerchantWnd MW_ItemList leftmouse ${Window[MerchantWnd].Child[MW_ItemList].List[King's Court Token,2]}

	/delay 2s
	:START
		/if ( ${NumBuys}>20 ) {
			/shift /notify MerchantWnd MW_Buy_Button leftmouseup
			/delay 2s
			/varcalc NumBuys ${NumBuys}-20
		} else {
			/call GetQuantity MerchantWnd MW_Buy_Button ${NumBuys}
			/delay 2s
			/goto :END
		}
	/goto :START

	:END
	/varcalc CURRENT_PP ${CURRENT_PP}-(${NumBought}*100)
	/notify MerchantWnd MW_Done_Button leftmouseup

/return


Sub CheckPP
	| Goes to the bank if not enough for 1 lot of tokens
	/echo checking pp
	/declare need int local
	/varcalc need ${MAX_TOKENS_HELD}*100
	/if ( ${CURRENT_PP}<${need} )  /call GotoBank
/return

Sub GotoBank
	| Gets some pp from the bank
	/target ${BANKER_NPC}
	/call MoveToTarget
	/click right target
	/declare qty int local
	/varcalc qty ${MAX_PP_HELD}-${CURRENT_PP}
	/if ( ${qty} > ${PP_TO_PLAY} )  /varset qty ${PP_TO_PLAY}
	/call GetQuantity BigBankWnd BIGB_SharedMoney0 ${qty}
	/delay 2s ( ${Cursor.ID} )
	/autoinv
	/varcalc CURRENT_PP ${Me.Platinum}
	/varcalc PP_TO_PLAY ${PP_TO_PLAY}-${qty}
	/echo Left To Withdraw: ${PP_TO_PLAY}
	/notify BigBankWnd BIGB_DoneButton leftmouseup
/return

Sub GetQuantity(string Wnd, string Ctrl, int Count)
	/declare I int local 
	/declare J int local 
	/declare S string local 
	/echo in GetQuantity...
	/delay 1s
	/echo notifying ${Wnd} ${Ctrl} leftmouseup 
      /notify ${Wnd} ${Ctrl} leftmouseup 
      /delay 3s ( ${Window[QuantityWnd].Open} ) 

      /for I 1 to 2 
         /varset J ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length} 
         /if ( ${J} > 0 ) { 
            /keypress backspace chat 
            /delay 3s ( ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length} < ${J} ) 
            /varset I 1 
         } else { 
            /varset I 2 
         } 
      /next I 

      /varset S ${Count} 
      /for I 1 to ${S.Length} 
         /keypress ${S.Mid[${I},1]} chat 
         /delay 3s ( ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length} == ${I} ) 
      /next I 

	/delay 1s

      /nomodkey /notify QuantityWnd QTYW_Accept_Button leftmouseup 
      /delay 3s ( !${Window[QuantityWnd].Open} )


/return


Sub MoveToTarget
	| Moves to the current target
	/if (!${Target.ID})  /return
	:Move
		/face nolook
		/keypress forward hold
		/delay 5 ${Target.Distance}<18
		/if (${Target.Distance}<18)  {
			/keypress forward
			/face nolook
			/return
		}
	/goto :Move
/return
		
Have fun, waste some plats :twisted:
Last edited by zoobish on Mon May 28, 2007 4:41 am, edited 1 time in total.

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Re: Advanced Casino Spender .mac

Post by ieatacid » Sat May 26, 2007 2:03 pm

zoobish wrote: It is a lil dodgy because:

Code: Select all

/notify MerchantWnd MW_ItemList listselect ${Window[MerchantWnd].Child[MW_ItemList].List[King's Court Token,2]}
doesn't actually cause the item selected to be available to buy in the merchant window... don't figure. Somptin to do with actually clicking on the list box i suppose. Even if yah click the window first, then select the token, it still shows the item originally clicked in the MW_SelectedItem window...
Look here: http://macroquest2.com/phpBB2/viewtopic ... 322#125322

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sat May 26, 2007 2:06 pm

Wait, you can't look there. Perhaps here: http://macroquest2.com/phpBB2/viewtopic ... listselect

Look how it uses listselect.

zoobish
a lesser mummy
a lesser mummy
Posts: 40
Joined: Tue Apr 18, 2006 6:59 am

Post by zoobish » Sat May 26, 2007 9:08 pm

Ill try that, thanks =) Documentation don't mention that methos =)

Ahh, the secrets =P

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Sun May 27, 2007 10:18 am

Based on that:

Code: Select all

Sub BuyTokens
   | Buys one lot of tokens
   /declare KTokens local int 
   /if ( ${FindItemCount[=King's Court Token]}>${MAX_TOKENS_HELD} ) /return
   /declare NumBuys int local
   /varcalc NumBuys ${MAX_TOKENS_HELD}-${FindItemCount[=King's Court Token]}
   /if ( ${Math.Calc[${NumBuys}*100]}>${CURRENT_PP} )  /varcalc NumBuys ${CURRENT_PP}/100
   /declare NumBought int local ${NumBuys}
   /target ${TOKEN_NPC}
   /face nolook
   /call MoveToTarget
   /click right target
   /delay 5s
   /echo Buying ${NumBuys} tokens
   /varset KTokens ${Window[MerchantWnd].Child[ItemList].List[King's Court Token,2]} 
   /notify MerchantWnd ItemList listselect ${KTokens}
   /notify MerchantWnd ItemList leftmouse ${KTokens} 
   /delay 2s
.
.
.

zoobish
a lesser mummy
a lesser mummy
Posts: 40
Joined: Tue Apr 18, 2006 6:59 am

heh

Post by zoobish » Mon May 28, 2007 4:29 am

Based on that... I modified the original code in an edit...

Will now work as intended.

Hell, i should add some arguments...

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Advanced Casino Spender .mac

Post by xyilla » Wed Aug 13, 2025 1:39 am