Jump to content
syvkal

~[Notes Field System]~

Recommended Posts

Notes Field System
Standardising the Database Notes Field
Version: 1.3


Introduction

I'm trying to make an easy to use System, for scripters and non-scripters alike, that will standardise how we use the notes field in the database.
I've tried to make the coding simplistic and the database set up minimal.

Terms of Use

Please read the Script Header ;)

Features
  • Defines a new note_field for all Base Items
  • Uses symbol tags and Hashes for easy scripting
  • Should be fully compatible with other peoples scripts
Screenshots

N/A

Script

Click Here

Instructions

Put it under the Materials Section
Further instructions can be found in the script header.

Compatibility

Should be fully compatible with other peoples scripts

Currently used in the following scripts:

  • Passive Skills VXAce - Syvkal
  • Linked Skills & Enchanted Equipment VXAce - Syvkal



Author's Notes

Hope you find it useful, and maybe this will revolutionise how we access the notes field ;)
Also, if anyone creates a script that uses this system, let me know and I'll add it to the list =]

Edited by syvkal

Share this post


Link to post
Share on other sites

Yay glad to hear it =D

 

Also could you send me a link to 'Icy's Hash method'? I want to know what it is :P I like anything to do with hashes xD

Share this post


Link to post
Share on other sites

# // 02/03/2012 [
#Collects the hash keys in order, and then passes the values
class Hash
# // IceDragon <=== *The Ultimate in Awesome OTL
 def get_values(*args)
args.collect {|a|self[a]}
 end
end  
# // 02/03/2012 ]

 

Pretty much it returns all the keys defined in order....this can be very useful when dealing with multiple keys, and defining values to them. For example:

 

def extra_stats(*args)
 str, dex, con = args[0].get_values[:str, :dex, :con]
 actor.str = str || 18
  #Other stuff here with dex and con
  #If :str is not defined, then it goes to 18.
end

 

The get_values method from Icy's script just returns the values to the variables defined. The cool thing is that you don't NEED to have the keys, if that makes sense? If you want to see how it's used in my text pop script you can check it out here:

 

http://www.rpgmakerv...ps-over-events/

 

I also want to check out a few things first, as this could be an awesome way for scripters to be on the same page with notetags.....

 

I might use this method along with this script for my extra stats script! :)

Share this post


Link to post
Share on other sites

Ooh I see how that could be useful =D

Not for anything I'm making - yet anyways :P

But still useful nonetheless ^-^

 

Also, if anyone creates a script that uses this system, let me know and I'll add it to the list in the main post =]

Share this post


Link to post
Share on other sites

Updated Version 1.1

Sort of Major Bug Fix

  • Now matches '<' '>' wrap correctly
  • Now allows tags to be above or below excluded text

Edited by syvkal

Share this post


Link to post
Share on other sites

The Yanfly scripts use < > for note tags. Is there anyway to allow < > symbols in note tags with this script? This script keeps crashing

when used with Yanfly script tags.

Share this post


Link to post
Share on other sites

I hope I can explain this. I am using the Learn Skill script from Yanfly with your Field Notes and

Passive Skill scripts.

 

It works fine when I do this:

 

<learn cost: 0 jp>

:passive => 131

 

Both tags work great, no errors, no crash.

 

But when I have TWO Yanfly tags then it crashes! Here's an example of some tags that will

crash the game:

 

<learn cost: 0 jp>

<learn require level: 1>

:passive => 130

 

The crash message is posted to this reply as an attachment. What I am looking for is a way to let me have two < > tags. The script works when I just have one. Thank you.

post-4125-0-81165800-1332985249_thumb.png

Share this post


Link to post
Share on other sites

Hmm, make sure you've got the newest version, it should have fixed this problem.

Check it has the line:

notes.slice!(/\<.*?\>/m)

exactly (it needs the '?' ^-^ )

Edited by syvkal

Share this post


Link to post
Share on other sites

I'm still getting the same error message about line 99 which is:

 

notes = eval("{#{notes}}")

 

Am I doing something wrong in regards to seperating the note tags? If I have a few notetags like this:

<example>

<example1>

<example2>

 

It will just crash and say there was an unexpected '<'. I appreciate all the help. Your note fields script is fantastic, I would just like to understand how I can use it with other scripts.

Share this post


Link to post
Share on other sites

Ok, script works great. I'm so excited because this script, your Passive Skill script and Yanfly's scripts opens up a ton of fun options like learning Passive skills via a job system. Thanks for all the help!

Share this post


Link to post
Share on other sites

Hello,

If it's not ok to post this far after the last reply, I apologize. I have been using this script in order to implement your passive skills. Recently I have started doing some Yanfly Lunatic tags in my noteboxes, and whenever they take the form of

<header>

string

string

</closer>

I get an error message due to the strings not being surrounded by < and >. The problem is that if I include the < and >, I get an error from Yanfly's script. Do you know of a way to work around this? Thank you for your help and your great scripts.

Share this post


Link to post
Share on other sites

change

notes.slice!(/\<.*?\>/m) while !notes.slice!(/\<.*?\>/m).nil?

to

notes.slice!(/\".*?\"/m) while !notes.slice!(/\".*?\"/m).nil?

the above code will ignore things inside quotes now

Share this post


Link to post
Share on other sites

I don't think I explained it well enough. The code in the notebox looks like this...

 

<custom cost requirement>

$game_variables[146] != 0

</custom cost requirement>

<custom cost perform>

$game_variables[146] -= 1

</custom cost perform>

 

and it doesn't work because I can't put the lines of code within < and > or I will get an error from Yanfly's script. If I don't put them in those brackets I get an error from syvkal's script. I think it might only require a small change to this script, and any help would be appreciated. Thank you.

Share this post


Link to post
Share on other sites

Ok try replacing this:

notes.slice!(/\<.*?\>/m) while !notes.slice!(/\<.*?\>/m).nil?

With this:

notes.slice!(/(\<.*?\>|\#.*?\#)/m) while !notes.slice!(/(\<.*?\>|\#.*?\#)/m).nil?

(I haven't tested this fully, but it should work)

 

Now to remove anything from being read in my script you can either use the '<...>' tags OR '#...#' where the ... represents whatever is contained in the tags.

So for example your notebox will look like this:

#
<custom cost requirement>
$game_variables[146] != 0
</custom cost requirement>
<custom cost perform>
$game_variables[146] -= 1
</custom cost perform>
#

 

OR

 

#
<custom cost requirement>
$game_variables[146] != 0
</custom cost requirement>
#
STUFF CAN GO HERE 
#
<custom cost perform>
$game_variables[146] -= 1
</custom cost perform>
#

 

Hope that works and doesn't conflict with anything in the Yanfly scripts ^-^

Share this post


Link to post
Share on other sites

Ooooh interesting concept, though I personally I would prefer if it done like this though:

 

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

# ** NOTES Module

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

# Handles Notes Field System operations

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

 

module NOTES

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

# * Gets the Field

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

def field(note)

notestr = ''+note

notes=[]

notestr.split(/[\r\n]+/).each do |line|

if line =~ /\A\s*(:.*\s*=>\s*.*[^\s,])/

notes.push($1)

end

end

return eval('{'+notes.join(', ')+'}')

end

end

 

No need to surround existing notes with anything this way... Also I think doing this may speed it up slightly:

 

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

# ** RPG::BaseItem

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

# Defines the Note Field

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

 

class RPG::BaseItem

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

# * Includes The NOTES Module

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

include NOTES

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

# * Gets the Note Field

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

def note_field

@note_field = field(note) if @note_field.nil?

return @note_field

end

end

 

that way it doesn't need to do the regex thing every time

Edited by KilloZapit

Share this post


Link to post
Share on other sites

Updated Version 1.3

  • Compatibility Upgrade
I've not really been active at all, but just saw your suggestion KilloZapit and decided that I could at least update this script if nothing else xD

 

The script now requires no additional set-up to make it compatible with other scripts. In addition, you no longer need to add commas ',' at the end of the tag lines, but it will still work if you do ^-^

Share this post


Link to post
Share on other sites

Neato! I am glad you liked the suggestion! I have been using this for all sorts of stuff myself, it's super useful! :3 (You might want to edit the first post a bit now that you know longer need to exclude text, but whatever.)

 

It's kind of interesting how you used delete_if there :3

Share this post


Link to post
Share on other sites

Haha edited the first post, cheers ^-^

I probably could have done it a bit neater, but I was just shoving it all on one line XD

 

I realised that this could be quite useful for the 'Comments' command in the event pages. So I'm making a similar System for scripters intending to access the comments within events. It's pretty much done and was quite simple, so expect that shortly too =]

Share this post


Link to post
Share on other sites

Though with events, you can set it up with a script command, though I guess that's not useful if you have things you want to set up before running an event... It might be nice to allow full page setup script calls in comments rather then just hashes, but I don't know.

Share this post


Link to post
Share on other sites

Not sure if you are still active, but I changed my mind about the event thing. I made myself a script for comment note fields and it's really helpful! Check it out!

 

 

class Game_Event < Game_Character

 

alias_method :setup_page_note_base, :setup_page

def setup_page(new_page)

setup_page_note_base(new_page)

hash = {}

unless @page.nil?

@page.list.each do |item|

next unless item.code == 108 || item.code == 408

if item.parameters[0] =~ /\A\s*:([^\s:]*)\s*=>\s*(.*[^\s,])/

hash[$1.to_sym] = eval($2) rescue $2

end

end

end

@note_field = hash

end

 

def note_field

@note_field ||= {}

end

 

end

 

 

I might release my own version of the note field thing as a whole new script, because I really have drifted a bit from your version... My personal version also has support for note fields on maps, but that's not hard to add at all.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

I can NOT get this damn thing to work. Does it not work on trial versions? I have tried every combination of writing the phrase " :passive => 150 " I can freaking think of and it will NOT work. Spaces, no spaces, with and without brackets everywhere- What the hell am I doing wrong?

Edited by IvoryErebus

Share this post


Link to post
Share on other sites

@ivoryeberus: you need to explain what you do before complaining. first describe what you wanted to do with this script and then explain step what you have done so far. then what kind of behavior you expecting and what kind of error you encountered. it will help the author finding what's wrong.

 

did you install the passive script too? or just this script?

this is scripter tool and will NOT give you passive without writing the code for that yourself (or use other syvkal script)

Edited by estriole

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted