$cursor(value) etc..

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

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

$cursor(value) etc..

Post by kagonis » Sun Jun 29, 2003 10:53 pm

$item([bank,]inv/pack,slot,value)
$equip(position,value)
$cursor(value)

These all return a number. To begin with I hoped that this number were the ID for this item type, thereby being able to distinguish 2 items that has the same name, from each other. But I found it odd that all these values were somewhat "round", so I checked against lucy (that ues the item id's) and they are not what I thought they would be.

What exactly does "value" do in the above mentioned macro variables?

And is it perhaps possible to add "id" to that list, to extract the exact id of the item?

I would think it's possible, since Lucy extracts those id's quite easily ;)

Thanks.. :)

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

Post by Valerian » Sun Jun 29, 2003 11:01 pm

value is their price, e.g. what a merchant will pay for them at best prices, in copper.

Code: Select all

							// $item(link)
							} else if (!strncmp("link)",szVar+Offset,5)) {
								i+=Offset+4;
								CHAR szTemp[MAX_STRING] = {0};
								sprintf(szTemp,"%c%07d%s%c",18,pItem->ItemNumber,pItem->Name,18);
								strcat(szOutput,szTemp);
								j+=strlen(szTemp);

							// $item(id)
							} else if (!strncmp("id)",szVar+Offset,3)) {
								i+=Offset+2;
								CHAR szTemp[MAX_STRING] = {0};
                                sprintf(szTemp,"%d",pItem->ItemNumber);
								strcat(szOutput,szTemp);
								j+=strlen(szTemp);

Code: Select all

						// $cursor(id)
						} else if (!strncmp("cursor(id)",szVar,10)) {
							i+=9;
							CHAR szTemp[MAX_STRING] = {0};
                            sprintf(szTemp,"%d",pItem->ItemNumber);
							strcat(szOutput,szTemp);
							j+=strlen(szTemp);


						// $cursor(unknown)
insert the // $item(id) thing in eqlib_macroparser.cpp as shown, and the // $cursor(id) as shown, compile, and there's your id parm.

I hope I didn't make any big errors in those, since I haven't even compiled those yet, much less tested them...

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

Post by kagonis » Mon Jun 30, 2003 12:30 am

Awesome, thanks Valerian :)

Do you think this will be added to CVS? Or do I have to make a patch I can add automatically on each combine? :p

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

Post by Valerian » Mon Jun 30, 2003 12:44 am

*shrug* depends on what DKAA or some other dev thinks when they read this post

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

Post by kagonis » Mon Jun 30, 2003 12:54 am

Heh, I just noticed I have been tradeskilling too much, I said combine instead of compile :p

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

Post by kagonis » Tue Jul 01, 2003 10:26 am

Well, your code seems to work perfectly :)

Gonna see I can remember how I med the patch to MQ.h and make one for this too, so I can make it do everything just by executing the batchfile I put together (thanks to Travan for the help here).

A small question..

$item(link) seems to work partially.
It creates a link, but a nonworking link though. It lacks the first work of the item name.

Is it perhaps possible to expand this to something like:
/echo $link(10307)
And make it create a working linke for a given item id?

Would be an excellent way to show someone a link of an item that you just saw at lucy.

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

Post by Valerian » Tue Jul 01, 2003 11:41 am

should be possible to do that, and I may take a look at $item(link) sometime in the near future as well... may be able to get that fixed too.

looks like item links are very weird now... instead of 7-digit-number+item name, it's 15-digit-hex-number+item name. may take a bit of work to figure out how they make item links now.

seems to be <special char>+<item number>+<unknown 8 char(DWORD) hex value(pointer to something perhaps?)>+<item name>+<special char>

so, $item(link) is definately broken, since it's currently leaving out that unknown hex value.

oh, and btw, I totally screwed up $item(id)... here is the way it should be...

Code: Select all

							// $item(id)
							} else if (!strncmp("id)",szVar+Offset,3)) {
								i+=Offset+2;
								CHAR szTemp[MAX_STRING] = {0};
                                sprintf(szTemp,"%d",pItem->ItemNumber,pItem->Name);
								strcat(szOutput,itoa(pItem->ItemNumber));
								j+=strlen(szTemp);

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Compiler problem.

Post by MacroFiend » Sat Aug 09, 2003 2:07 pm

When I try to use your fixed code for $item(id), I get a compiler error saying that iota does not take 1 parameter. It wants 2. Also, you don't seem to be using szTemp anywhere else in the clause except to add to the j count.

Would it work like this ... ?

Code: Select all

							// $item(id)
							} else if (!strncmp("id)",szVar+Offset,3)) {
								i+=Offset+2;
								CHAR szTemp[MAX_STRING] = {0};
								itoa(pItem->ItemNumber,szTemp,10);
								strcat(szOutput,szTemp);
								j+=strlen(szTemp);
You could also add this in to the $equip tree to get the id feature inside it with:

Code: Select all

							// $equip(id)
							} else if (!strncmp("id)",szVar+Offset,3)) {
								i+=Offset+2;
								CHAR szTemp[MAX_STRING] = {0};
								itoa(pItem->ItemNumber,szTemp,10);
								strcat(szOutput,szTemp);
								j+=strlen(szTemp);

[color=red]							// $equip(name)
[/code]

And ... to try and be complete ...

Code: Select all

[color=red]											j++;

[/color]									// $pack(#,id)
									} else if (!strncmp(szVar+7+5*Bank,"id)",3)) {
										i += 9+5*Bank;
										CHAR szTemp[MAX_STRING] = {0};
										itoa(pItem->ItemNumber,szTemp,10);
										strcat(szOutput,szTemp);
										j+=strlen(szTemp);
[color=red]												
									// $pack(#,name)
[/color]
*edits to fix count minor errors