autolink.mac - Auto link storage/search - *New Parm Ready*

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Jan 26, 2004 4:41 pm

fishez wrote:This works excellently!

Are you aware of any way to extract the information in the links like the value, stat info, etc to a separate file?
Nope.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Jan 26, 2004 8:29 pm

ionsf wrote:I have a feature request.... I would like to have the trader sitting in a channel that me and some very close friends hangout in.
We all use macroquest. So its safe...


The feature I would like is for us to be able to enter the commands in our channel. Like ssearch robe. And the bot would report the results to the channel.

In any event i'm gonna see if I can write it myself..small learning curve
I don't think I'm going to add this feature, seems a bit unsafe to me to send commands in an EQ channel with 'search' and other obvious commands. It should be easy enough for you to pop some Master checks in at the top of Sub Event_chat though.

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Mon Jan 26, 2004 10:01 pm

I can understand my request being unsafe...

Could I withdraw it and make a new request? Have it respond to tells of users specified in an INI file or specified on the command line?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Tue Jan 27, 2004 1:07 am

On second thought,
It really isn't my responsibility to save you from yourself. :) I can see the value in adding this functionality. Just be careful or you might end up getting yourself and the people using your "link bot" banned.

I'll try to get it done tomorrow.

Groo Bait
Contributing Member
Contributing Member
Posts: 14
Joined: Tue Jan 27, 2004 12:58 am

Post by Groo Bait » Tue Jan 27, 2004 1:24 am

I've only just started using MQ, and of course latched onto this script simply for the fun of it.

I'm only having one problem that I don't understand; it doesn't work adding links from any channels EXCEPT usermade channels, that is not in shout, guild or auction (no OOC on Firiona Vie).

I'm supposing that it's because everyone is speaking a specific language on Firiona Vie, making the text look like -

Groo shouts, in Elvish, 'Buy my Such and So!'

or "auctions, in Elvish,"
or "tells the guild, in Elvish,"

Obviously, not EVERYONE speaks in Elvish, but it's definitely the most common language for shouts and auctions by far.

Can you please clue me in to how I can modify the script to adjust for that?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Tue Jan 27, 2004 1:33 am

Hmm actually that's probably a limitation in MQ2. You can try making changes to this portion of MQ2UserVars.cpp and recompiling:

Code: Select all

			if ((strstr(szMsg," tells the guild, '")) && (CHATEVENT(CHAT_GUILD))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," tells the guild, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," tells the guild, '")+19); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"guild",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," tells the group, '")) && (CHATEVENT(CHAT_GROUP))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," tells the group, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," tells the group, '")+19); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"group",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," tells you, '")) && (CHATEVENT(CHAT_TELL))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," tells you, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," tells you, '")+13); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"tell",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," says out of character, '")) && (CHATEVENT(CHAT_OOC))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," says out of character, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," says out of character, '")+25); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"ooc",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," shouts, '")) && (CHATEVENT(CHAT_SHOUT))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," shouts, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," shouts, '")+10); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"shout",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," auctions, '")) && (CHATEVENT(CHAT_AUC))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," auctions, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," auctions, '")+12); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"auc",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," says '")) && (CHATEVENT(CHAT_SAY))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," says '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," says '")+7); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"say",Arg1,Arg2,NULL); 
			} else if ((strstr(szMsg," says, '")) && (CHATEVENT(CHAT_SAY))) { 
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," says, '")-szMsg)); 
				strcpy(Arg2,strstr(szMsg," says, '")+8); 
				Arg2[strlen(Arg2)-1]=0; 
				AddEvent(EVENT_CHAT,"say",Arg1,Arg2,NULL); 
			} else if ( (strstr(szMsg," tells ")) && (strstr(szMsg,":")) && (strstr(szMsg,", '")) && (CHATEVENT(CHAT_CHAT)) ) {
				strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," tells ")-szMsg)); 
				strcpy(Arg3,strstr(szMsg," tells ")+7); 
				Arg3[strlen(Arg3)-1]=0; 
				strcpy(Arg2,strstr(Arg3,", '")+3); 
				Arg3[strstr(Arg3,":")-Arg3]=0; 
				AddEvent(EVENT_CHAT,Arg3,Arg1,Arg2,NULL); 

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Tue Jan 27, 2004 1:33 am

ml2517 wrote:On second thought,
It really isn't my responsibility to save you from yourself. :) I can see the value in adding this functionality. Just be careful or you might end up getting yourself and the people using your "link bot" banned.

I'll try to get it done tomorrow.

hehe.. Save me. Lets go with tells from certian people.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Tue Jan 27, 2004 5:51 pm

Impressive macro, much much better than anything I could have done, or even come up with (I'm dumb like a brickwall ;) ), very well done :)

Groo Bait
Contributing Member
Contributing Member
Posts: 14
Joined: Tue Jan 27, 2004 12:58 am

Post by Groo Bait » Tue Jan 27, 2004 10:06 pm

Thanks for the clue, your suggestion was right on the mark. I simply added "in Elvish, " to each string in quotes and adjusted the numeric values by adding 11, I.E.

Code: Select all

} else if ((strstr(szMsg," tells the group, in Elvish, '")) && (CHATEVENT(CHAT_GROUP))) { 
            strncpy(Arg1,szMsg,(DWORD)(strstr(szMsg," tells the group, in Elvish, '")-szMsg)); 
            strcpy(Arg2,strstr(szMsg," tells the group, in Elvish, '")+30); 
            Arg2[strlen(Arg2)-1]=0; 
            AddEvent(EVENT_CHAT,"group",Arg1,Arg2,NULL); 
Instead of replacing the current code, since I wanted it to work on the rare occaisions I venture to the other servers, I copied and pasted to add another block without the ooc lines, (since there's no ooc), it's working very well now.

I suppose I could add more lines to account for each language, but eh, why bother?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Jan 28, 2004 6:32 pm

Updated:
Added the master lookup ability.

To add a master:
/echo master playername

To remove a master(same command):
/echo master playername

The master sends a search request like this:
/tell yourbotname ssearch partial link name
Example:
/tell Linkbot ssearch great sword
Example output would look like this:
Linkbot tells you, 'Here ya go: ITEMLINK :^)'

NBarnes
orc pawn
orc pawn
Posts: 19
Joined: Wed Jan 28, 2004 10:46 pm

Post by NBarnes » Wed Jan 28, 2004 10:50 pm

A) My observation has been that this macro will not read links that I post to channels, the way it reads links that other people post. Is that a design intention, or am I misinterpreting the behavior? If it is by design, can it be disabled with any ease?

B) With LDoN and item augments, it seems that the item link system has been extended to reflect the aug state of the items linked. I am unfamiliar with how the augmentation data is stored in the link string. Will this macro store augmention info? Will it store one entry per each state of augmentation for each item (potentially leading to a great many item entries returned on searches)?

Thanks for the very useful macro. :)

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Jan 28, 2004 11:18 pm

The A: part I believe is because MQ2 doesn't monitor your chat text. That is why I have the manual adding of items if you wish to do that.

The B: part is no. It will not store more than one item with the same "name". It doesn't compare the item link id's.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Thu Jan 29, 2004 8:56 am

Hmm, wouldn't that be a problem when you are dealing with items' with the same name, but varous lore-name (item-id)?
Best example is Lucid shards..

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Jan 29, 2004 9:08 am

Yeah but you'd end up storing tons of links because of people with different augments on items. I suppose if one of the portions of the link code is only used for augments I could compare the other sections of the code and store them if they differ. I'll have to think about the best way to do it.

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Thu Jan 29, 2004 10:43 am

I suppose if one of the portions of the link code is only used for augments
the first 7 digits is the item, the middle is for augments, and the last 13 characters seems to be random.

for example

un augmented item:
0023130-00001-00001
the augment is:
0041107-00001-00001
so the augmented item link would now be:
0023130041107-00001

etc, etc for all augments listed in the item (item being the first 7 characters)