Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Movie Player Script

Ive been looking around for a while and i found a script that allows you to play avi files (by soundspawn). Anyways, it doesnt work on my rmxp. Whenever i ty to play something teh mouse just flickers and no sound or video is played.
Anyways, i was wondering if someone could dig up andother avi player script for me.
Or, if you could, try help me with fixing the one i have now.
K thx everyone! :D
 
What you describe might be a codec error. What plays outside of RMXP won't necessarily play inside RMXP. The script you ask for is the one I use in my game. It works fine so maybe you have a codec error or you have a script conflict.
 
I heard that the AVI script dosen't play the video's audio. You need to have the audio from the video as a BGM and play it when you play the movie. I could be wrong though seeing that i've never used that script before.
 
i just downloaded lots of codec packs and restarted my computer...
same thing
right now, im using soundspawn's avi player system
im thinking there may be an error with either the script or my script call function
PHP:
#   Copy this into a new section of your game. To play a file, move the avi file
#   into a "movies" subdirectory (yourgame\data, yourgame\graphics, yourgame\movies).
#   Then call "Scene_Movie.new(filename)" where filename is your movies actual
#   filename (minus the .avi).

class Scene_Movie

def initialize(movie)
   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
   @movie_name = Dir.getwd()+"\\Movies\\"+movie+".avi"
   main
end

def main

   game_name = "\0" * 256
   @readini.call('Game','Title','',game_name,255,".\\Game.ini")
   game_name.delete!("\0")
   @wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
   @temp = @wnd.call(0,0,nil,game_name).to_s
   movie = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
   movie.call("open \""+@movie_name+"\" alias FILE style 1073741824 parent " + @temp.to_s,0,0,0)
   @message = Win32API.new('user32','SendMessage','%w(l,l,l,l)','V')
   
   @detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
   @width = @detector.call(0)
   if @width == 640
     fullscreen
     Graphics.update
     sleep(1)
     Graphics.update
     sleep(1)
     Graphics.update
     sleep(1)
   end
   
   status = " " * 255
   movie.call("play FILE",0,0,0)
   loop do
    sleep(0.1)
    @message.call(@temp.to_i,11,0,0)
    Graphics.update
    @message.call(@temp.to_i,11,1,0)
    Input.update
    movie.call("status FILE mode",status,255,0)
    true_status = status.unpack("aaaa")
    if true_status.to_s != "play"
      break
    end
    if Input.trigger?(Input::B)
      Input.update
      break
    end
   end
   movie.call("close FILE",0,0,0)
   bail
end

def bail
   if @width == 640
     fullscreen
   end
  end
end

def fullscreen()

$full.call(18,0,0,0)
$full.call(13,0,0,0)
$full.call(18,0,2,0)
$full.call(13,0,2,0)
end
$full = Win32API.new('user32','keybd_event','%w(l,l,l,l)','')

The call script im using is exactly as follows (test1.avi being the name of the avi file)
PHP:
Scene_Movie.new("test1")
 
sithlord999;238831 said:
I heard that the AVI script dosen't play the video's audio. You need to have the audio from the video as a BGM and play it when you play the movie. I could be wrong though seeing that i've never used that script before.

Actually that is wrong the movie player script DOES play the sound of the movie.

Chuchan said:
i just downloaded lots of codec packs and restarted my computer...
same thing
right now, im using soundspawn's avi player system
im thinking there may be an error with either the script or my script call function

PHP Code:
# Copy this into a new section of your game. To play a file, move the avi file
# into a "movies" subdirectory (yourgame\data, yourgame\graphics, yourgame\movies).
# Then call "Scene_Movie.new(filename)" where filename is your movies actual
# filename (minus the .avi).

class Scene_Movie

def initialize(movie)
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@movie_name = Dir.getwd()+"\\Movies\\"+movie+".avi"
main
end

def main

game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
@wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
@temp = @wnd.call(0,0,nil,game_name).to_s
movie = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
movie.call("open \""+@movie_name+"\" alias FILE style 1073741824 parent " + @temp.to_s,0,0,0)
@message = Win32API.new('user32','SendMessage','%w(l,l,l,l)','V')

@detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
@width = @detector.call(0)
if @width == 640
fullscreen
Graphics.update
sleep(1)
Graphics.update
sleep(1)
Graphics.update
sleep(1)
end

status = " " * 255
movie.call("play FILE",0,0,0)
loop do
sleep(0.1)
@message.call(@temp.to_i,11,0,0)
Graphics.update
@message.call(@temp.to_i,11,1,0)
Input.update
movie.call("status FILE mode",status,255,0)
true_status = status.unpack("aaaa")
if true_status.to_s != "play"
break
end
if Input.trigger?(Input::B)
Input.update
break
end
end
movie.call("close FILE",0,0,0)
bail
end

def bail
if @width == 640
fullscreen
end
end
end

def fullscreen()

$full.call(18,0,0,0)
$full.call(13,0,0,0)
$full.call(18,0,2,0)
$full.call(13,0,2,0)
end
$full = Win32API.new('user32','keybd_event','%w(l,l,l,l)','')

The call script im using is exactly as follows (test1.avi being the name of the avi file)

PHP Code:
Scene_Movie.new("test1")

Well it looks right, but I have nothing to compare it to right now. Do you have the movie in the Movies folder in the main directory of your game? Did you rerender your movie in a more common codec? Cinepac or indeo are the most common codecs and Cinepac comes with windows so you can't go wrong with that one.

If you send me the video I'll see what I can do. I do video for a living.
 
Ok everyone, good news! I've fixed the files by downloading a program that converts the current codec into another one (i used cinepak). Thanks to all that helped!!!!! If you would like the program also, just PM ,me and ill send you the URL.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top