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 5398
637 ((대박!)) 게임상의 모든 글자에 효과 주기.. 33 미카엘 2008.08.20 5582
636 (?스크립트) 스크립트 읽어서 그래픽 넣으세요.(영어 잘하는 사람만 권장...) 2 Man... 2008.10.27 1444
635 메뉴 (모그메뉴 풀세트팩 SEL Style.) 유니크급 자료 147 file 할렘 2009.02.07 9558
634 상점 (수정)크리쳐 샵, 'SW_CreatureShop' by Siot Warrior 15 file 시옷전사 2010.09.03 3675
633 액터 (수정)크리쳐 합체, 'SW_CreatureMix' by SiotWarrior 22 file 시옷전사 2010.09.07 2972
632 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
631 기타 (좀 이상한 or 쓸모없을 듯 한)화면상에 몬스터와 만나려면 몇걸음 남았는지 표시하는 스크립트! 2 루시페르 2009.06.06 2318
630 기타 078656577er님의 스크립트를 개조한, 사격용 스크립트 1 file 타코 2012.03.16 2519
629 기타 2 Players Engine 11 레이니케 2008.03.28 2294
628 2 Players Engine 2인용하기 15 file RPGbooster 2008.10.08 3999
627 전투 2003식 사이드뷰 적들도 가까이와서 공격함 ㅇㅇ 51 배군 2008.05.02 6750
626 이동 및 탈것 2D 횡스크롤 스크립트 56 file 사람이라면? 2010.08.15 7570
625 이동 및 탈것 3D 던젼 스크립트 38 아방스 2010.12.06 5772
624 그래픽 3D그래픽 파티클엔진 45 file RPGbooster 2008.10.08 10130
623 파티 5인 파티 프로젝트 V1.1 4 file 지나가는떡꼬치 2012.06.30 2988
622 이동 및 탈것 8 방향 이동스크립트 + 스프라이트 효과 12 file 레오 2009.02.06 7557
621 기타 <중수이상>RPG VX의 대표적 참조값 6 까까까 2009.05.31 3236
» 영상 ??(Avi play ver beta 0.8) 4 Man... 2008.10.28 1575
619 ??(다 영어)여기서 부터 드레그만 빼고 Man... 2008.10.27 1078
618 ??? 1 Man... 2008.10.27 1020
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32