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.
calling a varying hash?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
i was wondering if it is possilbe to call a certain hash based on a variable. i.e. like calling different arrays using a hash, but using the next step further than a hash??? (superhash? idk)

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
I am not really sure what exactly you want.
I suggest you try to explain what you want to accomplish.

***
Rep:
Level 87
wat im saying is, and much like my earlier question about arrays, i have two hashes:
Code: [Select]
Arshes = {
 'v1' => [2,3],
 'v2' => [3,4]
}
Basil = {
 'v1' => [6,29],
 'v2' => [8,31]
}
now i want the game to call "the actors name"['v1'][1], so how do I do that?

*
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 Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I suppose you could make a hash like this: {'Arshes' => {'v1' => [2,3], 'v2' => [3,4]}, 'Basil' => {'v1' => [6,29], 'v2' => [8, 31]}} though I don't know if that would work (I don't see why not though)

Or you could make a method with case branches, as in

Code: [Select]
def get_actor (name)
  case name
  when 'Arshes'
    return {'v1' => [2,3], 'v2' => [3,4]}
  when 'Basil'
    return {'v1' => [6,29], 'v2' => [8, 31]}
  end
end

It seems like this is a fairly complicated structure. What are you planning?  :o

***
Rep:
Level 87
Hahaha, another super late reply, but who cares zzzz. Might as well leave all ?'s answered and resolved. I did in fact find a silly way to circumvent this problem using some instance variables and stored hashes.

It seems like this is a fairly complicated structure. What are you planning?  :o
Actually, the purpose of this is to make things less complicated :P. Simply, I'm just making easily accessible data banks w/ quick references to make data input easy on me. I'm much more accustomed to typing out a nice organized spreadsheet for my data than anything else.