Scanner.txt: Difference between revisions

From CLUMP
Jump to navigationJump to search
m (bug fix to v3.0.1)
m (clarified scanning all macros have limitation.)
Line 12: Line 12:




''An important thing to note is all scanning macros is that it cannot scan each message if they come in at the same time. This means there is always a chance something else will come in at the same time & make the macro fail. Due to game’s logging/messaging & macro architecture there is no way for players to script around this issue. So, please accept that all Scanner macros can easily miss something that should trigger a reaction. Until a GMs decides to allow line-by-line scanning, this will always be the case. '''(Note: this limit prevents easy botting, so it is not likely to change—we’ve asked, and you can too, if you wish. thanks.)'''''
''An important thing to note with all scanning macros is that they cannot scan each line of the text log if they come in at the same time. This means there is always a chance something else will come in at the same time & make the macro fail to detect the trigger words. Due to game’s logging/messaging & macro architecture there is no way for players to script around this issue. So, please accept that all Scanner macros can easily miss something that should trigger a reaction. Until a GMs decides to allow line-by-line scanning, this will always be the case. '''(Note: this limit prevents easy botting, so it is not likely to change—we’ve asked, and you can too, if you wish. thanks.)'''''


  //------------------------------------------------------------------------------
  //------------------------------------------------------------------------------

Revision as of 21:55, 7 March 2017

Scanner.txt is a new version of tc_macro.txt with a name change because of focus change and a large rewrite into arrays to remove the repetitive conditionals

The biggest feature is ease of adding things to scan for: now, you can easily add a set of scanned items and macros to call by numbering them (placeholders 1 & 15 are for quick adds/copies without triggering an error:

"set checkText[#]" "{text to look for}"
"set reaction[#]" "macro to call" //note: must be callable see Macros*

if the reaction[#] is not a callable macro, it will throw an error into your sidebar.


For instance all the boat sellers in Puddleby trigger the "RentBoat" macro to save time/typing/switching from mouse to KB, you can add other shortcuts such as chain snaps trigger rechains, kudzu outages trigger bag swaps, etc. Suggest some in the Sentinel’s Macros forum.


An important thing to note with all scanning macros is that they cannot scan each line of the text log if they come in at the same time. This means there is always a chance something else will come in at the same time & make the macro fail to detect the trigger words. Due to game’s logging/messaging & macro architecture there is no way for players to script around this issue. So, please accept that all Scanner macros can easily miss something that should trigger a reaction. Until a GMs decides to allow line-by-line scanning, this will always be the case. (Note: this limit prevents easy botting, so it is not likely to change—we’ve asked, and you can too, if you wish. thanks.)

//------------------------------------------------------------------------------
// scanner.txt  version 3.0.1 (Array-fied)
//------------------------------------------------------------------------------
// Description:  (AKA "A Quick Reply")
// This macro allows you to quickly reply to anyone who thinks to you directly
// to you. It also manages think to groups and think to clan actions by default.
// The addition of arrays means additional scans can be added without writing a
// new conditional check for the phrase.
//------------------------------------Usage-------------------------------------
// "goscan" to start and "noscan" to stop.
// "goscan ?" for instructions on different commands.
// "t?" give the current target,
// "ts <name> [message]" sets the SSTarget and optionally sends a message
// "tc <message>" to think back to the SStarget
// "tt <message>" to think to selected player -- added v2.5.4
// SCROLL DOWN for Thinkgroup instructions
//------------------------------------Setup-------------------------------------
// Add "include "scanner.txt"" and "@login call GoScan" to
// your default macro file if you want it to strart automatically.
//------------------------------------Credit------------------------------------
// Reye for the Idea, X for the syntax check and suggestions,
// and everyone who direct SSed me to help debug.
//------------------------------------------------------------------------------

include "rankcount.mac"
set ssTarget "" //you must keep these variables outside of the functions and macros
set myStone "Sungem"  // set this to Suntone, Suncrystal or Sungem
set scanBreak 0		//they need to be global
set feedback 1 //Gives you feedback "tc target: @player"
set scanText ""
set timeStamps 1    // Set this to zero if you don't use timestamps** 
set playerName 0
set me 0
set keepAlive 0
set feedback 1 //useful for debug & more spam in your sidebar
set pointer 1 // pointer to current scanned phrase
set cap 12 //must equal checkText/reaction array total
set checkText[1] 	"placeholder"
set checkText[2] 	"thinks to you, \""
set checkText[3] 	"Captain Barnac asks, \"Ah, "
set checkText[4] 	"Paul Deckand asks, \"Ah, "
set checkText[5] 	"Fird Lirden asks, \"Ah, "
set checkText[6] 	"No item named 'bag of kudzu seedlings"
set checkText[7]	"* Your bag of kudzu seedlings is full."
set checkText[8] 	"* You do not have room in your pack for anything else."
set checkText[9] 	"You can't take things out of your pack that quickly."
set checkText[10]	"• You return to your normal form."
set checkText[11]	"•You assume the shape of "
set checkText[12] 	"You cannot possibly use anything in your current condition."
set checkText[13] 	"myThankGroup[thankTarget]"
set checkText[14] 	"placeholder"

set reaction[1]               "placeholder"
set reaction[2]		"ThinkTargetSet"
set reaction[3]		"RentBoat"
set reaction[4]		"RentBoat"
set reaction[5]		"RentBoat"
set reaction[6]		"setBagOne"
set reaction[7]		"decrementBag"
set reaction[8]		"plantSeed"
set reaction[9]		"dropOrgaEye"
set reaction[10]	"notMorphed"
set reaction[11]	"isMorphed"
set reaction[12]	"notMorphed"
set reaction[13]	"moveUp"
set reaction[14]	"placeholder"

"goscan" call GoScan

GoScan
{
setglobal scanBreak 0
set @env.key_interrupts false //when you start you want it to loop
set @env.click_interrupts false //these two lines makes sure it doesn't shut off
if @text == ""
	if feedback == 1
		message "¥¥¥Scanner On¥¥¥"
		message "for settings type \"goscan ?\"."
		pause 8
	end if
else if @text == "?"
		message "Type \"t?\" to find the target. "tc <message>\" to send to SStarget. \"tt <text>\" to send to selected player."
		pause 8
		message "Type \"ts <name> [message]\" sets the target and sends them a message if you include one."
		pause 8
		message "Type \"/feedback\" to toggle macro feedback off|on."
		pause 4
		message "OR \"/set feedback <?|1|on|0|off>"
		pause 8
		message "Type \"noscan\" to stop."
end if
call Scanner
label SCANMONITOR
if keepAlive == 1
	pause 240
	set keepAlive 0
	pause 40
	goto scanmonitor
else if keepAlive == 2
	set scanBreak 1
else
	pause 80
	setglobal scanBreak 0
	call Scanner
	message "*Scanner recalled"
	goto SCANMONITOR
end if
}

Scanner
{
label SCANtop
pause 1
if scanBreak == 1
	goto SCANEnder
else
    setglobal keepAlive 1
	setglobal scanText @env.textLog
	if scanText.word[0] < "/"
		setglobal timeStamps 3
		setglobal playerName 2
		setglobal me 6
	else
		setglobal timeStamps 1
		setglobal playerName 0
		setglobal me 3
	end if
	if scanText.word[timeStamps] == checkText //with timestamps[3] w/o [1]
		label SCANloop
		if scanText < checkText[pointer]
			message "*index [" pointer "] found"
			call reaction[pointer]
		else
			setglobal pointer + 1
			if pointer > cap
				goto SCANnext
			else
				goto SCANloop
			end if
		end if
	end if
endif
label SCANnext
pause 1
setglobal gtrainerPhrase scanText
call rankcount
goto SCANtop

label SCANEnder
	set keepAlive 2
if feedback == 1
	message "••Scanner Off••"
end if
setglobal keepAlive 0
}


"noscan"
{
setglobal scanBreak 1	//This alows you to stop this macro without stopping other macros
}

ThinkTargetSet
{
	if ssTarget != scanText.word[playerName] //w/timestamps[2] w/o[0]
		if scanText.word[playerName] != @my.name
			setglobal  ssTarget scanText.word[playerName]
			setglobal feedback 1 //turn on feedback for new target
			pause 4
		end if
	end if
	if feedback == 1 //this controls overall feedback
//This if block turns off feedback when the target hasn't changed
		if feedback == 1
			message "tc target: " ssTarget
			setglobal feedback 0
		end if
	end if
}

RentBoat
{
	set namePer @my.name
		 set namePer + "."
		if scanText.word[me] == namePer
			pause 1
			"yes\r"
		end if
}

setBagOne
{
	setglobal bag_number 1
	"/equip bag of kudzu seedlings " bag_number "\r"
}

decrementBag
{
	setglobal bag_number - 1
	if bag_number < 0
		setglobal bag_number max_bag
	end if
}

plantSeed
{
	"/equip Kudzu Seedling\r"
	pause 1
	"/usei left\r"

}
dropOrgaEye
{
	"/selectitem orga eye \r"
	"/drop orga eye \r"
	pause 1
}

notMorphed
{
	setglobal morphed 0
}

isMorphed
{
	setglobal morphed 1
}

placeholder
{
message "placeholder"
}
  • please report any error messages.