Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: Alyon93 on March 18, 2015, 05:09:22 pm

Title: [RESOLVED][XP] Hidden database text
Post by: Alyon93 on March 18, 2015, 05:09:22 pm
Hi there!
I don't know if this should go under tutorials or under scripts.
To some of you this question might be stupid, but I hope you'll answer as well.
I already tried the search box but I couldn't find any advice on this(probably because of wrong query).
My question is: is there a way to hide some text from database entries? I'd like to use this hidden text for reference during the game development but I don't want the user to see them.
For instance, I have a status called Limit which activates when the character is near death. Every character has a unique limit for instance character1 limit is about him covered by thunders and I expect it to increase his speed while in this status, but character2 has earth element so his limit should increase his defense.
Now for doing so, I need two different limit statuses but, while I want to see in the database the corresponding status "Limit character1", I want the user to only see Limit for every character.
Is there a special character beyond that every text in the database is hidden like comments in scripts?
Or it has to be done by script? In this case i'm pretty sure it won't give you any trouble to do it for me right?
Thanks in advance and sorry as always for the long texts and the bad english  :)
Title: Re: [XP] Hidden database text
Post by: KK20 on March 18, 2015, 07:43:21 pm
All database text entries are saved as String literals--what you type in is what you get.
You have to resort to scripting for what you want. I've whipped up something quick for you to study:

class RPG::State
 alias get_state_name name
 def name
   get_state_name
   return @name.gsub(/\s*\[(\w|\s)*\]\s*/) {""}
 end
end

With this, which can most likely be inserted anywhere in your script listings, you can name your states
Quote
Limit [Player 1]
Limit[Bob]
Limit [John][Type 1]
E [John] limi [Type 2] nation

Anything inside square brackets will be ignored in-game when accessing the state's name.
Title: Re: [XP] Hidden database text
Post by: Alyon93 on March 19, 2015, 07:30:49 am
As always, thanks for the help you give me. I appreciate it.
How ever it gives me a syntax error in line 5.  I'll try to solve the problem too but I'm really not very confident with RGSS yet.
Title: Re: [XP] Hidden database text
Post by: LiTTleDRAgo on March 19, 2015, 10:17:49 am
try this


class RPG::State
  alias get_state_name name
  def name
    get_state_name
    return @name.gsub(/\[(.+?)\]/) {""}
  end
end
Title: Re: [XP] Hidden database text
Post by: KK20 on March 19, 2015, 11:21:55 am
I actually had an extra parenthesis--was moving too fast with my thinking.

Anyways, just use Drago's solution. I couldn't remember at the time what symbols to use.
Title: Re: [XP] Hidden database text
Post by: Alyon93 on March 19, 2015, 04:48:48 pm
Awesome guys!
Cheers  :)