Author Topic: [RESOLVED][XP] Hidden database text  (Read 1188 times)

Offline Alyon93

  • Trained Member
  • *
  • Posts: 15
  • LV: 0
    • View Profile
[RESOLVED][XP] Hidden database text
« on: March 19, 2015, 12:09:22 AM »
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  :)
« Last Edit: March 19, 2015, 11:49:08 PM by Alyon93 »

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3200
  • LV: 385
  • Gender: Male
  • Choco Octo <3
    • View Profile
Re: [XP] Hidden database text
« Reply #1 on: March 19, 2015, 02:43:21 AM »
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:
Code: [Select]
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.
« Last Edit: March 19, 2015, 06:20:10 PM by KK20 »



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


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

Join the CP Discord Server!

Offline Alyon93

  • Trained Member
  • *
  • Posts: 15
  • LV: 0
    • View Profile
Re: [XP] Hidden database text
« Reply #2 on: March 19, 2015, 02:30:49 PM »
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.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 851
  • LV: 517
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Hidden database text
« Reply #3 on: March 19, 2015, 05:17:49 PM »
try this

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

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3200
  • LV: 385
  • Gender: Male
  • Choco Octo <3
    • View Profile
Re: [XP] Hidden database text
« Reply #4 on: March 19, 2015, 06:21:55 PM »
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 AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


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

Join the CP Discord Server!

Offline Alyon93

  • Trained Member
  • *
  • Posts: 15
  • LV: 0
    • View Profile
Re: [XP] Hidden database text
« Reply #5 on: March 19, 2015, 11:48:48 PM »
Awesome guys!
Cheers  :)