AlternateDefault

From CLUMP
Revision as of 12:51, 21 October 2024 by Mwadmin (talk | contribs) (→‎Code: updated Default)
Jump to navigationJump to search

Description

  • An alternate default which incorporates global variables so main items are set in this area vice being set in individual macro files - e.g. Sunstone.

Dependencies

Usage

  • Save code section into file called Default in your clanlord/data/macros folder.

Noteworthy techniques

  • Usage of SET function to set variables, on the fly while clanning without having to reload macros.
  • Usage of Global Variables to allow define once, use everywhere.
    • Avoids the hassle of editing macros to change an item to it's upgraded variant everywhere that item is referrred to.
  • All key/mouse actions defined centrally.
    • Requires called macro be defined in an included file.
    • Requires that no key/mouse actions be defined in any other file.
    • Makes it simple to figure out which keys you have not assigned yet.
  • Single scan/loop - to prevent conflicting never ending loops.
    • NOW INCLUDES: Raul's readtext trainer messages to prevent overlap.
  • Automatic idle startup.
    • Some things will still kill it, so to restart, reload macros (CTRL+R).
  • Moved all but global procedures out of default into dedicated files to clean up default and avoid the feeling that you are swimming through an encyclopedia.

Credits

  • DragonHawk - AwakeAFK
  • Gorvin - Shares
  • Inu - Random thank, single instance definitions, integration of various other macros into this Alternate Default, moving stuff not required for scanner/set global into their own dedicated file.
  • Kiriel D'Sol - Directions
  • Noivad - Moneycount, Omega_Zu, Quickchain, Sunstone, tc_macro,
  • Phineas - idle
  • Raul - Readtext (trainer messages)
  • Torin - Exilepicker

Code

/* escape sequences:
 	\\				backslash
 	\"				double quote"
 	\r				return
 	@name			your character name
 	@rplayer		selected player real name (with spaces) [NEW variable is @selplayer.name]
 	@splayer		selected player simple name (no spaces) [NEW variable is
 @selplayer.simple_name]
 checking if something is in something else
 >>> scanText.word[0] < "/"
 @env Variables			Variables with an @env prefix control how macros execute.
 @env.echo (true/false) 	After any \r in a macro, replace the text in the input box by the text that was sent?
 @env.debug (true/false)	Give extra information on macro loading and execution?
 @env.key_interrupts (true/false)
 Stop executing a macro when a key is pressed?
 @env.click_interrupts
 Stop executing a macro when you click in the game window (where clicks move your character)?
 
 
 @my.variables
 Variables with a @my prefix concern your character.
 @my.name		 	Your character's name.
 @my.simple_name	Your character's simple name (no spaces or punctuation)
 @my.[slot]_item	The name of the item in the slot named. (Torso, Legs, Shoulder, Neck)
 @my.right_item	the name of the item in your right hand
 @my.left_item		the name of the item in your left hand
 @my.forehead_item	the name of the item on your forehead
 @selplayer Variables	Variables with a @selplayer prefix refer to the selected character.
 @selplayer.name		Selected character's name.
 @selplayer.simple_name	Selected character's simple name (no spaces or punctuation)
 
 @click Variables	Variables with a @click prefix refer to the character clicked on to begin a click macro.
 @click.name		The clicked on character's name.
 @click.simple_name	The clicked on character's simple name (no spaces or punctuation)
 
 Miscellaneous Variables
 @text		The complete text in the typing box when the macro started.
 (minus the expression (trigger) of an expression macro)
 @textsel	The selected text in the typing box when the macro is started.
 @random	(no-repeat)	A number between 0 and 9999, randomly generated each time this variable is referenced. form: random…or…or…end random
 */
 
 include "armor.txt"
 include "creature-list.txt"
 include "DynamicShareCads"
 include "ethereal_functions.txt"
 include "funactions.txt"
 include "Karma_Idle.txt"
 include "KudzuLord-pop.txt"
 include "quickchain.txt"
 include "sacko_zu.txt"
 include "scanner.txt"
 include "rankcount.mac"
 include "Shares.txt"
 
 
 include "Storage.txt" //Geotzu's storage retrieval macro. works great!
 include "sunstone_messages.txt
 
 include "track_it.mac"
 include "WTB.txt"
 include "whatClass.txt"
 
 
 //***** Global Variables *****//
 
 set toggle 0 // use "toggle" to toggle things on or off
 set Fighter[1] "Noivad"
 set Fighter[2] "Beer"
 set Fighter[3] "Purrfect"
 set Healer[1] "Thoomilicious"
 set Healer[2] "Asklepios"
 "/login" call @login
 
 //Global Variables
 
 set modeVerbose 0
 
 set mStop 0
 
 set longsleep 1
 set messageStart 0
 set lsaveitem @my.left_item
 
 set rsaveitem @my.right_item
 
 set count 0
 
 set iAmAHealer 0
 set startup 1
 
 set toggle 0 // use "toggle" to toggle things on or off
 set ritem
 set defaultritem ""
 
 
 
 @login
 {
 call time_stamp_check
 pause 1
 call whoami
 pause 5
 call GoScan
 }
 
 time_stamp_check
 {
 set TextToCheck @env.textLog.word[0].letter[0]
 
 //message "text to check is: " TextToCheck
 
  if  TextToCheck > 0
 	 setglobal messageStart 2
 	 setglobal timestamps 1
 	 message "*time stamps are On"
  else
 	 message "*time stamps are off"
 	 setglobal messageStart 0
 	 setglobal timestamps 0
  end if
  message "type '/set ?' for optional settings"
  }
 
 
 "/whoami" call whoami
 
 whoami
 {
 if @my.simple_name == Healer[2]
 	setglobal iAmAHealer 2
 	setglobal healingDevice "Asklepian"
 	setglobal defaultritem "moonstone"
 	setglobal myWeapon "Roguewood club"
 	"/unequip @my.right_item\r"
 	"/equip " defaultritem "\r"
 	call RC_thoomi_setup
 	message "*Default:healmode:thoomi!*"
 else if @my.simple_name == Healer[1]
 	setglobal iAmAHealer 1
 	setglobal healingDevice "Asklepian Staff"
 	setglobal defaultritem "moonstone"
 	setglobal myWeapon "cutlas"
 	"/unequip @my.right_item\r"
 	call RC_thoomi_setup
 	message "*Default:healmode:thoomi!*"
 	"/equip " defaultritem "\r"
 else if @my.simple_name == Fighter[1]
 	setglobal iAmAHealer 0
 	setglobal defaultritem "gossamer"
 	setglobal myWeapon "gossamer"
 	"/unequip @my.right_item\r"
 	if @my.right_item != myWeapon
 		"/equip " myWeapon "\r"
 	end if
 	call RC_fighter_setup
 	 //call examinearmor
 else if @my.simple_name == Fighter[2]
 	setglobal iAmAHealer 0
 	setglobal defaultritem "Axe"
 	setglobal myWeapon "Axe"
 	"/unequip @my.right_item\r"
 	"/equip " myWeapon "\r"
 else if @my.simple_name == Fighter[3]
 	setglobal iAmAHealer 0
 	setglobal defaultritem "Bloodblade"
 	setglobal myWeapon "Bloodblade"
 	"/unequip @my.right_item\r"
 	"/equip " myWeapon "\r"
 	call RC_purr_setup
 end if
 
 message "*Default: right hand item set to a " defaultritem "."
 
 if iAmAHealer == 1
 	message "*healingDevice set to " healingDevice
 	call "RC_thoomi_setup"
 
 else if iAmHealer == 0
 	message "* Your Weapon of choice is a" myWeapon
 	call "RC_fighter_setup"
 end if
 message "welcome " @my.simple_name
 }
 
 command-f2
 {
 setglobal ritem @my.right_item
 message "ritem is: " ritem
 if ritem == "nothing"
 	"/equip " defaultritem "\r"
 
 else
 	setglobal rsaveitem ritem
 	"/unequip right\r"
 end if
 }
 
 "/eps"
 {
 setglobal ritem @my.right_item
 message "ritem is: " ritem
 if ritem != "EtherealPortalStone"
 	setglobal rsaveitem ritem
 	"/equip etherealportalstone \r"
 	if @text.word[0] == "check"
 		message ***EPS Ready***
 		goto end
 	end if
 
 end if
 "/use\r"
 label end
 }
 
 
 /* ***** QuickActions ***** */
 "??"    "/help "       @text "\r"
 "aa"    "/action "     @text "\r"
 "ex"	"excuse me\r"
 "gg"    "/give "       @text "\r"
 "ii"    "/info "       @text "\r"
 "kk"    "/karma "      @text "\r"
 "m"		"/money "   @text "\r"
 "mm"     "/money "      @text "\r"
 "nn"	"/narrate " @text "\r"
 "np"	"no problem\r"
 "pp"     "/ponder "     @text "\r"
 //"sh"     "/share "      @text "\r"  //removed for Shares.txt macro version
 "sl"     "/sleep "      @text "\r"
 "t"      "/think "      @text "\r"
 //"tt"     "/thinkto "    @text "\r" //removed for Scanner.txt version
 "th"     "/thank "      @text "\r"
 "uu"     "/use "        @text "\r"
 "un"     "/unshare "    @text "\r"
 "w"      "/who "        @text "\r"
 "wh"     "/whisper "    @text "\r"
 "yy"     "/yell "       @text "\r"
 "hehe"	call lol
 lol
 {
 if @my.name == "Purrfect"
 	"/action purrs " @text "\r"
 else
 	"/action laughs " @text "\r"
 end if
 }
 "heh"	call lol
 
 
 "/grats" call Grats
 Grats
 {
 set xNumber @random
 set xNumber % 20
 if xNumber < 5
 	set xNumber 6
 end if
 
 message "*Congratulations in " xNumber "/5 Seconds."
 pause xNumber
 
 random
 	"/think Excellent!, Congratulations\r"
 or
 	"/think Congrats!\r"
 or
 	"/think Good Job!\r"
 end random
 
 }
 
 /* ****** Push/Pull ***** */
 F2 "/push " @splayer "\r"
 //control-option-click	"/push " @click.name "\r"
 
 //* ***** QuickPoses ***** */
 home					"/pose angry \r"
 help					"/pose leanleft \r"
 pageup					"/pose akimbo\r"
 option-pageup 			"/pose celebrate\r"
 shift-option-pageup 	"/pose thoughtful\r"
 pagedown				"/pose seated \r"
 option-pagedown 		"/pose kneel\r"
 shift-option-pagedown 	"/pose bow \r"
 pageright					"/pose leanright\r"
 option-right 			"/pose walkright\r"
 command-right			"/pose leanright\r"
 shift-option-right		"/pose angry\r"
 pageleft					"/pose leanleft\r"
 command-left 			"/pose leanleft\r"
 option-left				"/pose surprise\r"
 shift-option-left 		"/pose walkleft \r"
 
 "sel"	"/select "  @text "\r"
 
 
 
 "u"	"/use "	 @text "\r"
 "ui"	"/useitem " @text "\r"
 "y"	"/yell "	@text "\r"
 "yh"	"/yell here! fallen \r"
 "uuu"		"/use " 	@splayer "\r"
 "uuuu" 		"/use " 	@splayer "\r"
 "unsh"		"/unshare " @splayer "\r"
 "wave"		"/action waves \r"
 "yawn"		"/action yawns.\r"
 "yybrb"		"/yell Be right back\r"
 "yye"		"/yell East\r"
 "yyn"		"/yell North\r"
 "yys"		"/yell South\r"
 "yyw"		"/yell West\r"
 "yret"		"/yell Retreat!\r"
 "yy>"		"/yell East>>>\r"
 "yy<"		"/yell <<<West\r"
 '>>>'		"East>>>"
 '<<<'		"<<<West"
 
 ArmUp
 {
 if @my.right_item != myWeapon
 	setglobal rItem @my.right_item
 	"/equip " myWeapon "\r"
 	"/options icon armed\r"
 end if
 }
 
 ArmDown
 {
 if @my.right_item == myWeapon
 	"/equip " rItem "\r"
 	"/options icon unarmed\r"
 end if
 }
 
 
 // modeVerbose is a global variable intended to be included in macros
 // that have actions attached to them. place a test reading:
 // "if modeVerbose == 1" before the actions
 
 //non-optimized to add: message Variable and call Instruction
 
 "/set"
 {
 
 if @text.word[0] == "?"
 
 	message "***The following variables are available to set using this command:"
 	pause 5
 	message "*verbose [0|1|?], longsleep [on|off|?]"
 	pause 5
 
 	message "*clock, bag [(number)], maxbag (number), wh(isper) [on|off], debug [on|1|off|0]"
 	pause 5
 	message "*feedback [on|1|off|0], tgn [number],* F1-2: pull/push, F5: chain "
 
 pause 5
 
 message "*[ranger] tr <name>,* escape: shieldstone, F4:heartwood,F11: sky bison "
 	message "***End Help***"
 
 else if @text.word[0] == "verbose"
 	if @text.word[1] == "?"
 		message "* This variable sets whether or not to associate an \"/action\" or \"/narrate\" with a macro."
 		pause 20
 		message "\"1\" is on, \"0\" is off."
 		if modeVerbose == 0
 			message "*Verbose mode is off."
 		else
 			message "*Verbose mode is on."
 		end if
 	else
 		if @text.word[1] == 1
 			setglobal modeVerbose @text.word[1]
 		else if @text.word[1] == 0
 			setglobal modeVerbose @text.word[1]
 		else if @text.word[1] == "on"
 			setglobal modeVerbose 1
 		else if @text.word[1] == "off"
 			setglobal modeVerbose 0
 		else
 			message "Error: Verbose Mode must be set to 0|off|1|on."
 			goto end
 		end if
 
 		if modeVerbose == "1"
 			message "*Verbose mode: On."
 		else if modeVerbose == "0"
 			message "*Verbose mode: Off."
 		end if
 	end if
 else if @text.word[0] == "debug"
 	if @text.word[1] == "?"
 		message "*This variable sets whether debugger messages are displayed when testing a macro."
 		pause 15
 		if debug == 0
 			message "*debug is off."
 		else
 			message "*debug mode is on."
 		end if
 	else if @text.word[1] == 1
 		setglobal debug @text.word[1]
 	else if @text.word[1] == 0
 		setglobal debug @text.word[1]
 	else if @text.word[1] == "on"
 		setglobal debug 1
 	else if @text.word[1] == "off"
 		setglobal debug 0
 	else
 		message "Error: Debug Mode must be set to 0 or 1, or off and on."
 		goto end
 	end if
 	message "debug is set to: " debug
 else if @text.word[0] == "longsleep"
 	if @text.word[1] == "?"
 		message "*This variable is used to toggle the long sleep macro \"on\" and \"off\"."
 		if longsleep == 0
 			message "*longsleep is off."
 		else
 			message "*longsleep is on."
 		end if
 	else if @text.word[1] == "off"
 		setglobal longsleep 0
 		message "*longsleep is off."
 	else if @text.word[1] == "on"
 		setglobal longsleep 1
 		message "*longsleep is on."
 	else if if @text.word[1] == 0
 		setglobal longsleep 0
 		message "*longsleep is off."
 	else if if @text.word[1] == 1
 		setglobal longsleep 1
 		message "*longsleep is on."
 	end if
 else if @text.word[0] == "bag"
 	if @text.word[1] == "?"
 		message "*This variable is used to select a bag number to use for kudzu planting."
 		message "the current bag is " bag_number "."
 	end if
 	if @text.word[1] > 0
 		setglobal bag_number @text.word[1]
 		"/selectitem \"bag of kudzu seedlings <#" bag_number "\"\r"
 		message "the current bag is " bag_number "."
 	end if
 else if @text.word[0] == "maxbag"
 	if @text.word[1] == "?"
 		message "*This variable is used to set how many kudzu bags you have on you."
 		message "the number of kudzu bags is " max_bag "."
 	end if
 	if @text.word[1] > 0
 		setglobal max_bag @text.word[1]
 		message "you number of kudzu bags is set at " max_bag "."
 	end if
 else if @text.word[0] == "feedback"
 	if @text.word[1] == "?"
 		message "*This variable sets whether some macros give feedback as to their status."
 		pause 15
 		if feedback == 0
 			message "*feedback is off."
 		else
 			message "*feedback is on."
 		end if
 	else if @text.word[1] == 1
 		setglobal feedback @text.word[1]
 	else if @text.word[1] == 0
 		setglobal feedback @text.word[1]
 	else if @text.word[1] == "on"
 		setglobal feedback 1
 	else if @text.word[1] == "off"
 		setglobal feedback 0
 	else
 		message "Error: Debug Mode must be set to 0 or 1, or off and on."
 		goto end
 	end if
 	message "feedback is set to: " feedback
 else if @text.word[0] == "tgn"
 	if @text.word[1] == ""
 		setglobal thankTarget 1
 	else
 		setglobal thankTarget @text.word[1]
 	end if
 	call WhoAmIThanking
 else
 	setglobal @text.word[0] @text.word[1]
 	message @text.word[0] " is " @text.word[1]
 end if
 label end
 }
 
 include "RC2.txt"

Revisions

  • v1.0 2008012x-inu: posted.
  • v1.1 20080128-inu: Fixed errors
  • v2.0 20080128-inu: Revamped to remove excessive idle pause and integrate Raul's Trainer messages. Also by removing excessive pause in integrated DHAwakeAFK part of scanner, eliminated one way fogginess (where everything keeps moving except you).
  • v2.1 20080129-inu: Added recommended movement of Raul's readtext.mac back to separate file while still integrating into the main scanner loop via a call as recommended by ?.
  • v2.1.1 20080129-inu: Added pie-o-matic global default pie target variable. Fixed ExilePicker to exclude currently clanning character.

Links