[RESOLVED][XP] Hidden database text

Started by Alyon93, March 18, 2015, 05:09:22 pm

Previous topic - Next topic

Alyon93

March 18, 2015, 05:09:22 pm Last Edit: March 19, 2015, 04:49:08 pm by Alyon93
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  :)

KK20

March 18, 2015, 07:43:21 pm #1 Last Edit: March 19, 2015, 11:20:10 am by KK20
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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Alyon93

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.

LiTTleDRAgo

try this


class RPG::State
  alias get_state_name name
  def name
    get_state_name
    return @name.gsub(/\[(.+?)\]/) {""}
  end
end

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Alyon93