Options YOU want on a CMS's options screen.

Started by Ryex, May 10, 2009, 09:48:57 pm

Previous topic - Next topic

Ryex

May 17, 2009, 10:11:36 pm #20 Last Edit: May 17, 2009, 10:12:37 pm by Ryexander

module RyexCFG

  PLUGINS = []
  class PlugIn
    # read/write-able
    attr_accessor :name, :action, :description

    def initialize(name = '', desc = '')
      # @name is the name which will show up in the menu,
      # @reqs is the Proc that will be called to see if the option should
      # be activated (optional),
      # and @action is the proc that will be called when
      # the option is selected.
      @name, @action, @description = name, Proc.new, desc
    end

    def call
      p 'this works'
      @action.call
    end
  end
 
end


dect = 'Opens the shop window'
RyexCFG::PLUGINS.push(RyexCFG::PlugIn.new('shop', dect) do
    $Scene = Scene_Shop.new
  end
  )


when I use
RyexCFG::PLUGINS[0].call

"this works" pops up but
@action.call

ends up doing nothing and Scene_Shop is not called
any ideas?

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo

Well, for one, you capitalized $scene (making it $Scene). Other than that, it looks like it should be working.

Ryex

changing it to $scene does nothing even a
p 'hello' does nothing
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo

Hmm... that's odd. All of that code works in IRB on Ruby 1.86. Weird 0_o

See if this works:

$test_var = false
myProc = Proc.new do
  print "Wow. Something is screwy in RMXP.\n"
  $test_var = true
end
myProc.call
print "Wow, something is EXTRA screwy in RMXP.\n" unless $test_var

Ryex

I got it working... stupid mistake on my part...
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo


Ryex

lol how should I say this the way I had the code set up it never Called the Proc it just appeared to so the above code was good but how I put it into my menu was not...
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />