Detecting Debug/Playtest mode?

Hello everyone.


This might pretty much go in RGSS2 but I'm not sure. What I want to do is the game to detect if it's running on Playtest mode, then activate a Switch if it is. Then I would use eventing to have some Conditional branches detect if this switch is on so the game can do stuff like giving debug-exclusive items, for example.


Is there a way to do it?


Thanks in advance.
This should get you what you want - the example turns on switch 1, so substitute that with whatever you want.

Code:
module DataManager
  class << self
    alias my_create_game_objects create_game_objects
  end

  def self.create_game_objects
    my_create_game_objects
    $game_switches[1] = $TEST
  end
end





I haven't tested this, so if you get an error when you try it, post back with the details.  I could have made a syntax error or something.


If you also want to cater for a game that might have been started in regular mode (not play test), but is then loaded during play test, or vice versa, also add this:

Code:
class Scene_Load < Scene_File
  alias my_on_load_success on_load_success
  
  def on_load_success
    $game_switches[1] = $TEST
    my_on_load_success
  end
end



This means every time a new game is started, or a game is loaded, it will update switch 1 based on whether you're playing from the editor or playing a 'regular' game.


And yeah, either RGSS2 Script Requests, or RGSSx Script Support would be the appropriate place.
Thanks! I will give them a try.


Do I have to enter them somewhere specific in the RGSS modules?


Also, my bad. I actually meant to say RGSS3, not RGSS2, since it's a VX Ace project. Do they still work well with it?
lol - yeah, I actually looked at Ace when I wrote those.  Never even occurred to me that RGSS2 = VX 🙂



Just create a new slot below Materials and paste both of them into it together.
Great! So far the scripts have given no problem, and they did the trick for what I wanted! Thanks a lot!

Original thread: https://forums.rpgmakerweb.com/threads/detecting-debug-playtest-mode.60540/