RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RMVXA] npcList (request rewritten for more clarity) [REQUEST]

0 Members and 1 Guest are viewing this topic.

*
Rep: +0/-0Level 55
RMRK Junior
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.

Code: [Select]
#===============================================================================
# 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
« Last Edit: October 17, 2012, 08:43:50 PM by RoxRebellious »