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 5402
637 스킬 훔치기 스킬을 만드는 스크립트! 5 우켈킁 2011.03.31 2390
636 기타 회피,명중,크리 스테이트를 작성하는 스크립트 9 카르와푸딩의아틀리에 2009.06.30 2394
635 기타 확장 에러 메시지 13 file 허걱 2009.08.17 2497
634 메뉴 확장 스테이터스 화면 - KGC 23 file 카르와푸딩의아틀리에 2009.08.19 5057
633 기타 화폐단위 구분해 주는 스크립트 38 file 허걱 2010.04.13 3652
632 이동 및 탈것 화면의 부드러운 스크롤 스크립트 32 카르와푸딩의아틀리에 2009.07.17 3819
631 기타 화면에 그림 그리는 스크립트 21 file 강진수 2010.02.27 2962
630 기타 화면 확대 스크립트 12 file 에돌이 2011.07.22 3061
629 기타 화면 해상도(640 X 480) 스크립트 6 file 쿠쿠밥솥 2012.01.10 3972
628 아이템 현재있는 파티원 선택 레벨업 아이템 만들기 1 file 싸패 2016.06.06 713
627 헬프윈도우 확장 13 file RPGbooster 2008.10.08 2872
626 메뉴 헬프 윈도우 중앙표시 스크립트 11 file 양념통닼 2008.06.10 3348
625 키입력 해외 제작자 He Who Jets님의 마우스 스크립트(mouse system) 1 file 보자기군 2014.09.30 1261
624 기타 해상도 변경 스크립트 11 카리스 2011.07.19 2723
623 스킬 합성샾 스크립트 ^^ [동영상 포함] 6 file 아방스 2008.09.23 6038
622 키입력 한글입력기(펌) 수정 10 전설의달빛조각사 2011.04.03 2674
621 이름입력 한글로 이름 입력하는 스크립트입니다. 55 file 헤르코스 2009.03.18 6662
620 이름입력 한글 이름 입력 스크립트입니다.^^ 14 레시온 2008.03.18 4383
619 액터 한계돌파(렙9999) 18 작은샛별 2010.03.07 3273
618 이동 및 탈것 피티원이 따라다니는 스크립트 38 file 아방스 2009.02.05 5024
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