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.

[VX] asynchron script execution ? [RESOLVED]

As a test (it was even worst in my main project), I included this simple script in a new project.

Code:
class TTestClass
  attr_accessor :bool_value

  def initialization
    @bool_value = false
  end
end

$testobject = TTestClass.new

class TScene_Test < Scene_Base
  def start
    super
    Sound.play_decision    
    create_menu_background    
    @win_cmd = Window_Command.new(136,["set to true","set to false"])
  end

  def terminate
    @win_cmd.dispose
    dispose_menu_background    
    super
  end

  def update
    super
    update_menu_background
    @win_cmd.update

    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    end

    if Input.trigger?(Input::C)
      case @win_cmd.index
        when 0
          $testobject.bool_value = true
        when 1
          $testobject.bool_value = false
      end
      $scene = Scene_Map.new
    end
  end
end

I then create an event doing the following :

Script:$scene = TScene_Test.new
condition: Script: $testobject.bool_value
  Play SE 'Applause'
else
  Play SE 'Buzzer1'
End of Condition

Now for the execution
  - First time I trigger the even,the scene appear
  - When I choose an option... no soucd
  - Second time I trigger the event, I hear the sound corresponding to the previous choice, and the scene appears.
  - When I choose an option,still no sound
  - And so on...

It seems as if the Script and the Condition where run on parrallell processes, or some part of the Event Command where frozen , or... I still don't understand.

Any lead ??

Ah... and... I still don't know how to set a title for the spoiler thing  :cry:
 
I don't know the exact answer but I think the interpreter stops interpreting an event after a scene change, if the scene change occured in the middle of an event. And if it's the case, then I really don't know why it works when you add a wait.

That's an excellent question.
 

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