$id(xxx) and partial matches

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

$id(xxx) and partial matches

Post by L124RD » Mon Feb 17, 2003 7:00 pm

Salutations,
I've gotten a few people asking why $id() doesn't do partial matches... so I've fixed it... also made it so it uses clean names instead of the a_mq_newb00 type of stuff... anyway... here goes...

First off, link the library shlwapi.lib For those of you using vc++6 I hope you know how to do it since its been around so long. For the newbies (like me when I started this project) to linking in vc++.net instructions to follow:
On your solution explorer, right click the project 'EQLib'
select properties
linker -> input
on the additional dependencies line, add shlwapi.lib on the end. hit ok

Now, open up EQLib.cpp, thats where all the changes will be...

After the following code: (around line 39)

Code: Select all

#include <windows.h>
#include <tchar.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <dinput.h>
#include <time.h>
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <winsock.h>
insert the following 2 lines of code:

Code: Select all

#include <Shlwapi.h> //For $id(xxx) fix
#include <string> //For $id(xxx) fix
almost done... Next, replace the lines (around ln 5223):

Code: Select all

								while ((Num==-1) && (pSpawn)) {
									if (!stricmp(SpawnName,pSpawn->Name)) {
with

Code: Select all

								while ((Num==-1) && (pSpawn)) {
									// $id(xx) fix... Coded by L124RD
									CHAR szDude[MAX_STRING] = {0};
									strcat (szDude,SpawnName);
									strcat (szDude,"->");
									CHAR szLookingSpawn[2048] = {0};
									strcat(szLookingSpawn,SpawnName);
									CHAR szLookedSpawn[MAX_STRING] = {0};
									strcat(szLookedSpawn,CleanupName(pSpawn->Name,FALSE));
									strlwr(szLookedSpawn);
									strcat (szDude,szLookedSpawn);
									char *pSpawnDest = strstr( szLookedSpawn, szLookingSpawn );
									DebugSpew("ParseMacroParameter - %s",szDude);
									if (pSpawnDest!=NULL) {
									// End $id(xxx) fix...
Congrats... hopefully $id(xx) is now working... If I forgot to put something on here, someone please tell me...[/code]

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

Post by OldNecro » Tue Feb 18, 2003 6:23 am

that's cool and everything... but now it won't accept the system names (an_orc01) like it used to... well, it will until you use the new substring feature, then it won't work from there on in.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Tue Feb 18, 2003 10:24 am

Salutations,
you want to use a_orc01? dammit! why didn't you tell me this when you asked me to do this? you had said the a_orc01 was the problem

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

Post by OldNecro » Tue Feb 18, 2003 9:53 pm

no, not being able to search by a substring is the problem...

orc exists in a_orc01
a_orc01 ALSO exists in a_orc01

need to be able to use ANY substring, or even the whole thing. =)

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Tue Feb 18, 2003 11:10 pm

Salutations,
if you change the line

Code: Select all

strcat(szLookedSpawn,CleanupName(pSpawn->Name,FALSE));
to

Code: Select all

strcat(szLookedSpawn,pSpawn->Name,FALSE);
I think this would qualify. since the sub string 'orc' is in 'a_orc01' and 'a orc'... REPLACE ALL SPACES WITH _'s K?[/code]

Ohmz
Developer
Developer
Posts: 97
Joined: Tue Feb 04, 2003 12:54 pm

NO!!

Post by Ohmz » Tue Feb 18, 2003 11:33 pm

Thats one of the most powerful things to MQ. Don't nerf it just because somone doesn't know how to use it properly.

http://www.lootfactory.com/zonescan.mac

Have them use that macro to get the spawn names if they are that inept...



I wish everything used these specific names as opposed to the short buggy ones..

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Wed Feb 19, 2003 3:23 am

Actually L12, I think it should be more like:

Code: Select all

strcat(szLookedSpawn,pSpawn->Name);

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

Post by OldNecro » Wed Feb 19, 2003 11:08 am

yes, there would be no need to use a name with spaces in it as far as I can tell... and in those cases, I would think having to use the underscore would be fine as long as people know that is a requirement.

Ohmz, zonescan.mac is ULTRA slow, and some of us need to have it in the main infinite loop for our purposes... This change ADDS the ability to search for substrings; it does not change the old functionality of $id() as long as you add the new line liz just posted, or Valerian's or whatever I haven't tested either yet.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Thu Feb 20, 2003 1:18 am

Salutations,
yeah, Valerian's is right, I'm an idiot :P at least the patch seems to be correct, last time I gave someone a patch for a program it failed since I forgot a line, I still haven't figured out which one 0.o

Ohmz
Developer
Developer
Posts: 97
Joined: Tue Feb 04, 2003 12:54 pm

zonescan.mac

Post by Ohmz » Thu Feb 20, 2003 1:31 am

Zonescan is a utility/tool used for getting the spawn names so you can use them in your macro. Its not intended to actually be used in a macro.. Either way, don't nerf $id() add $idshort() if its that necessary to have a less accurate version

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Thu Feb 20, 2003 9:49 am

Salutations,
its just as acurate, you can still do a_orc01, but now you can do orc as well...