• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Confusion with Options

  • 217
    Posts
    15
    Years
    • Seen Nov 29, 2021
    So the following doesn't seem to work:
    Code:
           EnumOption.new(_INTL("Scale Wild Pok?mon"),[_INTL("On"),_INTL("Off")],
              proc { $PokemonSystem.scaling },
              proc {|value| $PokemonSystem.scaling=value }
           ),
    Code:
    if $PokemonSystem.scaling==0
    And I'm not going to pretend to know enough to know why.

    If it helps this didn't work either:
    Code:
    if $PokemonSystem.scaling== "On"
     
    For the sake of argument, what are you trying to do?
    Using a slightly modified version of your code (It has the conditional, and a debugging print statement), I don't have any issues.
    Code:
    EnumOption.new(_INTL("Scale Wild Pok?mon"),[_INTL("On"),_INTL("Off")],
              proc { $PokemonSystem.scaling },
              proc {|value| $PokemonSystem.scaling=value 
              Kernel.pbMessage(_INTL("PKMNSys: {1}, value: {2}",$PokemonSystem.scaling,value))
              if $PokemonSystem.scaling == 0
                Kernel.pbMessage("It did something!")
              end}
           ),
    [PokeCommunity.com] Confusion with Options

    For what it's worth, I did have to add the attr_accessor in class PokemonSystem, and initilized it to 0.
    Spoiler: My PokemonSystem Class
    Code:
    class PokemonSystem
      attr_accessor :textspeed
      attr_accessor :battlescene
      attr_accessor :battlestyle
      attr_accessor :frame
      attr_accessor :textskin
      attr_accessor :font
      attr_accessor :screensize
      attr_accessor :language
      attr_accessor :border
      attr_accessor :runstyle
      attr_accessor :bgmvolume
      attr_accessor :sevolume
      attr_accessor :scaling
    
      def language
        return (!@language) ? 0 : @language
      end
    
      def textskin
        return (!@textskin) ? 0 : @textskin
      end
    
      def border
        return (!@border) ? 0 : @border
      end
    
      def runstyle
        return (!@runstyle) ? 0 : @runstyle
      end
    
      def bgmvolume
        return (!@bgmvolume) ? 100 : @bgmvolume
      end
    
      def sevolume
        return (!@sevolume) ? 100 : @sevolume
      end
    
      def tilemap; return MAPVIEWMODE; end
    
      def initialize
        @textspeed   = 1   # Text speed (0=slow, 1=normal, 2=fast)
        @battlescene = 0   # Battle effects (animations) (0=on, 1=off)
        @battlestyle = 0   # Battle style (0=switch, 1=set)
        @frame       = 0   # Default window frame (see also $TextFrames)
        @textskin    = 0   # Speech frame
        @font        = 0   # Font (see also $VersionStyles)
        @screensize  = (DEFAULTSCREENZOOM.floor).to_i # 0=half size, 1=full size, 2=double size
        @border      = 0   # Screen border (0=off, 1=on)
        @language    = 0   # Language (see also LANGUAGES in script PokemonSystem)
        @runstyle    = 0   # Run key functionality (0=hold to run, 1=toggle auto-run)
        @bgmvolume   = 100 # Volume of background music and ME
        @sevolume    = 100 # Volume of sound effects
        @scaling     = 0
      end
    end
     
    Back
    Top