Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old June 1, 2011, 21:53   #1
Max Stats
Swordsman
 
Join Date: Jun 2010
Posts: 324
Max Stats is on a distinguished road
Patch: Auto-squelch certain useless items when no_seling is on

Since no_selling has proven itself to be a viable option, I think it could be made even more useful if certain items that have no value to a character (now that they can't be sold) would be marked to squelch automatically on character creation, if this option is set. Right now, the only definitely useless items that I have come up with are spellbooks that don't apply to the character's class. We can probably come up with others, but they should be items that are objectively unusable, not just based on opinion like "I don't think a mage would ever use a Ring of Reckless Attacks" because as soon as you do that, you will find someone who says he does exactly that. I don't want to inconvenience people who do weird things, just make things more useful for everyone.

Here is a rewritten squelch_birth_init that does the spellbook auto-squelching:
Code:
void squelch_birth_init(void)
{
	int i;

	/* Reset squelch bits */
	for (i = 0; i < z_info->k_max; i++) {
		/* By default, don't squelch */
		k_info[i].squelch = FALSE;

		/* Squelch useless items when no_selling is on */	
		if (OPT(birth_no_selling)) {
		 	/* Squelch priest books for non-priest classes */
			if (k_info[i].tval == TV_PRAYER_BOOK && p_ptr->class->spell_book != TV_PRAYER_BOOK)
				k_info[i].squelch = TRUE;
		 	/* Squelch mage books for non-mage classes */
			else if (k_info[i].tval == TV_MAGIC_BOOK && p_ptr->class->spell_book != TV_MAGIC_BOOK)
				k_info[i].squelch = TRUE;
		 	/* Insert any other useful auto-squelch tests here */
	 	}
	}

	/* Clear the squelch bytes */
	for (i = 0; i < TYPE_MAX; i++)
		squelch_level[i] = 0;
}
Max Stats is offline   Reply With Quote
Old June 1, 2011, 22:22   #2
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,104
Derakon is on a distinguished road
Even if such an option is desirable, I suspect the proper way to handle it would be via an additional squelch settings file that gets OR'd with the player's squelch settings, not by hardcoding which item types are worthless. That strikes me as a more elegant solution, anyway, though it's of course more work as well.

One thing to bear in mind specifically with spellbooks is that they can be generated by Acquirement, and if you have the book squelched then it will look like the scroll did nothing. I think the only other way you can have that happen is if you squelch all speed rings (I think...speed rings can be generated by Acquirement, right?). Personally I'd be open to the idea that Acquirement not be able to generate spellbooks, but others may feel differently.
Derakon is offline   Reply With Quote
Old June 1, 2011, 22:51   #3
Max Stats
Swordsman
 
Join Date: Jun 2010
Posts: 324
Max Stats is on a distinguished road
I have said in other threads that I think the ideal solution is to be able to write your current squelch settings to a pref file, to be applied at the creation of a new character. In order for this to be useful, they need to be written to a class-specific pref file (Warrior.prf, Mage.prf, etc.) because different classes will have different items that are useful/useless, and if you use different character names you don't have to copy your settings to a new pref file each time. However, this is also a somewhat more complex solution, and the coders might have other priorities. I intend this to be an interim solution, as it is simple enough to be written by a hack such as myself but useful enough to make life a little bit less tedious, especially if you tend to start a lot of characters; with the intention that someday, as coding time permits, it would be replaced by a more elegant solution.

Quote:
Originally Posted by Derakon View Post
One thing to bear in mind specifically with spellbooks is that they can be generated by Acquirement, and if you have the book squelched then it will look like the scroll did nothing.
Yes, this is a bit of a problem (independent of how the items were squelched to begin with). Perhaps if Acquirement/*Acquirement* creates only squelched items, there could be a message like, "You feel something brush against your foot, but take no notice of it."
Max Stats is offline   Reply With Quote
Old June 1, 2011, 23:37   #4
Blue Baron
Adept
 
Join Date: Apr 2011
Posts: 103
Blue Baron is on a distinguished road
Quote:
Originally Posted by Max Stats View Post
I have said in other threads that I think the ideal solution is to be able to write your current squelch settings to a pref file, to be applied at the creation of a new character. In order for this to be useful, they need to be written to a class-specific pref file (Warrior.prf, Mage.prf, etc.) because different classes will have different items that are useful/useless, and if you use different character names you don't have to copy your settings to a new pref file each time. However, this is also a somewhat more complex solution, and the coders might have other priorities. I intend this to be an interim solution, as it is simple enough to be written by a hack such as myself but useful enough to make life a little bit less tedious, especially if you tend to start a lot of characters; with the intention that someday, as coding time permits, it would be replaced by a more elegant solution.
Reading squelch info is already in the code using Q: lines, and user.prf already redirects to class specific pref files, if they exist. I don't know about writing the file, but you could certainly build it manually and use it thereafter.

I have not tried it but I think the line will be something like:
Q:cloak:Fur Cloak~:1
and you would change the 1 to a 0 to turn the squelch off.

the function that acts on the line is parse_prefs_q
Blue Baron is offline   Reply With Quote
Old June 2, 2011, 11:04   #5
fph
Knight
 
Join Date: Apr 2009
Location: Berlin / Italy
Posts: 571
fph is on a distinguished road
Don't underestimate the damage an old, leather-cover, metal-studded book deals when thrown...
fph is offline   Reply With Quote
Old June 2, 2011, 15:56   #6
jens
Swordsman
 
Join Date: Apr 2011
Location: Göteborg, Sweden
Posts: 348
jens is on a distinguished road
Hey! My current mage is wearing a Ring of Reckless Attacks. Are you implying I'm weird?!? ;-)
jens is offline   Reply With Quote
Old June 2, 2011, 20:24   #7
Max Stats
Swordsman
 
Join Date: Jun 2010
Posts: 324
Max Stats is on a distinguished road
Quote:
Originally Posted by jens View Post
Hey! My current mage is wearing a Ring of Reckless Attacks. Are you implying I'm weird?!? ;-)
Would you settle for "unusual"?
Max Stats is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto squelch quirk ChodTheWacko Vanilla 0 June 23, 2010 06:31
r1443 'magical' items auto identify all the way. PaulBlay Vanilla 6 June 18, 2009 16:13
Problems with squelch and auto-inscription Bodkin Vanilla 1 February 1, 2009 13:53
Weak Auto squelch momo125 Vanilla 1 August 13, 2008 04:10
Zangband Squelch patch? Donald Jonker Variants 2 July 6, 2008 16:12


All times are GMT +1. The time now is 08:03.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.