Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> [SOLVED]Quick (hopefully) question about arrays
munkis
post Jan 28 2012, 06:36 AM
Post #1


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Basically what I'm trying to figure out is how to make something happen in a script when the status of an element (any element) in an array changes.

This post has been edited by munkis: Feb 1 2012, 07:11 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Jan 28 2012, 08:50 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




What do you mean with "the status of an element"?

Anyway, if you wanna check if an array was modified, then:

class Script

def initialize(element_array)

@old_array = element_array.clone
...
end


def update
...
element_array = #the array you wanna check#
if @old_array != element_array
@old_array = element_array.clone
trigger #trigger method
end
...
end

def trigger
#what happens when array changes#
end

end

I hope this is clear enough...
Feel free to ask for support.

Jens

This post has been edited by Jens of Zanicuud: Jan 28 2012, 08:53 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 10:18 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker