Top Level Namespace

Defined Under Namespace

Modules: Audio, Battle, BattleUI, Configs, Converter, Debugger, GTS, GameData, GamePlay, Graphics, Hooks, Input, Kernel, LiteRGSS, Mouse, NuriYuri, PFM, PSP, Pathfinding, RPG, SafeExec, Scheduler, ScriptLoader, Sf, Studio, UI, Util, Yuki Classes: Binding, Bitmap, BlendMode, Color, Game_Actor, Game_Actors, Game_BattleAction, Game_Battler, Game_Character, Game_CommonEvent, Game_Enemy, Game_Event, Game_Map, Game_Party, Game_Picture, Game_Player, Game_Screen, Game_SelfSwitches, Game_SelfVariables, Game_Switches, Game_System, Game_Temp, Game_Troop, Game_Variables, Image, Integer, Interpreter, Interpreter_RMXP, Object, Plane, Random, Rect, Reset, Scene_Map, Scene_Title, Shader, ShaderedSprite, Shape, Sprite, SpriteMap, SpriteSheet, Sprite_Character, Sprite_Picture, Sprite_Timer, Spriteset_Map, String, Table, Table32, Tester, Text, Texture, Tone, Viewport, Window

Constant Summary collapse

PSDK_CONFIG =

Constant containing all the PSDK Config

ScriptLoader::PSDKConfig.allocate
Fonts =

Alias access to the Fonts module

LiteRGSS::Fonts

Instance Method Summary collapse

Instance Method Details

#game_statePFM::GameState?

Global accessor for the game state

Returns:



402
403
404
# File 'scripts/01450 Systems/00000 General/00010 GameState/00200 Accessors.rb', line 402

def game_state
  PFM.game_state
end

#reload_battle

Function responsive of reloading the saved battle



255
256
257
258
259
260
261
262
263
264
# File 'scripts/00100 Yuki__EXC.rb', line 255

def reload_battle
  return log_error('There is no battle') unless File.exist?('battle.dat')

  PFM.game_state, battle_info = Marshal.load(Zlib::Inflate.inflate(File.binread('battle.dat')))
  PFM.game_state.expand_global_var
  PFM.game_state.load_parameters
  $game_map.setup($game_map.map_id)
  Graphics.freeze
  $scene = Battle::Scene.new(battle_info)
end

#safe_code(name, &value)

Safely execute a piece of code

Parameters:

  • name (String)

    Name of the code if it needs to be removed

  • value (Proc)

    code to execute



45
46
47
48
49
# File 'scripts/00003 SafeExec.rb', line 45

def safe_code(name, &value)
  receiver = value.binding.receiver
  receiver = Object if receiver.class == Object
  return (SafeExec::SAFE_CODE[receiver] ||= {})[name] = value
end

#safe_const(name, &value)

Note:

This is not suited for cyclic redundancy (C::A = D::B; D::B = C::E). The value should never be passed as &block. The final value of the constant can be changed by calling safe_const again.

Safely define a constant (make its value valid once every scripts got loaded)

Examples:

Defining a constant dependant of a class that is not already loaded :

class MyClass
  MY_CONST = safe_const(:MY_CONST) { DependingOnClass::OTHER_CONST * 3 }
end
# This prevents uninitialized constant DependingOnClass

Parameters:

  • name (Symbol)

    name of the constant in the class where it should be defined

  • value (Proc)

    code to execute to give the proper constant value



31
32
33
34
35
36
37
38
39
40
# File 'scripts/00003 SafeExec.rb', line 31

def safe_const(name, &value)
  receiver = value.binding.receiver
  receiver = Object if receiver.class == Object
  return (SafeExec::SAFE_CONSTANTS[receiver] ||= {})[name] = proc do
    receiver.instance_eval do
      remove_const name
      const_set name, yield
    end
  end
end