Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Rare scripiting problem in XP

Hi, im having a extrange problem with scripts. I created my own project for testing. I added for testing the problem this code in GS:
Code:
 

class Game_System

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :ib_first_initialize            # tileset file name

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  alias wep_gs_ib_init initialize

  def initialize

    wep_gs_ib_init

    @ib_first_initialize = true

  end

  

  def set

    #p 'before set'

    @ib_first_initialize = false

    #p 'after set'

  end

end

 
Note that this script is a test one.
Then i create a new project with a event in automatic that calls this script:
$game_system.set
And desactives himself using selfswitch.

With this, the problem, is that the game freezes and i never can freely move the character, when using the set metod. Note that if i modify the variable in the script call it gives the same problem.

Well, that dont have any sense, but if i uncoment the two p phrases, the game works well, and later of the text i can move character freely.

And if i just let the first testing phrase, its printed in a never ending loop. And if i only let the second one, it works well.

Pd: if you dont understand something, just ask
 
gerrtunk":35ykp8kk said:
Thanks. Exist a script that corrects all the bugs in XP? Exist other bugs?

I'm not sure there are more bugs, specifically. Technically, this was an oversight more than a bug. This was the first time the script system was available, and I'm not sure they realized that people would do things like insert new methods into something like the interpreter. As for actual bugs, I can think of more for VX than XP. (In point of fact, I'm having trouble coming up with any actual bugs in xp, rather than just oversights or similar things)
 
Mmm, i was thinking in adding this itnerpeter correction to the script that gives me problems, thats the skip cutescene mode and update it, but maybe its better to just adapt it to the default script putting a unecesary true at the end of it, than obligating to fix that bug and overwrite the whole method...
 
gerrtunk":3kafkdgu said:
Mmm, i was thinking in adding this itnerpeter correction to the script that gives me problems, thats the skip cutescene mode and update it, but maybe its better to just adapt it to the default script putting a unecesary true at the end of it, than obligating to fix that bug and overwrite the whole method...

True, but if you're going to release this script, like you tend to do, you'll want to make sure it either includes the fix or mentions that it requires the fix in the instructions, so that people don't wonder why it keeps freezing.
 
Glitchfinder":rxi1a9v3 said:
gerrtunk":rxi1a9v3 said:
Mmm, i was thinking in adding this itnerpeter correction to the script that gives me problems, thats the skip cutescene mode and update it, but maybe its better to just adapt it to the default script putting a unecesary true at the end of it, than obligating to fix that bug and overwrite the whole method...

True, but if you're going to release this script, like you tend to do, you'll want to make sure it either includes the fix or mentions that it requires the fix in the instructions, so that people don't wonder why it keeps freezing.

Well, if i put a return true at the end of setting methods in interpreter, that just work for this script and not any extra explanation is needed, no? it dont freezes

I can include the general bugfix, of course, but it rewrites the whole method of call script....
 
You don't want a script command to always return true. There are multiple ways to fix that, but that is not one of them.

A simple return, instead of return false will suffice. Nothing will be returned, and Ruby interprets nil as false when comparing as a boolean.

Another fix is something like this:

[rgss]  #--------------------------------------------------------------------------
  # * Script
  #--------------------------------------------------------------------------
  def command_355
    # Set first line to script
    script = @list[@index].parameters[0] + "\n"
    # Loop
    loop {
      # If next event command is not second line of script or after
      if @list[@index+1].code != 655
        # Abort loop
        break
      end
      # Add second line or after to script
      script += @list[@index+1].parameters[0] + "\n"
      # Advance index
      @index += 1
    }
    # Evaluation and return resulting value
    return (eval(script) != false)
  end
[/rgss]
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top