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.
How do I address the "words" for elements?

0 Members and 2 Guests are viewing this topic.

***
Rep:
Level 82
We learn by living...
for example, when I rename the element 001: Fire (in the database/system) to something like Heat,

so in the database it reads 001: Heat

how do I access the word "Heat"?

I've tried a wide variety of script and nothing works.

examples of my past failures...

Code: [Select]
p $data_system.words.element_ranks[1]

p $data_system.element_ranks[1].name

p $element_ranks[1].name

p $data_elements[1]

p $data_elements[1].name

p $data_system.words.data_elements[1]

I think I've run out ways to screw up a light bulb.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Once you realize that RPG:: can usually be substituted with $data, I'm sure you'll find this out by yourself.



***
Rep:
Level 82
We learn by living...
Once you realize that RPG:: can usually be substituted with $data, I'm sure you'll find this out by yourself.

or not.

p $data.element[1]

p $data.elements[1]

p $element_set[1]

p $data.element_set[1]

...

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Code: [Select]
$data_system.elements[element_id]

Seriously shin, Help File ~ do a search for element and you will see RPG::System come up. Click on it and you will see:

Quote
elements
 
Element list. Text array using element IDs as subscripts, with the element in the 0 position being nil.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
Using the help file tends to take a little digging to find some things, but searching will get you in the right spot to start.

Also, why do you need to fetch the name from the array?  It's never going to change, and you already know which ID corresponds to which Element Name, as it's in the database.  Why not just use the ID?

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 82
We learn by living...
Code: [Select]
$data_system.elements[element_id]

Seriously shin, Help File ~ do a search for element and you will see RPG::System come up. Click on it and you will see:

Quote
elements
 
Element list. Text array using element IDs as subscripts, with the element in the 0 position being nil.

I got pretty close, with

Code: [Select]
p $data_system.words.element_ranks[1]
p $data.elements[1]

 but I actually don't understand that sentence in the help file, and thought it meant it would display another range of 0-6. I'm an East Asian studies major, not a computer programmer.

>>

I needed the words because I'm constructing a Charisma stat that is exploiting the Element array to make a "likes/dislikes" table for stuff like good/evil, light/darkness, tech/nature, etc. I've got a second Status menu and I needed to know how to pull "words" for stuff like this:

Code: [Select]
when 5
      parameter_name = $data_system.words.agi
      parameter_value = actor.agi
    when 6
      parameter_name = $data_system.words.int
      parameter_value = actor.int

basically it would compare the numeric total of deviation from C between the actor and the NPC/enemy to determine a reaction score total. Players will get to choose "affinities" or ideas to symbolize, and then pump points in them. Their point pool is going to be based on something like charisma/10.

By spending the points, the elements display in their Status II screen (in theory), like equipment.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
Yeah but you can use the ID's for that.
You don't need the words.

In fact, you need the ID to get the word, you're just adding another step in there.  You'll always know the ID, and you'll always know which Element corresponds to which ID.  There's no need to dynamically grab the Element Name.  It's never going to change.  The amount of like-dislike might, but the name is never going to change.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 82
We learn by living...
Yeah but you can use the ID's for that.
You don't need the words.

In fact, you need the ID to get the word, you're just adding another step in there.  You'll always know the ID, and you'll always know which Element corresponds to which ID.  There's no need to dynamically grab the Element Name.  It's never going to change.  The amount of like-dislike might, but the name is never going to change.

I'm programming in the stat for my fiancee's game, they don't do script, but have plans on changing the elements from the database in the future. otherwise I would just put "fire" etc. like when I added Faith
Code: [Select]
    when 8
      parameter_name = "Faith " #Faith added by Shin
      parameter_value = actor.faith 

my fiancee refuses to do script. So this is oddly less hassle.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
ok let's put it in pseudocode

> get the ID that they are modifying
> set a variable to the name of the element at ID
> if the variable name is "whatever"
> do blah blah blah

ALTERNATIVELY

> get the ID they are using
> if ID = number
> do stuff blah blah blah

less steps, thus less computing power is necessary to process it, making the script much more efficient.

You can use a simple switch/case to make it easy to configure for the non-scripter.  So much easier to just use the ID.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
I think he wants to draw out the name of the element, NAM, not use it as a reference. So have a window that says something like:

x resistance: 100%
y resistance: 120%

So have it take the values of x and y from the word set in the database and draw it on a window.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
I think he wants to draw out the name of the element, NAM, not use it as a reference. So have a window that says something like:

x resistance: 100%
y resistance: 120%

So have it take the values of x and y from the word set in the database and draw it on a window.

if that's the case you could still use the ID's, but if you can find a way to use the names for that then it could be easier to configure.

you'd have to be careful that the ID's never changed though.

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon