Switching language in module Vocab

IceDragon

Elder Cookie Dragon
Veteran
Joined
Mar 8, 2012
Messages
73
Reaction score
63
First Language
English
Primarily Uses
N/A
I tried that script call and it works :D


However, the RTP Scripts uses Vocab::Constant to access the string.


It still can't be done by your trick
Just overwrite everything (its what I do, and I'm more productive that way)


Sometimes you gotta break stuff to make it better, like a few bones and few noses when things won't go your way.


Its even better ifs its just your project as well (you can get away by breaking as much compatability as you need to).


I prefer foundation fixes rather than countless patches.


If its broken at the core, then fix it at the core, the more you try to work around the problem is the more pronounced it becomes.


oh boy there I go again ranting on. :x sowwy.


Summary: Just replace all the constant calls with method calls, it may be a bit of work in the beginning but it will be well worth it.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
@icedragon: we can change default rtp script. but we might still have issues with 'other' people script. since i've seen some that use Vocab::Blablabla too in their script. it won't matter if this only concerning our project. but theo might want to create 'multi language' script and release it to public (in his community perhaps). it will cause that script could have lots of incompatibility with other scripter script(there's script by galv that have issues like that. i think the script that define unique actor stats vocab)... and since it's used by community... who knows what script they slap in their project. :D .
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Just overwrite everything (its what I do, and I'm more productive that way)


Sometimes you gotta break stuff to make it better, like a few bones and few noses when things won't go your way.


Its even better ifs its just your project as well (you can get away by breaking as much compatability as you need to).


I prefer foundation fixes rather than countless patches.


If its broken at the core, then fix it at the core, the more you try to work around the problem is the more pronounced it becomes.


oh boy there I go again ranting on. :x sowwy.


Summary: Just replace all the constant calls with method calls, it may be a bit of work in the beginning but it will be well worth it.
No, I wouldn't go in that way if I planned to release script for public. What I'm trying is to make it has a high compatibility as possible. Since many scripts also reference in default script.
But it's different matter if I'm working on my personal project. I don't care if someone breaking the encryption and steal my script. I might rewrite the core so they wont be compatible to other script (and I really did it).


Well, just like estriole has mentioned
 

IceDragon

Elder Cookie Dragon
Veteran
Joined
Mar 8, 2012
Messages
73
Reaction score
63
First Language
English
Primarily Uses
N/A
>_< FINE HAZ IT YOUR WAY *storms off, leaving a bit of code behind*

Code:
module Vocab  class << self    def const_missing(sym)      if respond_to?(sym)        send(sym)      else        super(sym)      end    end    def MyConst      "Hello World"    end  endendp Vocab::MyConst
Code:
module Vocab  MyConst = "Something"  const_set(:MyConst, "new_value")endp Vocab::MyConst
I would avoid this method, since re-defining a constant is normally illegal. (Hence why its called a constant, without change), it raises a warning in ruby.
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,309
Reaction score
531
First Language
indonesian
yeah defining constant is normally illegal. it's the RM fault that use constant for vocab :D .

but in their defense. they might not consider people wanting to change languages :D .

hopefully next RM will use method for vocab so it can redefine easily :D .
 

btw the first code is interesting... maybe we can define new method to replace the all the constant.

first deleting all the constant used using

remove_const:)CONSTANT)edit: wow we don't need to remove the constant at all :D . i didn't see that at first. i guess when we call constant it will go to const_missing method.first... nice...

edit2: after more test we need to remove the constant first if the constant already exist:

ex:

module Vocab  MyConst = "test"  class << self    def const_missing(sym)      if respond_to?(sym)        send(sym)      else        super(sym)      end    end    def MyConst      "Hello World"    end  endendp Vocab::MyConstwill print "test"

module Vocab  MyConst = "test"  remove_const:)MyConst)  class << self    def const_missing(sym)      if respond_to?(sym)        send(sym)      else        super(sym)      end    end    def MyConst      "Hello World"    end  endendp Vocab::MyConstwill print "Hello World"
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

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
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,574
Latest member
nikisknight
Top