Please help me about script for Skill Note

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
696
Reaction score
215
First Language
Vietnamese
Primarily Uses
RMMV
Hi guys,

I have changed the display of skill description to allow it to get the text i write in its Note Box overwritting this method:

class Window_Help < Window_Base #-------------------------------------------------------------------------- # * Set Item # item : Skills and items etc. #-------------------------------------------------------------------------- def set_item(item) set_text(item ? item.description + "\n" + item.note : "") endendThe problem is: I'm using other scripts that required Note Tags "<example>" in the Note Box in order to use, and the method above also write these Note Tags inside my description. Now i want to changed this Set_Item method to ignore any Note Tags between these "<" and ">" or only display from a certain line (Like display from line 5 in Note Box cuz 1 to 4 are used for Note Tag of other scripts) so how can i do it?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
I can't test this now, but you can try this:

item.note.gsub(/\s*<.+>\s*/, " ")This should replace all occurences of "<...>", including the whitespaces around, with a space.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
unfortunately it depends on the scripts in your project if a simple filter of the <..> tags will work or not - some scripts have different formats for their tags, for example https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-targets/

(check the second option there - the "String" would still be printed in such a case).

It would be a lot better if you follow the same structure as all scripts do: instead of ignoring other notetags and use what is left, define your own tag, search for it and then use only that part of the notetag to display.

for example

<item description>description as you want</item description>
That is a lot more work, but it will improve compatibility and still allow you to use the note box for its original purpose: your developer notes that no one can see ingame.
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
696
Reaction score
215
First Language
Vietnamese
Primarily Uses
RMMV
unfortunately it depends on the scripts in your project if a simple filter of the <..> tags will work or not - some scripts have different formats for their tags, for example https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-targets/

(check the second option there - the "String" would still be printed in such a case).

It would be a lot better if you follow the same structure as all scripts do: instead of ignoring other notetags and use what is left, define your own tag, search for it and then use only that part of the notetag to display.

for example

<item description>description as you want</item description>That is a lot more work, but it will improve compatibility and still allow you to use the note box for its original purpose: your developer notes that no one can see ingame.
I know the method from lavra can't be used in some certain script tags and defining an own tag like you mentioned is the best way. But actually i have very very little knowledge about scripting so it is really hard for me to do this.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
item.note.match(/<note>(.+)<\/note>/).flatten.joinNow this is still untested and will probably not work quite right, but in theory it should get you everything encased in "<note>...</note>", join it together and give you the string back.

Did i mention i'm one of the few guys who actually like regexes? :D
 
Last edited by a moderator:

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
696
Reaction score
215
First Language
Vietnamese
Primarily Uses
RMMV
item.note.match(/<note>(.+)<\/note>/).flatten.joinNow this is still untested and will probably not work quite right, but in theory it should get you everything encased in "<note>...</note>", join it together and give you the string back.
I have tested your method with the single <note> you mentioned above and it worked, but somehow it added some space before the description text. I think it is caused by some <note> i used above the description.

And about <note>...</note>, i have not used any of them so i'm not sure about that, but i will remember this method and try it when necessary.
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Ah, in this case you can just change the tagname to something else that is unique.
 
Last edited by a moderator:

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
696
Reaction score
215
First Language
Vietnamese
Primarily Uses
RMMV
I wrote the description over all tags and the problem about odd space was solved.

By the way, Andar's method is highly recommended for those who are good at scripting (not including me ;_;  ) 

Thank you all for your help  :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top