Patch: Auto-squelch certain useless items when no_seling is on

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Max Stats
    Swordsman
    • Jun 2010
    • 324

    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;
    }
    If beauty is in the eye of the beholder, then why are beholders so freaking ugly?
  • Derakon
    Prophet
    • Dec 2009
    • 9022

    #2
    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.

    Comment

    • Max Stats
      Swordsman
      • Jun 2010
      • 324

      #3
      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.

      Originally posted by Derakon
      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."
      If beauty is in the eye of the beholder, then why are beholders so freaking ugly?

      Comment

      • Blue Baron
        Adept
        • Apr 2011
        • 103

        #4
        Originally posted by Max Stats
        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

        Comment

        • fph
          Veteran
          • Apr 2009
          • 1030

          #5
          Don't underestimate the damage an old, leather-cover, metal-studded book deals when thrown...
          --
          Dive fast, die young, leave a high-CHA corpse.

          Comment

          • jens
            Swordsman
            • Apr 2011
            • 348

            #6
            Hey! My current mage is wearing a Ring of Reckless Attacks. Are you implying I'm weird?!? ;-)

            Comment

            • Max Stats
              Swordsman
              • Jun 2010
              • 324

              #7
              Originally posted by jens
              Hey! My current mage is wearing a Ring of Reckless Attacks. Are you implying I'm weird?!? ;-)
              Would you settle for "unusual"?
              If beauty is in the eye of the beholder, then why are beholders so freaking ugly?

              Comment

              Working...
              😀
              😂
              🥰
              😘
              🤢
              😎
              😞
              😡
              👍
              👎