how to input a array in a hash?

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Hi people I was working on my script and for convenience sake I wanted to be able to input method in array but I use for configurations Hash if I show 

hashconfig ={ :array_method =[1,1]}I want to being able to extract the content for use it...and no I don't want to spare that into a different section I have to make it usable in the hash simply because I use it for my AI_Personality[ai_id] ={ } who can be different from each.

I hope you will be able to help me thanks :)
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,545
Reaction score
3,715
First Language
Java's Crypt
Primarily Uses
RMMZ
Code:
hashconfig ={ :array_method => [1,1]}
this works too:
Code:
hashconfig ={ array_method: [1,1]}
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
okai but how I can even extract the information from the array inside the hash?? I tried but this not worked but maybe I do a error of syntax...
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,545
Reaction score
3,715
First Language
Java's Crypt
Primarily Uses
RMMZ
hashconfig[:array_method]is an array like any other.This will show you the values:

Code:
p hashconfig[:array_method]
By default array indexes will start with 0, so in that example, you have two indexes: 0 and 1
Code:
hashconfig[:array_method][0]hashconfig[:array_method][1]
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
thanks man : D ! 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top