well I think you can just use already existing variable actions for that.
for example
ifplayer: ifholding {
getItemLore (varname, main-hand-item 'attacker')
IfVariable: ListIndexEquals (varname, lore line index, text){
action,}}
does require only 1 more Codeblock
you can also use IfVariable...