Adding info to the Status Scene using Simple Notetags Grabber by Estriole

Here is a pic of what I'm trying to do...

image.jpg

Only instead of "Gender" and "Race", I'd like to display the corresponding info located in the actors Notetag in this picture...

image.jpg

I put this together based on the default scripts...

#==============================================================================# ** Window_Base#------------------------------------------------------------------------------# This is a super class of all windows within the game.#==============================================================================class Window_Base < Window #-------------------------------------------------------------------------- # * Draw Simple Status #-------------------------------------------------------------------------- alias bluemith_draw_actor_simple_status draw_actor_simple_status def draw_actor_simple_status(actor, x, y) bluemith_draw_actor_simple_status(actor, x, y) draw_actor_race(actor, x, y + line_height * 2) draw_actor_gender(actor, x, y + line_height * 3) end def draw_actor_race (actor ,x ,y) @actor_race = "Race" draw_text_ex(x, y, @actor_race) end def draw_actor_gender (actor ,x ,y) @actor_gender = "Gender" draw_text_ex(x, y, @actor_gender) endendWhat I'm struggling with is how to make the script grab the note tag and display the proper information... I'm using this script, www.rpgmakervxace.net/topic/10545-est-simple-notetags-grabber/, but as I am a noob scripter, I just can't figure out how it should be written.Thanks!!

Edit, I have no idea why the editor did that it my code or why it made my pics so blurry...

#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

# This is a super class of all windows within the game.

#==============================================================================

class Window_Base < Window

#--------------------------------------------------------------------------

# * Draw Simple Status

#--------------------------------------------------------------------------

alias bluemith_draw_actor_simple_status draw_actor_simple_status

def draw_actor_simple_status(actor, x, y)

bluemith_draw_actor_simple_status(actor, x, y)

draw_actor_race(actor, x, y + line_height * 2)

draw_actor_gender(actor, x, y + line_height * 3)

end

def draw_actor_race (actor ,x ,y)

@actor_race = "Race"

draw_text_ex(x, y, @actor_race)

end

def draw_actor_gender (actor ,x ,y)

@actor_gender = "Gender"

draw_text_ex(x, y, @actor_gender)

end

end
You could try something like this:

class Game_Actor def gender @gender ||= /<gender: *(\w+) *>/i =~ actor.note ? $1 : "" end def race @race ||= /<race: *(\w+) *>/i =~ actor.note ? $1 : "" endendYour draw_actor_gender method would then look like this:

def draw_actor_race(actor ,x ,y)  draw_text_ex(x, y, actor.race)end*edit*

Have not seen that you use a notetag grabber script.

I dont know how you can make it work with that script, since I dont looked at it.
Excellent!! Could you explain to me how that works? I'm learning as I go and I would love to understand all that means so I can use it for other things in the future.

@gender ||= /<gender: *(\w+) *>/i =~ actor.note ? $1: ""

If you could just explain that line, you will be my hero for the day!
The expression

||=is short for: 

@gender || @gender = /<gender: *(\w+) *>/i =~ actor.note ? $1: ""# or this:if @gender   @genderelse  @gender = /<gender: *(\w+) *>/i =~ actor.note ? $1: ""endSo it kind of checks if @gender is initialized and if it is it will return @gender otherwise it will initialize @gender

This line is a ternary operator(condition ? true_case : false_case):

/<gender: *(\w+) *>/i =~ actor.note ? $1 : ""can be translated to this:

if /<gender: *(\w+) *>/i =~ actor.note  return $1else  return ""endThis is a regular expression:

/<gender: *(\w+) *>/iGoogle it to understand what the expression means, you can use rubular.com to experiment with expressions.

And this line:

/<gender: *(\w+) *>/i =~ actor.noteWill search the actors note for this: <gender: text> and will save the result in $1.

So you can write the whole line(@gender ||= /<gender: *(\w+) *>/i =~ actor.note ? $1 : "") like this:

Code:
if @gender  return @genderelsif /<gender: *(\w+) *>/i =~ actor.note  @gender = $1else # if the regular expression dont find a match  @gender = ""end
That's amazing! Thanks 🙂

How would I modify this to read a Notetag with a space? <race: Half Elf>
You could use these expressions for example:

/<gender: *([a-zA-Z ]+) *>/i/<gender: *(.+) *>/iThe first one would be able to catch unlimited words with whitespaces between "<gender:" and ">"

The second one would catch everything between  "<gender:" and ">"

So something like this:

<gender: hero$12>

would only work with the second expression,
That's awesome! Thanks a ton! You have opened up quite a few doors for me.

Original thread: https://forums.rpgmakerweb.com/threads/adding-info-to-the-status-scene-using-simple-notetags-grabber-by-estriole.32061/