item notebox problem

so I have been learning different note box methods but my dumb brain is having issues with items noteboxs. I did try reverse engineering a scripts note boxing. Which worked for a while till I found out picking an item up before the noteboxed item, stops my script activation system from working. so I came here to see what I am doing wrong

my code
Ruby:
class Game_Party
  def item_note(num)
    it  = self.items.find_all{|i| i.note =~ /#{Map::Map_Name::Name[num][0]}/}
    return false unless $~
    $game_system.map_unlock_open(num,Map::Map_Name::Name[num][0])# this just adds to a global                                                                                                                                     non item system
    it.each{|i| numb += item_number i }
    return Map::Map_Name::Name[num][0]
  end

the code I used
Ruby:
  def num_lockpicks
     it  = self.items.find_all{|i| i.note =~ Tidloc::Games::LockPick::Notetags[:pick]}
     it += self.items.find_all{|i| i.note =~ Tidloc::Games::LockPick::Notetags[:unbreak]}
     num = 0
     it.each{|i| num += item_number i }
     return num
   end
I fail to understand what you're trying to do.
Mind to explain how do you set the note tag in your item note box?
What do you expect to happen? what are the input and output?
And what went wrong? Not working at all or throws an error?

Regardless, I personally prefer to handle note tag reading within the item class itself. For example
Ruby:
class RPG::Item
  def custom_tag
    if note[/<value:(\d+)>/i]
      return $1.to_i
    else
      return 0
    end
  end
end
So if you use it like $data_items.custom_tag and you tag the item with <value:1000> it will return 1000, else 0.
Here's the short version using the ternary operator.

Code:
class RPG::Item
  def custom_tag
    note[/<value:(\d+)>/i] ? $1.to_i : 0
  end
end

I think you should learn a bit about Regexp or regular expresions in Ruby.

They are always enclosed by forward slashes //.
Parentheses () enclose either words or numbers or groups and their captured value can be called in order of appearance, namely using $1, $2, etc. Those variables are strings and nothing else.
i after the final / means case insensitive. So you can write VALUE:1000 or vALue:1000 and it will always be captured by the regex.
Take in consideration that a note is an Array full of strings so it won't be converted (alias coerced) into a number by Ruby. You call to_i to return its numeric value.
Use \w+ instead of \d+ in case you ever need to capture a word. Even so I'd only recommend it if you have replaced the useless part of the string or used parentheses () there.
Mind to explain how do you set the note tag in your item note box?
I'm guessing you mean this
storage code.png

What do you expect to happen? what are the input and output?
so what is supposed to happen is when the player picks up an item with the notetag they are able to open their current map.
so I am using if map_note == $game_party.item_note(@num) I think the input is the @num which is the map id the output would be the items notetag so they both equal the same as the map_note
And what went wrong? Not working at all or throws an error?
it hasn't given an error. When I pick up an item with the notetag first everything works as intended but if I pick up an item without the note tag first it does not work.
so here is my bump/update had family stuff so took me a bit to actually work on this again and it took me way longer than it should to get the code you both sent to work but, the code is not working for how my script works currently for one I have no clue how I am supposed to set this up that the player has the item with the note tag and making it read different note tags for different map ids. I currently have my code set up like this

Code:
if map_note == $data_items[3].custom_tag(map_id)
 able to open map code here
end

and my notetag code look like this
Code:
class RPG::BaseItem
  def custom_tag(num)
    p(Map::Map_Name::Name[num][0])
    note[/<#{Map::Map_Name::Name[num][0]}(\w+)>/i] ? $1.to_i : 0
    end
   end


and lastly what the note looks like this <Village Map>
I think you are over-complicating things here.
From the look of it, you already use a constant to store some settings, so why not use that for all settings instead?
Something simple like this:
Spoiler
Code:
module MapItem

  # Format:
  #         [map_id1, map_id2, ...] => "filename",
  Data = {
    #---------------------------------------------------------------------
    [1,2,3,4,55,56,57] => "VillageMap01",
    #---------------------------------------------------------------------
    [12,14,15,24,26]   => "VillageMap02",
    #---------------------------------------------------------------------
    [33,34,35,36]      => "Forest01a",
    #---------------------------------------------------------------------
    # <-- Add more here if needed...
  }
 
end

class YourMapDisplay
 
  def show_map
    # Search for the correct data for the current map
    mdata = MapItem::Data.find {|mids,file| mids.include?($game_map.map_id) }
    # Do something else when there is no correct data setup for the current map
    # I just show a "No Map" image here, as an example
    return display_map_image('no_map_data') unless mdata
    # Map data found, so display the correct image
    display_map_image(mdata[1])
  end
 
  def display_map_image(file)
    # Your map image display method goes here
  end
 
end
No note-tags are needed for this.
You just setup the images used for your maps in the settings, make the map item open your map scene, and display the correct image based on your settings.

Also, you need some static part in your note-tags, otherwise your regexp can pick up anything as a match.
<Village Map> is not really a usable one, only the <> signs are constants, so if any other note-tag uses the <> signs (and almost all of them from public scripts use that), it will mess up your regexp check.
You always use a static part so that the check you do gets the correct lines that are meant to be for your script.
For example, <map_data: filename>, where the note-tag always starts with map_data:, but the filename can be anything (as long as your script can use the match retrieved from it, of course). This is just an example, not really related to your specific case.
I think you are over-complicating things here.
From the look of it, you already use a constant to store some settings, so why not use that for all settings instead?
well, sixth the problem with using a simpler solution is my script is complicated. so the first part of my script works like a world map taking all the engine maps and clustering them as one map as the display map image. A snippet of the actual data input cause this is just hard to explain in text for me
Code:
                 overall_name is my notetag word
#ex.   name[1] = [overall_name,overall_image,room max,
#                 Visted_id,visted_image,visted_x,visted_y, <= this part is 
#                ]                                                moduler

    Name[1] = ["Villege map", "HOME2ndBG", 2,
               15, "HOME2nd_Stairs", 214, 39,
               30, "HOME2nd_westC", 223,144,
              ]# do not remove

I would have explained at the start cause I thought I was just stupid at this and there was an answer to my moderately simple part of my scripts which is my bad. I also had no clue how to explain this part of my script. Second, some of the hoops I went through were to make it non-programmer-friendly as possible. which was why I didn't use <map_id: map> as well but I see your point and will change it. Also, the reason I didn't have it set up to open with the item itself is, I have it set up or planned that any item including weapons and armor can be used for a map. For those who might use it for game types that don't use weapons and armor.
I do have a script call that removes item notetaging all together but thought it easier for the dev user to only worry about a game item.

Original thread: https://forums.rpgmakerweb.com/threads/item-notebox-problem.136877/