Item of the Month Inventory

Camber

Member
Hello. I am working on creating a script to show which IotM I have on my character, and in which permeation the rotating items are in. It is pretty straight forward and mostly works.

There are only a couple of items that the script says I have which I don't. In the code below, I do NOT have the "sane hatrack" item or either the "Divine Favor" Libram or skill.

Code:
void main()
{
	boolean result;

	if (have_familiar( $familiar[Mad Hatrack] ))  print("Mar-08  Mad Hatrack (fam)");
	if (item_amount( $item[sane hatrack]) >= 1) print("Mar-08  sane hatrack (misc)");	// sane hatrack (3219)

	if (item_amount( $item[Libram of Divine Favors]) >= 1) print("Jan-08  Libram of Divine Favors (misc)"); 
	if (result=have_skill ( $skill[Summon Party Favor] ))  print("Jan-08  Summon Party Favor (skill)"); 

	if (have_familiar( $familiar[Crimbo P. R. E. S. S. I. E.] ))  print("Dec-07  Crimbo P. R. E. S. S. I. E. (fam)");
	if (item_amount( $item[Crimbo P. R. E. S. S. I. E.]) >= 1) print("Dec-07  Crimbo P. R. E. S. S. I. E. (misc)");

	if (item_amount( $item[libram of candy heart summoning]) >= 1) print("Feb-07  libram of candy heart summoning (misc)");
	if (have_skill ( $skill[Summon Candy Hearts] ))  print("Feb-07  Summon Candy Hearts (skill)");
}

Yet the output shows that I do:
Code:
Mar-08 Mad Hatrack (fam)
Mar-08 sane hatrack (misc)
Jan-08 Summon Party Favor (skill)
Dec-07 Crimbo P. R. E. S. S. I. E. (fam)
Feb-07 Summon Candy Hearts (skill)

I do have the Mad Hatrack and Crimbo familiars and the Summon Candy skill. Can anyone see what I am doing wrong, or have any ideas?

Thanks!
 

Veracity

Developer
Staff member
Well, this:

Code:
if (result=have_skill ( $skill[Summon Party Favor] ))  print("Jan-08  Summon Party Favor (skill)");

is a problem. I didn't think that ASH let you do assignments as a value producing expression. Therefore, my first thought was to wonder why this was not a syntax error.

Then I remembered that holatuwol made "=" be the same as "==" in expressions. I disagree with that decision, but, well, here we are.

The result is that the above expression is comparing the value of "result" (which is false, since that is the default value of a boolean) and the value of your have_skill() call (also false) using the "==" operator. Since false == false, that expression is true.

That's the problem with the skill. I can't reproduce the problem with the sane hatrack.
 

Camber

Member
Thank you Veracity for the great explanation. I'll use == with expressions to help keep it straight in my head. I don't remember putting that result= in there, must have been some earlier troubleshooting or something. Stupid me. Taking out the result= fixed that error.

Still having a problem with the Mad Hatrack. It outputs that i have both the item and the familiar when i have just the familiar. Perhaps it is just the newness of the item.
 
Top