Local variable in event?

Status
Not open for further replies.

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
It seems to me that you are overcomplicating matters.

Go ahead should that be the goal. I suggest adding some lambda functions as well. It is easy to add complexity with those, and they are also fun to play with :D

Otherwise what are you attempting to do? No, what problem are you trying to solve? Do you want to store new information specific to an event? To an interpreter? Actually want to use local variables (we already know the answer to this is no)? Share data among events?

First step is to understand how the interpreter structure work. I went ahead and search for where Game_Interpreter instances are created in the code. I found the information:

  • Battle event interpreter
  • Parallel common event interpreter
  • Parallel map event interpreter
  • Map interpreter
  • Interpreter child interpreter (Common event call)

Remember that you have different types of events

  • Battle event
  • Map event
  • Common event

Searching and finding valuable information is usually an important step.

*hugs*

 - Zeriab
 
Last edited by a moderator:

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
What do you mean, you "can't prefix the event id"? @event_id (not event_id) in the interpreter means the current event's id.
The whole point for me not ussing an attr_accessor is that an attr_accessor can not automatically prefix the @event_id in the Game_Intepreter. And neither can it be done through adding a hash-setter (not supported by Ruby)

anyway, why not just use a global variable? (aside from it denoted as $, which means 1 additional character)
Yeah a $global = {} could probable be used. Maybe I'm over complicating things.

This may interest you...

class Testerdef initialize

@local = {}

end

def local(key, value)

@local[key] = value

self.class.send:)define_method, key) do

value

end

end

end

test = Tester.new

test.local:)one, 1)

test.local:)two, 2)

p test.one

p test.two
That's pretty much what I was looking for! Thanks that should do it :) .
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

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
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top