VX 스크립트

Avi Play
ver Beta 0.8

Authors: My self / From_Ariel
(as I have tweaked it here and there. this was originally an rpgmaker xp script )
and of course the original author
# - FantasyDR # - 2006.3.8 MSN: FantasyDR_SJL@hotmail.com



Information:
This is a robust avi player...

Included features:
  • Auto checking of frame rate and adjusting play speed ro match videos frame rate.
  • Numerous error trapping branches for bad video etc to help identify any problems with the game.
  • Works full screen or windowed but has trouble going back and forth.

Screenshots:

No one at this time it runs in windowed mode fine If i cant get it working in both i might remove the fullscrren code out soon....

Instructions:
Ok this is as simple as pie......
place this script snippet anywhere in your game...
Example .... $MP.play ( "640x480.avi", 3, true, false,x,y,width,height )
Parameters:

[Movie_name]...............video file name (*. avi), must be
[Movie_length]:.............film length, in the seconds if you specify longer than the clip actually lasts it will loop.
[Skip-- (true / false) ].....A key may be whether or not skip, true / false, the default is true
.................................... if skip is set to true then a key press will cause you to exit the movie and continue the game.
[Fullscr--(true / false].....whether or not mandatory for full-screen playback, true / false default is false
[X, y]: .........................video player offset calculated by upper left corner coordinates, the default is 0,0
[Width, height]: the width of video can be arbitrary. Default is 640,480




Demo Link: None yet maybe tomorrow.

Compatibility: Seems to play with all other scripts both vx and xp but has its own challenges.

Challenges:
  • Switching from Windowed to full screen or vice versa has numerous errors associated with it.
  • windowed mode plays but the video wont scale up to meet the size of the video frame.
    (I presume the width / height was intended for that but never got done.)
    As of current width / height changes the size of the big black box the video plays on top of.
  • Full screen don't always seem to initialize right and even if I can get it to launch
  • sometimes the main game window will be minimized when the movies over
    even using the alt+ent trick it just makes stuff more a hassle.
  • L] At present all width // height does is changer the size of the big black background that is behind the move.
    this can make the window breakout of the parents window space/ size..




Author's Notes:

many hours a a day googling. I'm no master scripter but after scouring the next this is the most powerful complete player i could finf.

What I would like to see this do.....
load and play avi file....
if rpg maker is currently in fullscreen then play full screen.
if rpg maker is currently in Windowed then play Windowed.
I would like it to play these files no avi control panel smile.gif
Return to previous screen

also remove those forced key commands.
Use win api to minimizer and restore windows for more predictable behavior..
스크립트
# FantasyDR
# Releases:
# Need to join the script is inside the game works, main and before the MoviePlayer SystemTimer
#================================================= =============================
# ☆ ★ ☆ AVI player ☆ ★ ☆
#------------------------------------------------- -----------------------------
# - FantasyDR
# - 2006.3.8
#------------------------------------------------- -----------------------------
# MSN: FantasyDR_SJL@hotmail.com
#------------------------------------------------- -----------------------------
# Note:
#
# 1. Games must use the model works with the game
#
# 2. PROJECT_NAME = below fill in the back of your game works.
#
# 3. In the game, calling the incident script play your video file, if his party can write no less than a comma after wrapping.
#
# $ MP.play (movie_name, movie_length,
# Skip, fullscr,
# X, y, width, height)
#
# Parameters:
#
# [Movie_name] video file name (*. avi), must be
# [Movie_length]: film, is the second unit, we must
# [Skip] A key may be whether or not skip, true / false, the default is true
# [Fullscr] whether or not mandatory for full-screen playback, true / false, the
# default is false
# [X, y]: video player in the upper left corner coordinates, the default is 0,0
# [Width, height]: the width of video can be arbitrary. Default is 640,480
#
# For example:
# $ MP.play ( "logo.avi", 13, false, true)
#================================================= =============================

class SystemTimer

attr_accessor:decimal #小数位数设定,默认为3



def initialize(use_GetTime=false)

# Initialization, according to choose a different system accuracy of the timer

@qpFrequency = Win32API.new("kernel32","QueryPerformanceFrequency",'p','L')

@qpCounter = Win32API.new("kernel32","QueryPerformanceCounter",'p','L')

@tGetTime = Win32API.new("winmm","timeGetTime",'','L')



@decimal=3

@perf_cnt=" " * 8

@time_start=" " * 8

@time_now=" " * 8



result = @qpFrequency.call(@perf_cnt)



if use_GetTime

result = 0

end



if result!=0

@perf_flag=true

else

@perf_flag=false

@perf_cnt=[1000,0].pack('LL')

end


# Set a time proportion factor

@time_scale=@perf_cnt.unpack('LL')

@time_scale[0] /= 1000.0

@time_scale[1] /= 1000.0


# Start time cleared

self.clear()

end



#-=====================-#

# Timer cleared

#-=====================-#


def clear()

if @perf_flag

@qpCounter.call(@time_start)

else

@time_start=[@tGetTime.call(),0].pack('LL')

end

end



#-==============================-#

# After obtaining the current time, units ms

#-==============================-#

def now()

now_time = 0.0e1

now_time += self.timer() - self.start()

now_time /= self.scale()

return self.debug(now_time)

end


#-==============================-#

# After obtaining the current time, the second unit

#-==============================-#


def now_s()

now_time = 0.0e1

now_time += self.timer() - self.start()

now_time /= (self.scale()*1000)

return self.debug(now_time)

end


#-==============================-#

# Frame wrong ...

#-==============================-#


def debug(now_time)

if @decimal>0

now_time = (now_time * (10**@decimal)).floor/(10.0**@decimal)

else

now_time = now_time.floor

end

return now_time




# Debug mode for the following

if now_time < 0

p "Timer Wrong!! Clear...",now_time,

@perf_flag,@qpCounter,@tGetTime,

@time_now.unpack('LL')[0],@time_now.unpack('LL')[1],

@time_start.unpack('LL')[0],@time_start.unpack('LL')[1]

self.clear()

return 0.0

else

return now_time

end

end



#-=====================-#

# Access to the proportion of time factor

#-=====================-#

def scale()

return @time_scale[0]+

@time_scale[1]*0xffffffff

end



#-=====================-#

# Access to a few initial tack

#-=====================-#

def start()

return @time_start.unpack('LL')[0]+

@time_start.unpack('LL')[1]*0xffffffff

end



#-=====================-#

# Access to the current number of Di pyridazinones

#-=====================-#

def timer()

if @perf_flag

@qpCounter.call(@time_now)

else

@time_now=[@tGetTime.call(),0].pack('LL')

end

return @time_now.unpack('LL')[0]+

@time_now.unpack('LL')[1]*0xffffffff

end

end

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

# Initialize itself into a global variables

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

$sys_timer=SystemTimer.new()

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



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



#================================================= =============================

# ☆ ★ ☆ AVI player ☆ ★ ☆

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

# - FantasyDR

# - 2006.3.8

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

# MSN: FantasyDR_SJL@hotmail.com

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

# Note:

#

# 1. Games must use the model works with the game RGSS102J.dll

#

# 2. PROJECT_NAME = below fill in the back of your game works.

#

# 3. In the game, calling the incident script play your video file, if his party can write no less than a comma after wrapping.

#

# $ MP.play (movie_name, movie_length,

# Skip, fullscr,

# X, y, width, height, loop)

#

# Parameters:

#

# Movie_name: video file name (*. avi), must be

# Movie_length: film, is the second unit, we must

# Skip: A key may be whether or not skip, true / false, the default is true

# Fullscr: whether or not mandatory for full-screen playback, true / false, the default is false

# X, y: video player in the upper left corner coordinates, the default is 0,0

# Width, height: the width of video can be arbitrary. Default is 640,480

# Loop: loop, true / false, the default is true

#

# For example, players logo.avi, time 13 seconds, Skip ban, compulsory full-screen, the scope of (a 0,0) - (640,480), the loop

# $ MP.play ( "logo.avi", 13, false, true)

#================================================= =============================

# ★ ★ ★ Please fill out the game works here were ★ ★ ★
################################################################################
################################################################################
#### ▓▓▓▓▓▓▒░ ▓▓▓▓▓▒░ ▓▓▓▓▓▒░ ▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓▒░ ▓▓▓▓▓▓▓▓ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ###
#### ▓▓▓▓▓▓▓▒░ ▓▓▓▓▓▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▓▓▓▓ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▓▓▓▓▒░ ▓▓▓▒░ ▓▓▓▓▓ ▓▓▓▓▓▒░ ▓▒░ ###
#### ###
#### ▓▓▒░ ▓▒░ ▓▓▒░ ▓▒░ ▓▒░ ▓▓▓▓▓▒░ ▓▒░ ###
#### ▓▒▓▒░ ▓▒░ ▓▒░▓▒░ ▓▓▒░ ▓▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▓▒░ ▓▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░▓▒░ ▓▓▓▓▓▓▓▓▒░ ▓▒▓▒░▓ ▓▒░ ▓▓▓▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒▓▒░ ▓▒░ ▓▒░ ▓▒▓▒░▓ ▓▒░ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▓▒░ ▓▒░ ▓▒░ ▓▒░▓ ▓▒░ ▓▒░ ###
#### ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▒░ ▓▓▓▓▓▒░ ▓▒░ ###
################################################################################
################################################################################
PROJECT_NAME = "Project1"

#================================================= =============================

# ■ Win32API

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

# Need to use the API

#================================================= =============================

# Switch to full-screen delay

SWITCH_DELAY = 0.1

# API used by some constants

MCI_ANIM_WINDOW_ENABLE_STRETCH = 0x100000


WS_EX_TOPMOST = 0x8

SHOW_FULLSCREEN =(3)

WM_ACTIVATE =(6)

WS_EX_TOOLWINDOW= 0x80

WS_VISIBLE = 0x10000000

WS_POPUP = 0x80000000

GWL_HINSTANCE = (-6)

WM_CLOSE = 0x10

WS_CHILD = 0x40000000

WS_NONE = 0x16000000

CP_ACP = 0

CP_UTF8 = 65001

# Character encoding conversion API

$MP_m2w = Win32API.new('kernel32', 'MultiByteToWideChar', '%w(i,l,p,i,p,i)', 'i')

$MP_w2m = Win32API.new('kernel32', 'WideCharToMultiByte', '%w(i,l,p,i,p,i,p,p)', 'i')



# Keys API

$MP_keybd = Win32API.new('user32', 'keybd_event', '%w(i,i,l,l)', 'v')

# Video playback API

$MP_mciSendString = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')


# Locked window

# HWnd, ifEnable

$MP_EnableWindow = Win32API.new('user32','EnableWindow','%w(l,l)','L')

# Activation window

# HWnd

$MP_SetActiveWindow = Win32API.new('user32','SetActiveWindow','%w(l)','L')

# Current activities window

$MP_GetActiveWindow = Win32API.new('user32','GetActiveWindow','%w()','L')

# hWnd,wMsg,wParam,lParam

$MP_PostMessage = Win32API.new('user32','PostMessage','%w(l,l,l,p)','L')

# Access to the current window handle

$MP_FindWindowEX = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')

# Access to the screen coordinates

$MP_ClientToScreen = Win32API.new("user32", "ClientToScreen", 'ip', 'i')

# Access hInt

$MP_GetWindowLong= Win32API.new('user32','GetWindowLong','%w(l,l)','L')

# 获取类名

# hWnd,lpClassName,maxCount

$MP_GetClassName= Win32API.new('user32','GetClassName','%w(l,p,l)','L')

# Create the form

# ExStyle, ClassName, WindowName,

# Style, x, y, width, height

# 0,0, hInstance, 0

$MP_CreateWindowEX = Win32API.new('user32','CreateWindowEx','%w(l,p,p,l,l,l,l,l,l,l,l,p)','L')


#================================================= =============================

# ■ MoviePlayer

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

# Handle video screen category.

#================================================= =============================
class MoviePlayer


#================================================= =============================

# ■ MoviePlayer

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

# Handle video screen category.

#================================================= =============================

def initialize(project_name = PROJECT_NAME)

@sys_timer=SystemTimer.new()

buffer = "" * project_name.size

@project_name = "" * project_name.size



$MP_m2w.call(CP_UTF8, 0, project_name, -1, buffer, project_name.size)

$MP_w2m.call(CP_ACP,0,buffer,-1,@project_name,project_name.size,0,0)



@hWnd = $MP_FindWindowEX.call(0,0,nil,@project_name)

@hInt = $MP_GetWindowLong.call(@hWnd,GWL_HINSTANCE)

@class_name = " " * 256

$MP_GetClassName.call(@hWnd,@class_name,256)

end

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

# ● whether full-screen

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

def is_full?

# Players start coordinates

point = [0, 0].pack('ll')

if $MP_ClientToScreen.call(@hWnd, point) == 0

return false

end

x, y = point.unpack('ll')

if x == 0 and y == 0

return true

else

return false

end

end

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

# ● full-screen switch

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

def switch_full

#~ $MP_keybd.call (0xA4, 0, 0, 0)

#~ $MP_keybd.call (13, 0, 0, 0)

#~ $MP_keybd.call (13, 0, 2, 0)

#~ $MP_keybd.call (0xA4, 0, 2, 0)


Graphics.update

sleep(SWITCH_DELAY)

Graphics.update

end

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

# ● movies

# Movie_name: video file name (*. avi)

# Movie_length: film, is the second unit

# Skip: can skip button

# Fullscr: whether or not mandatory for full-screen playback

# X, y, width, height: the location and width of players

# Loop: loop

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

def play(movie_name,movie_length,

skip = true,fullscr = false,

x = 0,y = 0,width = 1088,height = 832,loop = true)


# Data not rule out

return true if movie_name == nil or movie_length <= 0

# File does not exist

movie_name = Dir.getwd()+"Movies"+movie_name

return true unless FileTest.exist?(movie_name)

# File does not exist

width -= (x + width)- 1088 if (x + width) > 1088

height -= (y + height)- 832 if (y + height) > 832



if fullscr and !is_full?

self.switch_full

end



fullscr = self.is_full?



# Width of the window

point = [x, y].pack('ll')

if $MP_ClientToScreen.call(@hWnd, point) == 0

return true

end

x, y = point.unpack('ll')

return true if (x + width) < 0 or (y+height) < 0



if fullscr

wnd = $MP_CreateWindowEX.call(WS_EX_TOPMOST,@class_name,@project_name,

SHOW_FULLSCREEN | WS_VISIBLE | WS_POPUP,x,y,width,height,

0,0,@hInt,0)

else

wnd = $MP_CreateWindowEX.call(WS_EX_TOOLWINDOW,@class_name,@project_name,
SHOW_FULLSCREEN | WS_VISIBLE | WS_POPUP,x,y,width,height,

0,0,@hInt,0)

end


# Players start coordinates

return true if wnd == 0




# Shielding the original form

$MP_EnableWindow.call(@hWnd,0)



$MP_mciSendString.call("open "" + movie_name + """ +

" alias FILE style 1073741824 parent " +

wnd.to_s,0,0,0)

if loop

$MP_mciSendString.call("play FILE repeat window ",0,0,MCI_ANIM_WINDOW_ENABLE_STRETCH)

else

$MP_mciSendString.call("play FILE window",0,0,MCI_ANIM_WINDOW_ENABLE_STRETCH)

end



@sys_timer.clear()

step = 0.1

begin

loop do

# If the window mode

unless fullscr

# Become a full-screen

if self.is_full?

break

else

Graphics.update

end

end

#sleep(step)

if skip

Input.update

break if Input.trigger?(Input::A)

end

if @sys_timer.now_s >= movie_length

break

end

if $MP_GetActiveWindow.call() != wnd

$MP_SetActiveWindow.call(wnd)

end

end

rescue Hangup

retry

end

# Close current form and bring main window to front

$MP_PostMessage.call(wnd,WM_CLOSE,0,0)

$MP_mciSendString.call("close FILE",0,0,0)

$MP_EnableWindow.call(@hWnd,1)

$MP_SetActiveWindow.call(@hWnd)

return true

end

end

$MP = MoviePlayer.new
Comment '4'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5408
197 직업 서브클래스 선택 시스템 Subclass Selection System 7 file 카르와푸딩의아틀리에 2009.06.30 3943
196 기타 설명하기 힘든 스크립트 (스크린샷 확인) 10 file 사람이라면? 2010.08.16 3818
195 저장 세이브 시스템 확장 스크립트 9 file 신규회원 2012.02.24 3315
194 저장 세이브 파일 개수 16개로 늘리기 (기본 세이브 엔진용) 1 file Bunny_Boy 2015.09.07 817
193 기타 세이브 포인트 2 비극ㆍ 2010.04.19 2518
192 저장 세이브/로드가 불가능한 스크립트!!! 9 file ~AYARSB~ 2010.03.08 3298
191 메시지 소설풍(노벨풍) 문자 스크립트 31 file 맛난호빵 2011.01.03 5551
190 이동 및 탈것 스위치 on일때 못 움직이게...(이동고정) 6 허걱 2009.07.14 2326
189 기타 스크린샷 기능 14 비극ㆍ 2010.04.19 2090
188 기타 스크립트강좌 4 아하!잘봤어요. 2009.05.04 2158
187 기타 스크립트로 커먼 이벤트 실행 [수정] 3 허걱 2009.08.17 2311
186 스킬 스킬 사용시 컷인 연출 (번역) 26 file 훈덕 2009.02.05 5387
185 상점 스킬 샾 스크립트 2.0 48 아방스 2008.03.05 6628
184 전투 스킬 커맨드 스크립트 16 아방스 2009.02.05 4535
183 스킬 스킬 필요 조건(번역) 23 file 훈덕 2009.02.03 4644
182 스킬 스킬 필요조건에 살짝 손대봤습니다. -- 수정 18 아이미르 2011.03.23 2499
181 스킬 스킬, 아이템 적아 구분 없이 쓰기 10 file EuclidE 2011.10.16 2900
180 스킬 스킬북으로 스킬 레벨업!, 'SW_BookSkill' by SiotWarrior(재수정) 21 file 시옷전사 2011.05.15 2817
179 스킬분류 16 file RPGbooster 2008.10.11 2833
178 장비 스킬습득장비 [죄송] 19 file RPGbooster 2008.10.11 4049
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32