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 키입력 답을 입력하는 텍스트박스 스크립트!! 21 file 좀비사냥꾼 2009.03.29 4206
196 기타 개인판타지메뉴+업그래이드 배틀 23 file 콩밥 2010.08.02 4211
195 액터 스탯 시스탬 29 츠키아 2008.08.08 4214
194 기타 아이콘 캐릭터 17 file 허걱 2010.02.28 4225
193 전투 XAS Hero Edition VX 15 Alkaid 2011.12.28 4234
192 메시지 네오 메시지 시스템 최신 17 file RPGbooster 2008.10.08 4251
191 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
190 기타 [자작] 횡스크롤 점프스크립트 18 file 좀비사냥꾼 2009.04.03 4276
189 상태/속성 상태 메뉴 변경 스크립트 45 죄송해욧! 2008.03.01 4284
188 메시지 MultiMessage 멀티 메시지 스크립트 9 file 허걱 2010.02.23 4298
187 기타 집안의 가구를 내마음대로 데코레이션하기 15 file EuclidE 2010.09.18 4303
186 이동 및 탈것 자동 이동 시스템 20 file 허걱 2010.04.21 4305
185 맵/타일 VX Mode 7 스크립트!!!! 42 file Tofuman 2009.01.07 4306
184 그래픽 밤낮 변환 VX용 26 독도2005 2008.03.23 4314
183 기타 심플 마우스 시스템 1.5 애드온 11 file RMdude 2009.02.11 4325
182 메뉴 [자작]명성치 사용 시스템(메뉴 출력) 16 Rainsy 2009.03.22 4360
181 메뉴 CogWheelBars 시스템. 13 file 할렘 2009.02.20 4362
180 메시지 직접 생각해서 만든 "문장 속 특정 단어 색 바꾸기" 10 file X.66 2010.04.28 4363
179 HUD 맵 이름 스크립트 21 file 개임맨 2010.10.03 4365
178 맵/타일 타일셋 변경 10 file 만들어보자꾸나 2008.06.08 4371
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