Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RMVXA] npcList (request rewritten for more clarity) [REQUEST]

Started by RoxRebellious, October 17, 2012, 01:33:41 PM

0 Members and 1 Guest are viewing this topic.

RoxRebellious

npcList
Searching and changing data of external files
<18-10-2012>




Summary
This script opens a file located in the /data/npc folder and searches for a statement and it's value so other scripts can use it.
A second command can overwrite the value of a statement to a new value.

The variable are from all types.
The files will hold massive amounts of information.

The reason I want this is I want more information about Actors and NPC's. And I want to be able to easily tweak, add or delete NPC's.

Features Desired

  • A script that opens and searches in files for certain strings
  • a script that can alter the data

Features Desired
After an night trying, I have written a piece of code that is totally wrong but gives you a more clear feel of what I want to accomplish.




Code
After some research I have tried to write a code. I have no doubt it is completely wrong but it might give an idea of set up.


#===============================================================================
# npcList
#===============================================================================
# This script will get two or three commands from other scripts.
# npcValue
# attribute
# newAttribute
#
# It will look inside the /data/npc folder for the .txt file defined with the
# npcValue variable. Here it will search for the value behind the statement
# defined by the attribute variable. Lastly if needed the statement will be
# rewritten with the value of the newAttribute Variable.
#
# For example, you search the maximum HP of Claudia who is the fourth NPC. You
# will give the command "LookUp, 004, MHP"
# If you want to change this value you give the command "Overwrite, 004, MHP,
# 100"
#===============================================================================
class NpcList
  attr_accessor :npcValue
  attr_accessor :attribute
  attr_accessor :newAttribute
 
#===============================================================================
# Look Up
#===============================================================================
  def LookUp
    File.open (/date/(/npcVal/)*.text).grep(/attribute/)
  end
 
#===============================================================================
# Overwrite
#===============================================================================
  def Overwrite
    File.open /data/(':npcVal.txt')."gsub(/atrribute/, /newAttribute)" *.txt
  end
end


Games its been in
All modern games uses databases to define game objects.




Did you search?
Yes

Where did you search?


What did you search for?
RPG Maker VX external database of separated files