Page 1 of 3

autolink.mac - Link Storage/Search/Retrieval Macro

Posted: Sun May 02, 2004 12:11 am
by ml2517

Code: Select all

|autolink.mac 
|Auto/Manual Link Storage/Lookup Utility 
|Version 1.29 
|Date:5/11/2004 4:00am 
| 
|  Optional Paramaters available at start to make the automatic link adding silent and make the 
|  restarting of the mq2chatwnd every 30 minutes optional. 
| 
| Restart mq2chatwnd 0 is no(default), 1 is yes ---o 
| Silent: 0 is verbose, 1 is silent(default) ----o |  
|                                                | | 
|                                                v v                                
|                            /macro autolink.mac 1 0 
| 
|  
| 
|  NOTE: Currently there is a problem looking at item links in MQ2 so I have this script send to a password 
|        protected chat room that you specify below.  You can optionally send to other channels with ssearch 
|        but it is limited to only one result. 
| 
| 
|  This script by default will auto-add links that it sees in channels.  If you do not wish this to happen 
|  Comment out the #chat lines.  
| 
| 
|  Syntax: /echo <add|edit|list|search|ssearch|show|silent|restart|master> [link|name|firstletter] 
| 
| ------------------------------------------------------------------------------------------------------ 
|     To add a link manually: 
|     (You enter /echo add and a space then click your link.  Press Enter to add it.) 
|     Example: /echo add Some Item Link 
| ------------------------------------------------------------------------------------------------------ 
|     To manually update a link: 
|     (You enter /echo edit and a space then click your link.  Press Enter to update it.) 
|     Example: /echo edit Some Item Link 
| ------------------------------------------------------------------------------------------------------ 
|     To list all links: 
|     (You enter /echo list and then Enter and it will list all items in your database.) 
|     Example: /echo list 
| ------------------------------------------------------------------------------------------------------ 
|     To list links starting with a particular letter: 
|     (You enter /echo list and a space then one character to display the list that all start with 
|     that character.) 
|     Example: /echo list m 
| ------------------------------------------------------------------------------------------------------ 
|     To search for all entries containing a word: 
|     (You enter /echo search and a space then a partial name of the item you want to search for, 
|     then press Enter.) 
|     Example: /echo search Partial Link Name 
| ------------------------------------------------------------------------------------------------------ 
|     To search for all entries containing a word and display them to your private chat channel 
|     or a channel that you specify in an argument: 
|     (You enter /echo ssearch and a space then a partial name of the item you want to search for, 
|     then press Enter. You can also optionally pass an argument to direct it to a channel of your choice.) 
| 
|     NOTE: This will only display 6 records maximum to your private chat channel.  
| 
|     (This would only output all of the results to your private chat channel. Max of 6 records.) 
|     Example: /echo ssearch Partial Link Name 
| 
|     (This would only output 1 result and send it to your guild channel.) 
|     Example: /echo ssearch Partial Link Name /gu 
| 
|     (This would only output 1 result and send it via tell to john.) 
|     Example: /echo ssearch Partial Link Name /tell john 
| 
|     (This would only output 1 result and send it to chat room 'channelname'.) 
|     Example: /echo ssearch Partial Link Name /chat #channelname 
| 
|     (This would only output 1 result and send it to chat channel /1 but will allow you to put text before 
|     the link.) 
|     Example: /echo ssearch Partial Link Name /1 Any idea what this item is? 
|        Would Output: Any idea what this it is? ITEMLINK 
| 
|     (This would only output 1 result and send it to chat channel /1 but will allow you to put text before 
|     and after the link. You use the keyword itemlink to tell it where to put the link.) 
|     Example: /echo ssearch Partial Link Name /1 Any idea what this item is? itemlink I remember seeing it. 
|        Would Output: Any idea what this it is? ITEMLINK I remember seeing it. 
| ------------------------------------------------------------------------------------------------------ 
|     To send a specific link to your chat channel that you've specified so that you can actually view the 
|     link (**This will also let you redirect to other channels like ssearch): 
|     (You enter /echo show and a space then a list letter and then the key number. In order to find the list 
|     letter and key number you use the list or search functions.) 
|     Example: /echo show k 112 
| ------------------------------------------------------------------------------------------------------ 
|     To toggle suppression of output for automatic link additions: 
|     (You enter /echo silent and then enter. 
|     Example: /echo silent 
| ------------------------------------------------------------------------------------------------------ 
|     To toggle restarting of mq2chatwnd every 30 minutes: 
|     (You enter /echo restart and then enter. 
|     Example: /echo restart 
| ------------------------------------------------------------------------------------------------------ 
|     To add or remove a master from your authorization list, in order to allow/restrict remote searches: 
|     (You enter /echo master the player name and then enter. 
|     Example: /echo master Johnny 
|        Would add Johnny if he wasn't in the list or remove him if he was already on the list. 
| ------------------------------------------------------------------------------------------------------ 


#turbo 40
#define INIPART1 "Items-" 
#define INIPART2 ".ini" 
#define CHATROOM "room566g" 
#define CHATPASS "ff44ddfl" 

#Event LinkAdd "[MQ2] add#*#" 
#Event LinkEdit "[MQ2] edit#*#" 
#Event LinkList "[MQ2] list#*#" 
#Event LinkNameSearch "[MQ2] search#*#" 
#Event LinkShowSearch "[MQ2] ssearch#*#" 
#Event LinkShow "[MQ2] show#*#" 
#Event Silent "[MQ2] silent#*#" 
#Event Restart "[MQ2] restart#*#" 
#Event Master "[MQ2] master#*#" 
#Event LootedA "#*# has looted a #*#" 
#Event LootedB "#*# have looted a #*#" 


#chat say 
#chat tell 
#chat ooc
#chat shout 
#chat auc 
#chat guild 
#chat group 
#chat chat 

Sub Main
/declare RemotePhrase string outer
/declare RemoteSearchCount int outer

| -------------------------------------------------------------------------------------------------- 
| This is the command that you would need to precede a remote search from a master to do a search.  
| Change it to your unique word or phrase. (Do not end this with a space.) 
| -------------------------------------------------------------------------------------------------- 
/varset RemotePhrase Link me your 

| -------------------------------------------------------------------------------------------------- 
| Change this to the maximum number of search results that will be sent to your master. 
| -------------------------------------------------------------------------------------------------- 
/varset RemoteSearchCount 3 


/join CHATROOM:CHATPASS 
/echo Autolink.mac by ml2517 started. 
/declare BusyEvent int outer
/declare FlushTimer timer outer 
/declare SilentVar int outer
/declare ItemList string outer
/varset SilentVar 1 
/declare RestartWindow int outer
/declare MasterList[100] string outer UNDEFINED-ARRAY-ELEMENT
/declare LinkArray[40,1000] string outer UNDEFINED-ARRAY-ELEMENT
/varset RestartWindow 0 
/if (${Defined[Param0]}) /if (${Param0}==0) /varset SilentVar 0 
/if (${Defined[Param1]}) /if (${Param1}==1) /varset RestartWindow 1 
/varset BusyEvent 0 
/call LoadMasterList 
/call LoadLinkList

:MainLoop 
/if (${BusyEvent}==0) /doevents
/delay 1s 
/if (${FlushTimer}==0) {
    /if (${RestartWindow}==1) {
        /plugin mq2chatwnd unload 
        /delay 2s 
        /plugin mq2chatwnd 
        /delay 2s 
        /clear 
        /varset FlushTimer 30m 
    } 
} 
/goto :MainLoop 
/return 


Sub LoadLinkList
/declare TempElements int local 
/declare TempVar int local 
/declare TempItem string local 
/declare Letters string local 
/declare ParseLetters int local 
/varset TempVar 0 
/varset TempElements 0 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
/for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
    /varset TempVar 0 
    :ListLoadLoop 
    /varset TempItem ${Ini[INIPART1${Letters.Mid[${Math.Calc[${ParseLetters}+1].Int},1]}INIPART2,Links,${Int[${TempVar}]},NOTFOUND]}
    /if (${TempItem.Equal["NOTFOUND"]}) /goto :DoneWithLoadLetter
    /varset LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}] ${TempItem}
    /varcalc TempVar ${TempVar}+1
    /goto :ListLoadLoop 
    :DoneWithLoadLetter 
/next ParseLetters 
/return


Sub INIAdd(AddName,Auto) 
/declare TempVar int local 
/declare ParseLetters int local
/varset TempVar 0 

/declare Letters string local 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
/for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
    /if (${AddName.Mid[47,1].Equal["${Letters.Mid[${Math.Calc[${ParseLetters}+1].Int},1]}"]}) /goto :AddCheckLoop
/next ParseLetters

:AddCheckLoop 
/if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :AddItem
/if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["Empty"]}) /goto :AddItem

/if (${AddName.Find["${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Mid[47,${Math.Calc[${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Length}-47].Int}]}"]}) /if (${AddName.Mid[2,7].Equal["${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Mid[2,7]}"]}) {
    /if (${SilentVar}==0) {
        /echo -(( ${AddName} already in INI file. ))-
    } else { 
        /if (${Auto}==0) /echo -(( ${AddName} already in INI file. ))-
    } 
    /goto :FoundInINI 
} 
/varcalc TempVar ${TempVar}+1 
/goto :AddCheckLoop 

:AddItem 
/varset LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}] ${AddName}
/ini "INIPART1${AddName.Mid[47,1]}INIPART2" "Links" "${Int[${TempVar}]}" "'${AddName}'" 
/if (${SilentVar}==0) { 
    /echo -(( ${AddName} added to INI file. ))-
} else { 
    /if (${Auto}==0) /echo -(( ${AddName} added to INI file. ))-
} 
:FoundInINI 
/return 

Sub INIEdit(EditName) 
/declare TempVar int local 
/declare ParseLetters int local
/varset TempVar 0 
/declare Letters string local 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
/for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
    /if (${EditName.Mid[47,1].Equal["${Letters.Mid[${Math.Calc[${ParseLetters}+1].Int},1]}"]}) /goto :EditCheckLoop
/next ParseLetters
:EditCheckLoop

/if (${EditName.Find["${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Mid[47,${Math.Calc[${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Length}-47].Int}]}"]}) {
    /goto :EditItem 
} 
/if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :NotFoundInINI
/varcalc TempVar ${TempVar}+1  
/goto :EditCheckLoop 

:EditItem 
/varset LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}] ${EditName}
/ini "INIPART1${EditName.Mid[47,1]}INIPART2" "Links" "${Int[${TempVar}]}" "'${EditName}'" 
/echo -(( ${EditName} modified in INI file. ))-
/goto :EndINIEdit 
:NotFoundInINI 
/echo -(( ${EditName} not found in INI file. ))-
:EndINIEdit 
/return 


Sub INIList(ListKeyName) 
/declare TempVar int local 
/declare TempVar2 int local
/declare Letters string local 
/declare ParseLetters int local 
/varset TempVar 0 
/varset TempVar2 0
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

/if (!${Defined[ListKeyName]}) {
    /declare ListKeyName string local 
}

/if (${ListKeyName.Length}==0) {
    /for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
        /varset TempVar 0 
        :ListCheckLoop 
        /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :DoneWithLetter
        /echo -[ List:[ ${Letters.Mid[${Math.Calc[${ParseLetters}+1]},1].Upper} ] Key:[ ${Int[${TempVar}]} ] Name:[ ${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}]} ]
        /varcalc TempVar ${TempVar}+1 
        /varcalc TempVar2 ${TempVar2}+1  
        /goto :ListCheckLoop 
        :DoneWithLetter 
    /next ParseLetters 
} else { 
    /for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
        /if (${ListKeyName.Equal["${Letters.Mid[${Math.Calc[${ParseLetters}+1]},1]}"]}) /goto :ListCheckBreakOut
    /next ParseLetters
    :ListCheckBreakOut
    /varset TempVar 0 
    :ListCheckLoop2 
    /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :DoneWithLetter2
    /echo -[ List:[ ${Letters.Mid[${Math.Calc[${ParseLetters}+1]},1].Upper} ] Key:[ ${Int[${TempVar}]} ] Name:[ ${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}]} ]
    /varcalc TempVar ${TempVar}+1 
    /varcalc TempVar2 ${TempVar2}+1   
    /goto :ListCheckLoop2 
    :DoneWithLetter2 
} 
/if (${TempVar2}==0) {
    /echo -(( No Entries Found! ))- 
} else { 
    /echo -[ Listing Complete ]- 
} 
/return 

Sub ININameSearch(SearchName) 
/declare TempVar int local 
/declare Letters string local 
/declare ParseLetters int local 
/declare SearchCount int local 
/varset SearchCount 0 
/varset TempVar 0 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

/if (!${Defined[SearchName]}) {
    /declare SearchName string local 
}

/if (${SearchName.Length}==0) {
    /echo -(( You must provide a name to search for! ))- 
} else {

    /for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
        /varset TempVar 0 
        :SearchCheckLoop 
        /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :DoneWithSearchLetter
        /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Find["${SearchName}"]}) {
            /echo -[ List:[ ${Letters.Mid[${Math.Calc[${ParseLetters}+1]},1].Upper} ] Key:[ ${Int[${TempVar}]} ] Name:[ ${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}]} ]
            /varcalc SearchCount ${SearchCount}+1  
        } 
        /varcalc TempVar ${TempVar}+1  
        /goto :SearchCheckLoop 
        :DoneWithSearchLetter 
    /next ParseLetters 
    /echo -[ Search resulted in [${Int[${SearchCount}]}] ${If[${SearchCount}==1,record,records]}. ]- 
}

/if (${SearchCount}==0) {
    /echo -(( No Entries Found! ))- 
} else { 
    /echo -[ Search Complete ]- 
} 
/return 


Sub INIShowSearch(SearchName,SendChannel) 
/declare TempVar int local 
/declare Letters string local 
/declare ParseLetters int local 
/declare SearchCount int local
/varset ItemList 
 
/if (!${Defined[SendChannel]}) {
    /declare SendChannel string local 
    /varset SendChannel NULL
}
/varset SearchCount 0 
/varset TempVar 0 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

/if (!${Defined[SearchName]}) {
    /declare SearchName string local 
}
/if (${SearchName.Length}==0) {
    /echo -(( You must provide a name to search for! ))- 
} else {
    /for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
        /varset TempVar 0 
        :SSearchCheckLoop 

        /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :DoneWithSSearchLetter 

        /if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}].Find["${SearchName}"]}) {
            /if (${SendChannel.Equal["NULL"]}) {
                /varcalc SearchCount ${SearchCount}+1  
                /if (${SearchCount}>1) /if (${SearchCount}<7) /varset ItemList ${ItemList},
                /if (${SearchCount}<7) /varset ItemList ${ItemList}${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}]}
            } else { 
                /varcalc SearchCount ${SearchCount}+1  
                /if (${SearchCount}>1) /if (${SearchCount}<${Math.Calc[${RemoteSearchCount}+1]}) /varset ItemList ${ItemList},
                /if (${SearchCount}<${Math.Calc[${RemoteSearchCount}+1]}) /varset ItemList ${ItemList}${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${TempVar}+1]}]}
                /if (${SearchCount}>${Math.Calc[${RemoteSearchCount}+1]}) /goto :SSearchBreakOut
            } 
        } 
        /varcalc TempVar ${TempVar}+1  
        /goto :SSearchCheckLoop 
        :DoneWithSSearchLetter 
    /next ParseLetters 
        :SSearchBreakOut 

    /if (${SendChannel.Equal["NULL"]}) {
        /if (${SearchCount}>0) {
            /chat #CHATROOM ${ItemList} 
            /if (${SearchCount}>6) {
                /echo -[ Search resulted in [${Int[${SearchCount}]}] records, only 6 have been sent to your chat channel.  Please refine your search.]- 
            } else { 
                /echo -[ Search resulted in [${Int[${SearchCount}]}] ${If[${SearchCount}==1,record,records]}, ${If[${SearchCount}==1,it has,they have]} been sent to your chat channel. ]- 
            } 
        } 
    } else { 
        /if (${SearchCount}>0) {
            /call SendChatResult "${SendChannel}" 
        } 
    } 
}
/if (${SearchCount}==0) { 
    /echo -(( No Entries Found! ))- 
} else { 
    /echo -[ Search Complete ]- 
} 
/return 


Sub INIShow(List,Key,SendChannel) 
/varset ItemList 
/if (!${Defined[SendChannel]}) {
    /declare SendChannel string local 
    /varset SendChannel NULL
}
/declare ParseLetters int local
/declare Letters string local 
/varset Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
/for ParseLetters 0 to ${Math.Calc[${Letters.Length}-1].Int}
    /if (${List.Equal["${Letters.Mid[${Math.Calc[${ParseLetters}+1]},1]}"]}) /goto :BreakOutINIShow
/next ParseLetters

:BreakOutINIShow

/if (${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${Key}+1]}].Equal["UNDEFINED-ARRAY-ELEMENT"]}) {
    /echo -(( Entry Not Found! ))- 
    /goto :DoneShow 
} 
/varset ItemList ${LinkArray[${Math.Calc[${ParseLetters}+1]},${Math.Calc[${Key}+1]}]}

/if (${SendChannel.Equal["NULL"]}) {
    /chat #CHATROOM ${ItemList} 
} else { 
    /call SendChatResult "${SendChannel}"    
} 
/echo -[ Show Complete ]- 
:DoneShow 
/return 


Sub SendChatResult(MsgText) 
        /if (${MsgText.Left[5].Equal["/chat"]}) {
            /if (${MsgText.Find["itemlink"]}) {
                /chat ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } else { 
                /chat ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]} ${ItemList} 
                /echo -[ Search result sent to chat channel ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } 
        } 
        /if (${MsgText.Left[3].Equal["/gu"]}) {
            /if (${MsgText.Find["itemlink"]}) { 
                /gu ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to guild channel. ]- 
                /goto :DoneChannSend 
            } else { 
                /gu ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to guild channel. ]- 
                /goto :DoneChannSend 
            } 
        } 
        /if (${MsgText.Left[2].Equal["/g"]}) {
            /if (${MsgText.Find["itemlink"]}) { 
                /gsay ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to group. ]- 
                /goto :DoneChannSend 
            } else { 
                /gsay ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to group. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[3].Equal["/sa"]}) {
            /if (${MsgText.Find["itemlink"]}) { 
                /say ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to say. ]- 
                /goto :DoneChannSend 
            } else { 
                /say ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to say. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[4].Equal["/ooc"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /ooc ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to ooc channel. ]- 
                /goto :DoneChannSend 
            } else { 
                /ooc ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to ooc channel. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[5].Equal["/shou"]}) {  
            /if (${MsgText.Find["itemlink"]}) { 
                /shout ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to shout channel. ]- 
                /goto :DoneChannSend 
            } else { 
                /shout ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to shout channel. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[2].Equal["/t"]}) {   
            /if (${MsgText.Find["itemlink"]}) {
                /tell ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent via tell to ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } else { 
                /tell ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]} ${ItemList} 
                /echo -[ Search result sent via tell to ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[2].Equal["/m"]}) {    
            /if (${MsgText.Find["itemlink"]}) {
                /msg ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent via msg to ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } else { 
                /msg ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]} ${ItemList} 
                /echo -[ Search result sent via msg to ${MsgText.Arg[2]}. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[4].Equal["/auc"]}) {    
            /if (${MsgText.Find["itemlink"]}) { 
                /auction ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to auction channel. ]- 
                /goto :DoneChannSend 
            } else { 
                /auction ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to auction channel. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[3].Equal["/rs"]}) {     
            /if (${MsgText.Find["itemlink"]}) { 
                /rsay ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to raid channel. ]- 
                /goto :DoneChannSend 
            } else { 
                /rsay ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to raid channel. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[3].Equal["/10"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /10 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 10. ]- 
                /goto :DoneChannSend 
            } else { 
                /10 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 10. ]- 
                /goto :DoneChannSend 
            } 
        } 
        /if (${MsgText.Left[2].Equal["/1"]}) {
            /if (${MsgText.Find["itemlink"]}) { 
                /1 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 1. ]- 
                /goto :DoneChannSend 
            } else { 
                /1 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 1. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[2].Equal["/2"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /2 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 2. ]- 
                /goto :DoneChannSend 
            } else { 
                /2 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 2. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[2].Equal["/3"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /3 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 3. ]- 
                /goto :DoneChannSend 
            } else { 
                /3 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 3. ]- 
                /goto :DoneChannSend 
            } 
        }
        /if (${MsgText.Left[2].Equal["/4"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /4 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 4. ]- 
                /goto :DoneChannSend 
            } else { 
                /4 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 4. ]- 
                /goto :DoneChannSend 
            } 

        }
        /if (${MsgText.Left[2].Equal["/5"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /5 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 5. ]- 
                /goto :DoneChannSend 
            } else { 
                /5 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 5. ]- 
                /goto :DoneChannSend 
            } 

        }
        /if (${MsgText.Left[2].Equal["/6"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /6 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 6. ]- 
                /goto :DoneChannSend 
            } else { 
                /6 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 6. ]- 
                /goto :DoneChannSend 
            } 

        }
        /if (${MsgText.Left[2].Equal["/7"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /7 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 7. ]- 
                /goto :DoneChannSend 
            } else { 
                /7 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 7. ]- 
                /goto :DoneChannSend 
            } 

        } 
        /if (${MsgText.Left[2].Equal["/8"]}) {
            /if (${MsgText.Find["itemlink"]}) { 
                /8 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 8. ]- 
                /goto :DoneChannSend 
            } else { 
                /8 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 8. ]- 
                /goto :DoneChannSend 
            } 

        }
        /if (${MsgText.Left[2].Equal["/9"]}) { 
            /if (${MsgText.Find["itemlink"]}) { 
                /9 ${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Find["itemlink"]}-${Math.Calc[${MsgText.Find[" "]}+1].Int}].Int}]} ${ItemList} ${If[${MsgText.Find["itemlink"]}>0,${MsgText.Mid[${Math.Calc[${MsgText.Find["itemlink"]}+8].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find["itemlink"]}+8].Int}]},]}
                /echo -[ Search result sent to chat channel 9. ]- 
                /goto :DoneChannSend 
            } else { 
                /9 ${If[${MsgText.Find[" "]},${MsgText.Mid[${Math.Calc[${MsgText.Find[" "]}+1].Int},${Math.Calc[${MsgText.Length}-${MsgText.Find[" "]}].Int}]},]} ${ItemList}
                /echo -[ Search result sent to chat channel 9. ]- 
                /goto :DoneChannSend 
            } 

        } 
:DoneChannSend 
/return 

Sub LoadMasterList 
/declare TempVar int local 
/declare TempList string local 
/varset TempVar 0 

:ClearMasters 

/varset TempList ${Ini[autolink.ini,Masters,${Int[${TempVar}]},NOTFOUND]}
/if (${TempList.Equal["NOTFOUND"]}) /goto :DoneClearMasters
/varset MasterList[${Math.Calc[${TempVar}+1]}] Empty
/varcalc TempVar ${TempVar}+1  
/goto :ClearMasters 

:DoneClearMasters 
/varset TempVar 0 
:LoadMasters 
/varset MasterList[${Math.Calc[${TempVar}+1]}] ${Ini[autolink.ini,Masters,${Int[${TempVar}]},NOTFOUND]}
/if (${MasterList[${Math.Calc[${TempVar}+1]}].Equal["NOTFOUND"]}) /return
/varcalc TempVar ${TempVar}+1  
/goto :LoadMasters 
/return 


Sub Event_Master(EvtText) 
/varset BusyEvent 1 
/declare TempItem string local 
/declare TempVar int local 
/declare TempVar2 int local 
/varset TempVar 0

/varset EvtText ${EvtText.Mid[14,${Math.Calc[${EvtText.Length}-13].Int}]}

/if (${EvtText.Length}>0) {
    :MasterSearch 
    /varset TempItem ${Ini[autolink.ini,Masters,${Int[${TempVar}]},NOTFOUND]}
    /if (${TempItem.Equal["NOTFOUND"]}) /goto :AddMaster
    /if (${TempItem.Equal["${EvtText}"]}) {
        /echo -[ ${EvtText} REMOVED from Master list. ]- 
        /ini "autolink.ini" "Masters" "${Int[${TempVar}]}" "Empty" 
        /goto :DoneMaster 
    } 
    /varcalc TempVar ${TempVar}+1  
    /goto :MasterSearch 
    :AddMaster 
    /varset TempVar 0 
    :AddMasterLoop 
    /varset TempItem ${Ini[autolink.ini,Masters,${Int[${TempVar}]},NOTFOUND]}
    /if (${TempItem.Equal["Empty"]}) /goto :FoundMasterSlot
    /if (${TempItem.Equal["NOTFOUND"]}) /goto :FoundMasterSlot

    /varcalc TempVar ${TempVar}+1  
    /goto :AddMasterLoop 
    :FoundMasterSlot 
    /echo -[ ${EvtText} ADDED to Master list. ]- 
    /ini "autolink.ini" "Masters" "${Int[${TempVar}]}" "${EvtText}" 
} else { 
    /varset TempVar2 0 
    /echo -[ Allowed Masters ]- 
    :MasterList 

    /varset TempItem ${Ini[autolink.ini,Masters,${Int[${TempVar}]},NOTFOUND]}
    /if (${TempItem.Equal["NOTFOUND"]}) /goto :DoneMasterList 
    /varcalc TempVar ${TempVar}+1  
    /if (${TempItem.NotEqual["Empty"]}) {
        /varcalc TempVar2 ${TempVar2}+1  
        /echo -- Master[${Int[${TempVar2}]}] ${TempItem} 
    } 
    /goto :MasterList 
    :DoneMasterList 
    /if (${TempVar2}==0) /echo -(( No Masters Found ))- 
  
} 
:DoneMaster 
/call LoadMasterList 
/varset BusyEvent 0 
/return 


Sub Event_LinkAdd(EvtText) 
/varset BusyEvent 1 
/varset EvtText ${EvtText.Mid[11,${Math.Calc[${EvtText.Length}-10].Int}]}
/if (${EvtText.Length}>0) /call INIAdd "${EvtText}" 0 
/varset BusyEvent 0 
/return 

Sub Event_LinkEdit(EvtText) 
/varset BusyEvent 1 
/varset EvtText ${EvtText.Mid[12,${Math.Calc[${EvtText.Length}-11].Int}]}
/if (${EvtText.Length}>0) /call INIEdit "${EvtText}"
/varset BusyEvent 0 
/return 

Sub Event_LinkList(EvtText) 
/varset BusyEvent 1 
/varset EvtText ${EvtText.Mid[12,${Math.Calc[${EvtText.Length}-11].Int}]}
/if (${EvtText.Length}==0) {
    /call INIList 
} else { 
    /call INIList "${EvtText.Arg[1]}" 
} 
/varset BusyEvent 0 
/return 

Sub Event_LinkNameSearch(EvtText) 
/varset BusyEvent 1 
/varset EvtText ${EvtText.Mid[14,${Math.Calc[${EvtText.Length}-13].Int}]}
/if (${EvtText.Length}>0) {
    /call ININameSearch "${EvtText}"
} else { 
    /echo -(( You must provide a name to search for! ))-    
} 
/varset BusyEvent 0 
/return 

Sub Event_LinkShowSearch(EvtText) 
/varset BusyEvent 1 
/declare ChannelArg string local 
/varset EvtText ${EvtText.Mid[15,${Math.Calc[${EvtText.Length}-14].Int}]}
/if (${EvtText.Length}>0) {
    /if (${EvtText.Find["/"]}) {
        /varset ChannelArg ${EvtText.Mid[${EvtText.Find["/"]},${Math.Calc[${EvtText.Length}-${EvtText.Find["/"]}+1].Int}]}
        /varset EvtText ${EvtText.Mid[1,${Math.Calc[${EvtText.Find["/"]}-2].Int}]}
        /call INIShowSearch "${EvtText}" "${ChannelArg}" 
    } else { 
        /call INIShowSearch "${EvtText}" 
    } 
} else { 
    /echo -(( You must provide a name to search for! ))-    
} 
/varset BusyEvent 0 
/return 

Sub Event_LinkShow(EvtText) 
/varset BusyEvent 1 
/declare ChannelArg string local 
/varset EvtText ${EvtText.Mid[12,${Math.Calc[${EvtText.Length}-11].Int}]}

/if (${EvtText.Length}>0) {
    /if (${EvtText.Find["/"]}) {
        /if (${EvtText.Arg[1].Length}>0) {
            /if (${EvtText.Arg[2].Length}>0) {
                /varset ChannelArg ${EvtText.Mid[{EvtText.Find["/"]},${Math.Calc[${EvtText.Length}-${EvtText.Find["/"]}+1].Int}]}
                /varset EvtText ${EvtText.Mid[1,${Math.Calc[${EvtText.Find["/"]}-2].Int}]}
                /call INIShow "${EvtText.Arg[1].Left[1]}" "${EvtText.Arg[2]}" "${ChannelArg}"     
            } 
        } 
    } else {
        /if (${EvtText.Arg[1].Length}>0) {
            /if (${EvtText.Arg[2].Length}>0) {
                /call INIShow "${EvtText.Arg[1].Left[1]}" "${EvtText.Arg[2]}"
            } 
        } 
    } 
} else { 
    /echo -(( You must provide a list letter and key number in order to display the link! ))-    
} 
/varset BusyEvent 0 
/return 

Sub Event_Silent 
/varset BusyEvent 1 
/if (${SilentVar}==1) { 
    /varset SilentVar 0 
    /echo -[ Silent Mode OFF ]- 
} else { 
    /varset SilentVar 1 
    /echo -[ Silent Mode ON ]- 
} 
/varset BusyEvent 0 
/return 

Sub Event_Restart 
/varset BusyEvent 1 
/if (${RestartWindow}==1) { 
    /varset RestartWindow 0 
    /echo -[ Restart Window Mode OFF ]- 
} else { 
    /varset RestartWindow 1 
    /echo -[ Restart Window Mode ON ]- 
} 
/varset BusyEvent 0 
/return 

Sub Event_LootedA(EvtText) 
/call Event_chat "null" "null" "${EvtText}" 
/return 

Sub Event_LootedB(EvtText) 
/call Event_chat "null" "null" "${EvtText}" 
/return 


Sub Event_chat(MsgType,MsgFrom,MsgText) 
/varset BusyEvent 1 
/declare AnItem string local 
/declare FirstPoint int local 
/declare SecondPoint int local 
/declare CheckForMarker int local 
/declare TempVar int local 


/varset TempVar 0 
:CheckAuth 
/if (${MasterList[${Math.Calc[${TempVar}+1]}].NotEqual["UNDEFINED-ARRAY-ELEMENT"]}) {
    /if (${MasterList[${Math.Calc[${TempVar}+1]}].Equal["${MsgFrom}"]}) {
        /if (${MsgText.Mid[1,${RemotePhrase.Length}].Find["${RemotePhrase}"]}) { 
            /echo -[ Remote Search from [${MsgFrom}] searching for [${MsgText.Mid[${Math.Calc[${RemotePhrase.Length}+2].Int},${Math.Calc[${MsgText.Length}-${Math.Calc[${RemotePhrase.Length}+1].Int}].Int}]}] ]- 
            /call Event_LinkShowSearch "[MQ2] ssearch ${MsgText.Mid[${Math.Calc[${RemotePhrase.Length}+2].Int},${Math.Calc[${MsgText.Length}-${Math.Calc[${RemotePhrase.Length}+1].Int}].Int}]} /tell ${MsgFrom} Here ya go: itemlink :^)" 
            /varset BusyEvent 0 
            /return 
        } 
    } 
    /varcalc TempVar ${TempVar}+1  
    /goto :CheckAuth 
} 

:NextItem 
/varset CheckForMarker 99999999 
/if (${MsgText.Find[""]}) /varset CheckForMarker ${MsgText.Find[""]}
/if (${CheckForMarker}!=99999999) { 
    /varset FirstPoint 0 
    /varset SecondPoint 0 
    /varset FirstPoint ${Math.Calc[${MsgText.Find[""]}-1].Int}

    /if (${MsgText.Mid[${Math.Calc[${FirstPoint}+2].Int},${Math.Calc[${MsgText.Length}-1].Int}].Find[""]}) {
        /varset SecondPoint ${Math.Calc[${MsgText.Mid[${Math.Calc[${FirstPoint}+2].Int},${Math.Calc[${MsgText.Length}-1].Int}].Find[""]}-1].Int}
        /varset AnItem ${MsgText.Mid[${Math.Calc[${FirstPoint}+1].Int},${Math.Calc[${SecondPoint}+2].Int}]}
        /varset MsgText ${MsgText.Mid[${Math.Calc[${FirstPoint}+${SecondPoint}+3].Int},${Math.Calc[${MsgText.Length}-${Math.Calc[${FirstPoint}+${SecondPoint}+2].Int}].Int}]}
     
        /if (${AnItem.Length}>0) {
            /if (${AnItem.Length}>46) { 
                /call INIAdd "${AnItem}" 1
            } else { 
                /goto :SkipLink 
            } 
        } 
        :SkipLink 
        /if (${MsgText.Find[""]}) /goto :NextItem 
    } 
} 
/varset BusyEvent 0 
/return 

Posted: Sun May 02, 2004 3:26 am
by TheUnholy
<3 u

How exactly does this function work

Posted: Wed May 05, 2004 9:35 pm
by eqaussie
| To send a specific link to your chat channel that you've specified so that you can actually view the
| link (**This will also let you redirect to other channels like ssearch):
| (You enter /echo show and a space then a list letter and then the key number. In order to find the list
| letter and key number you use the list or search functions.)
| Example: /echo show k 112
What exactly will this return, assuming i could figure out how to get a response from this command :)

Posted: Wed May 05, 2004 11:54 pm
by ml2517
Huh? It is how you send the link to yourself or someone else so they can view it.

Do this to find a specific key:

/echo list a (If you wanted to find the indexes for everything that starts with an 'a')

It will then spit out all of the a's with key name and index numbers.

/echo show a 2 (This would send the second link in your INI file to the default chat channel.)

/echo show a 2 /tell Johnny (This would send that specific link to Johnny via tell)

/echo search sword (This would find any links with 'sword' in the name)

You could also send results from a search directly to the default chat channel like this:

/echo ssearch sword (This would find any links with 'sword' in the name and send them to the default chat channel.)

This would send the search results to Johnny via tell:
/echo ssearch sword /tell Johnny Is this what you wanted? itemlink Yeah? (This would find any links with 'sword' in the name and send them to Johnny but disguise the tell with other text.)

So the result would be something like:

Soandso tells you, 'Is this what you wanted? LINK1, LINK2, LINK3 Yeah?'

Anyways, I'm guessing you must not have even collected links yet which of course would explain why you are so lost heh.

Posted: Thu May 06, 2004 12:09 am
by eqaussie
ahh got it, the description slightly confused me ;)

I love this macro, being able to find item links at glance is so handy
Just gotta get more links into it hehe

Posted: Thu May 06, 2004 7:07 am
by drzoon
I'm having a small problem with version 1.27 of this autolink.mac.

When it adds links to the ini files, it doesn't add them in numerical order, and often duplicates entries. An example is below.

Code: Select all

[Links]
1='0014540-00001-00001-00001-00001-00001E5EAD17610 Dose Potion of Antiweight'
2='0014494-00001-00001-00001-00001-00001548B3DAD10 Dose Greater Potion of Cohesion'
3='0014492-00001-00001-00001-00001-00001AADC7D6D10 Dose Potion of Purity'
4='0065061-00001-00001-00001-00001-000015070D97C10 Dose Poison Awareness II'
5='0065049-00001-00001-00001-00001-0000119F6C1CE10 Dose Heat Awareness II'
87='0014494-00001-00001-00001-00001-00001548B3DAD10 Dose Greater Potion of Cohesion'
106='0014534-00001-00001-00001-00001-000016A26AC6A10 Dose Blood of the Wolf'
241='0014534-00001-00001-00001-00001-000016A26AC6A10 Dose Blood of the Wolf'
242='0014541-00001-00001-00001-00001-0000122FB6E1610 Dose Potion of Aquatic Haunt'
243='0014545-00001-00001-00001-00001-00001730424BC10 Dose Potion of Unlife Awareness'
244='0014548-00001-00001-00001-00001-0000158D5DEC110 Dose Kilva's Skin of Flame'
Also, when I search ("/echo ssearch 10 dose potion of antiweight" for example), it will often return 6 identical links of the first link it finds in the ini file.

The above problems did not occur with version 1.26 of this macro, they only started appearing when the macro was converted to the new MQDataVars, after May the 1st.

Posted: Thu May 06, 2004 7:35 am
by ml2517
I for the life of me can't get my autolink to screw up like what you are stating.

Did you modify your version at all? Did you modify your INI by hand? You don't even have a 0= entry in your INI file which is a good indication you did some editing.

Anyone else having this problem?

Edit:
Also, if any of the below are true let me know:

A: Are you on the very latest version of MQ2? I don't mean, "Do you have the updated memory locations etc. I mean the latest Zip that Lax releases."

B: Are you on an English speaking server?

C: Are you on the Firiona Vie server?

D: Are you on an OS who's numbering system is different than the US?

I can't think of any other questions for the time being but I can't duplicate your problem at all.

Fixed :)

Posted: Thu May 06, 2004 5:20 pm
by drzoon
Well I recompiled with the latest version of MQ2 (was previously using one compiled on 3rd of May) and it works as expected again. Nothing changed as far as the macro went, but I deleted all my Items-#.ini files and let it re-create them.

Thanks for your help though :)

Posted: Thu May 06, 2004 5:24 pm
by ml2517
You must have still had the version with the bugged ${Ini code. Glad to hear its working now.

Posted: Mon May 10, 2004 5:34 pm
by Tel0net
Now if only this were a plugin :(

Posted: Mon May 10, 2004 10:59 pm
by ml2517
Updated:
autolink.mac

Updated events for new event system.

Posted: Tue May 11, 2004 5:20 am
by ml2517
Updated:
autolink.mac

Fixed a problem with the event system changes. Also, fixed a new bug that popped up as a result.

Posted: Thu May 13, 2004 8:00 pm
by JGC84
when i do /echo list i get about a million lines of:

[MQ2] -((No Entries Found!))-
[MQ2] 35

after it lists the tiems looks like one of the loops has its upperbound a bit to high... i'll look at the code some other time

Posted: Thu May 13, 2004 8:03 pm
by ml2517
You aren't up to date then. Get the version that is posted.

Posted: Fri May 14, 2004 7:26 pm
by theoneandonly
dam genious ml!