Project1
标题:
F12後發生 腳本錯誤 [更新]
[打印本页]
作者:
duzine
时间:
2016-2-10 18:37
标题:
F12後發生 腳本錯誤 [更新]
本帖最后由 duzine 于 2016-2-10 21:54 编辑
如題
於是很常引發BUG的我再度來回報一下新年的BUG
以前沒有問題,不過最近發現使用腳本修改標題畫面後,出現了錯誤 (如圖)
是什麼原因造成的呢?
觸發過程:
先切換標題後,F12確認標題運作正常,按開始遊戲就出現問題了
更新:
發現是只要F12就會發生,排除是腳本修改標題畫面的問題
未命名.png
(4.28 KB, 下载次数: 21)
下载附件
保存到相册
2016-2-10 18:36 上传
作者:
taroxd
时间:
2016-2-11 09:17
本帖最后由 taroxd 于 2016-2-11 09:23 编辑
F12 之后,main 脚本页中 rgss_main 之前的脚本都不会重新执行一遍,但是在 rgss_main 之前生成的 Bitmap 等都会被释放(dispose)
请检查是否在 rgss_main 之前生成了位图,并且没有检查是否释放。
要预先生成 Bitmap 缓存的话,可以参考这里的方法 Taroxd::Sight.shadow:
http://taroxd.github.io/rgss/%E8 ... 99%90%E5%88%B6.html
作者:
duzine
时间:
2016-2-11 13:13
F12修正腳本(原版除錯)版
#==============================================================================
# ** F12 Reset Fix
# Author: Acezon
# Date: 2 June 2013
#------------------------------------------------------------------------------
# Version 2.1
# - Fixed issue where game window is not in focus
# when Console_on is set to false
# - Now compatible with Tsuki's Test Edit script
# Version 2.0
# - Console option added
# - Automatically focuses window after pressing F12
# Version 1.1
# - Respawning the exe was better
# Version 1.0
# - Initial Release
#------------------------------------------------------------------------------
# Just credit me. Free to use for commercial/non-commercial games.
# Thanks to Tsukihime and Cidiomar for the console scriptlet
#==============================================================================
$imported = {} if $imported.nil?
$imported["Acezon-F12ResetFix"] = true
#==============================================================================
# ** START Configuration
#==============================================================================
module Config
Console_on = false # duh
end
#==============================================================================
# ** END Configuration
#==============================================================================
alias f12_reset_fix rgss_main
def rgss_main(*args, &block)
f12_reset_fix(*args) do
if $run_once_f12
#pid = spawn ($TEST ? 'Game.exe test' : 'Game')
pid = spawn ($TEST ? 'Game.exe test' : 'Game.exe')
# Tell OS to ignore exit status
Process.detach(pid)
sleep(0.01)
exit
end
$run_once_f12 = true
# Run default rgss_main
block.call
end
end
module SceneManager
class << self
alias :acezon_f12_first :first_scene_class
end
def self.first_scene_class
focus_game_window
acezon_f12_first
end
def self.focus_game_window
# Just to prevent re-spawning the console since
# Tsuki uses this same part in his Test Edit script
if !$imported["TH_TestEdit"]
# Get game window text
console_w = Win32API.new('user32','GetForegroundWindow', 'V', 'L').call
buf_len = Win32API.new('user32','GetWindowTextLength', 'L', 'I').call(console_w)
str = ' ' * (buf_len + 1)
Win32API.new('user32', 'GetWindowText', 'LPI', 'I').call(console_w , str, str.length)
if Config::Console_on
# Initiate console
Win32API.new('kernel32.dll', 'AllocConsole', '', '').call
Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call('RGSS3 Console')
$stdout.reopen('CONOUT)
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1