Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Berka's Video script II reloaded !
berka
post Jan 16 2009, 02:39 PM
Post #1


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Scripter
RM Skill: Advanced




Hi !

I've made a new movie's managment in rm.
It's more simple and add lots of settings:
volume managment, fullscreen mode, auto-detect file format...

puts this script above main and run the game first: a Videos directory will be created !
then add your videos files into.

and call the video with an event (call script) like this:

QUOTE
[film]
film = test.avi
aig = 999
bass = 0


the scripts:
[Show/Hide] rmvx&rmxp
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                            -  Game_Film II - reloaded ^^
#  par berka
#                          www.rpgmakervx-fr.com                                          
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#  Rgss 1&2                  v 1.0
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                          -Utilisation-
# écrivez dans un event, commande insérer un script:
#
# #minimum requis:
# [film]                # obligatoire !
# film = monfilm.avi    # ou mpg... nom du fichier à lire
#
# #configuration optionnelle, l'ordre n'est pas important
# mettre les 4 coordonnées sinon aucune !
# x = 12                # position horizontale
# y = 1                  # position verticale
# w = 150                # redimensionnement du film: largeur
# h = 150                # redimensionnement du film: hauteur
#
# full = true            # active (ou pas) le plein écran dans le mode fenetré
# vol = 750              # entre 0 et 1000 volume sonore du film
# bass = 999            # entre 0 et 1000 volume des basses: tres faible nuance
# aig = 250              # entre 0 et 1000 volume des aigus: tres faible nuance
# #commandes:
# bouton B pour quitter, C pour interrompre/reprendre la lecture
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# pourquoi un nouveau script de video ?
# simplement pour ne plus avoir à répondre à toutes ces questions sur la video !
# ce script est le plus simple possible: j'ai testé toutes les erreurs possibles
# l'appel est personalisable
# le format de la video est auto-détecté
# ajout du plein écran
# de la gestion du volume
# Un dossier Films est automatiquement créé dans votre projet.
# vous y déposez les vidéos à lire !
# Il vaut mieux prendre de petites videos: parce que les démos de 200 Mo...
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

class Game_Film
  def initialize(hash)
    hash.has_key?(:film) ? film=hash[:film] : return
    hash.has_key?(:x) ? @x=hash[:x]+" " : @x="0"
    hash.has_key?(:y) ? @y=hash[:y]+" " : @y="0"
    hash.has_key?(:w) ? @w=hash[:w]+" " : @w=""
    hash.has_key?(:h) ? @h=hash[:h]+" " : @h=""
    hash.has_key?(:vol) ? @vol=hash[:vol]+" " : @vol="1000"
    hash.has_key?(:bass) ? @bass=hash[:bass]+" " : @bass="1000"
    hash.has_key?(:aig) ? @aig=hash[:aig]+" " : @aig="1000"
    hash.has_key?(:pos) ? @pos="at pos #{hash[:pos].to_i*1000} " : @pos="at pos 0 "
    @full=hash[:full] if hash.has_key?(:full)
    @full&&dim_ecran !=[640,480] ? @plee="fullscreen " : @plee=""
    @type=" "
    @type=" type mpegvideo" if File.extname(film)==(".mpg"||".mpeg")
    @type=" type avivideo" if File.extname(film)==".avi"
    @nom='./Films/'+film
    (p "fichier #{@nom} non trouvé";return) if !FileTest.exist?(@nom)
    @film=Win32API.new('winmm','mciSendString','ppll','v')
    lecture
  end
  def handle
    jeu="\0"*256
    ini=Win32API.new('kernel32','GetPrivateProfileStringA','pppplp', 'l')
    ini.call('Game','Title','',jeu,255,".\\Game.ini")
    return Win32API.new('user32','FindWindowEx','llpp','l').call(0,0,nil,jeu.delete!("\0"))
  end
  def lecture
    v,t,status,pause=version,Time.now," "*255,false
    @film.call("open #{@nom} alias FILE#{@type} style child parent "+handle.to_s,0,0,0)
    @film.call("put FILE window at #{@x}#{@y}#{@w}#{@h}",status,255,0)
    @film.call("setaudio File volume to #{@vol}",status,255,0)
    @film.call("setaudio File bass to #{@bass}",status,255,0)
    @film.call("setaudio File trebble to #{@bass}",status,255,0)
    @film.call("play FILE #{@plee} notify",status,255,handle)
    loop{sleep(0.1)
      Input.update
      @film.call("status FILE mode notify",status,255,0)
      break if status.unpack("aaaa")=="stop".split(//)||Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        if !pause;@film.call("pause FILE notify",status,255,handle);pause=true
        else;@film.call("play FILE #{@plee} notify",status,255,handle);pause=false
        end      
      end
      (t=maj(t))if v=='xp'}
    @film.call("close FILE notify",0,0,handle)
    $scene=Scene_Map.new
  end
  def dim_ecran
    lw=Win32API.new('user32','GetSystemMetrics','i','i')
    return lw.call(0),lw.call(1)
  end
  def maj(t)
    (Graphics.update;return Time.now)if t.sec<=Time.now.sec-9||t.min !=Time.now.min
    return t
  end
  def version;FileTest.exist?('./Data/scripts.rvdata') ? 'vx': 'xp';end
end
Dir.open("./Films") rescue Dir::mkdir("./Films",0777)
class Game_Interpreter;def eval(script);cmd_eval(script);end;end#rmvx
class Interpreter;def eval(script);cmd_eval(script);end;end#rmxp
def cmd_eval(script)
  if script.include?("[film]")
    hash={}
    script.gsub!("[film]"){}
    list=script.split("\n")
    list.each{|e|e.gsub!(" "){};f=e.split("=");hash[f[0].to_sym]=f[1] if !f[1].nil?}
    Game_Film.new(hash)
  else;return Kernel.eval(script)
  end
end


the demo

enjoy !

Caution:
this script is totally free of use, but I need an apparent credit in your game and:

Do not post these scripts anywhere without my permission !

This post has been edited by berka: Feb 8 2009, 01:44 AM


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
SojaBird
post Jan 21 2009, 09:27 AM
Post #2


Level 51
Group Icon

Group: Revolutionary
Posts: 1,573
Type: Scripter
RM Skill: Advanced




Well you know, like the vid is playing on a tv screen biggrin.gif That should be fun. (Could be done with show picture though).

Anyway,
Pure cool coding you've done so far biggrin.gif


Greatzz,
SojaBird.


__________________________
Art from the highest shelf?

Scriptology, scripting podcast



HUD's Request Lobby (multiple hud-scripts)


------------------------------------------------------------------

Random Stuff
OMG, it's Hab!!


This is a crazy drawing application! (by me)

How did I learned to script
QUOTE
Hey pim! I'm the Law G14!

For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.

Thanks in advance.


Hey there,

Well I don't make battle neither though I can still teach you some things :)...
The way I've learned to script is by reading other scripts for the most part.
I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!!
The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script.
You also need to feel the competition that's around in the scripting-community.
Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P
So that's an other thing...
You also don't need to be afraid to learn from others or helpfiles.
When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember.
Then, you must be calm, cause you need to try the script a lot of times.
When I write a script, I test it after almost every changes.
First I set up the major structure.
Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
refresh
end

def refresh
self.contents.clear
draw_contents
end

def draw_contents
draw_something(with, some, parameters)
end

def update
refresh if @something != @what_it_should_be
end
end
So that's also very important.
Then, the biggest thing I learned scripting from is TRIAL AND ERROR.
That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.

So that's it how I did it.
Now it's up to you.
Do some requests (if I didn't do it allready :P) and learn from them.

Hope that helped you out a little.
If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials.
Perhaps they're going to be usefull for you one day ;)


Greatzz,
SojaBird.
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- berka   Berka's Video script II reloaded !   Jan 16 2009, 02:39 PM
- - paladin99706   Hmm.. interesting.... I'll give it a try.   Jan 16 2009, 03:35 PM
- - dandanthedan   wow! ill give it a try...although im using tre...   Jan 16 2009, 06:33 PM
- - berka   I'll provide you a demo !   Jan 17 2009, 03:43 AM
- - omegazion   wow berka, you make video scripts sound so easy to...   Jan 17 2009, 07:01 AM
- - Mickadell   Comment Rate: Good You have done a good job. It w...   Jan 17 2009, 03:22 PM
- - berka   thanks ! suggestions for improving this scrip...   Jan 18 2009, 04:09 AM
- - kamster94   can u write how to call video from Main Menu (Scen...   Jan 20 2009, 10:54 AM
- - berka   well... you can transfer the player in an empty ma...   Jan 20 2009, 12:45 PM
- - Genshyu   Tried your chara gen.. AWESOME DUDE. Very nice .   Jan 20 2009, 03:11 PM
- - dezet   thank you so much   Jan 21 2009, 03:17 AM
- - pim321   Very nice, Perhaps you could add a function so tha...   Jan 21 2009, 04:52 AM
- - berka   QUOTE (Genshyu @ Jan 21 2009, 12:11 AM) T...   Jan 21 2009, 05:00 AM
- - berka   all right ! it is not possible since the video...   Jan 21 2009, 09:59 AM
- - luciferx   Nice Script... But when i try implemented on RMXP(...   Jan 22 2009, 09:09 PM
- - onidsouza   Hey SUPER ULTRA VERY NICE MEGA COOL SCRIPT! an...   Jan 26 2009, 04:40 PM
- - onidsouza   One thing about your script, once the video stops ...   Jan 27 2009, 04:37 PM
- - berka   yeah... maybe it's a focus issue... i'll f...   Jan 28 2009, 07:56 AM
- - aznguy212   oni please use edit your post and do not double po...   Jan 28 2009, 08:49 AM
|- - Midnight Assassin   QUOTE (aznguy212 @ Jan 29 2009, 02:49 AM)...   Apr 26 2009, 07:56 PM
- - onidsouza   Ok i will stop doing doble posting   Jan 28 2009, 09:53 AM
- - berka   new version: window's hangup resolved and cod...   Feb 7 2009, 02:26 PM
|- - onidsouza   QUOTE (berka @ Feb 7 2009, 08:26 PM) new ...   Feb 8 2009, 09:10 PM
|- - oioioi   QUOTE (onidsouza @ Feb 8 2009, 09:10 PM) ...   Apr 2 2009, 03:46 AM
- - Traumatized   This script works for me but the problem is i got ...   Apr 21 2009, 05:08 PM
- - Tsutanai   Is there a way to play this before the title scree...   Apr 21 2009, 05:17 PM
- - kunitaj   this is so impressive it made me shriek. But the m...   Apr 22 2009, 01:31 PM
- - mortigneous   hmm... I was looking for one of these everyone i s...   Apr 22 2009, 05:56 PM
- - Traumatized   Can someone tell me why my video is not playing ri...   Apr 22 2009, 08:19 PM
- - zeshiba   Hey berka how do I make this compatible in battles...   Jun 4 2009, 07:49 PM
- - xerious   for the minimize problem i found a solution: use ...   Jun 9 2009, 10:12 AM
- - Bandito   dude the problem with this is that not everybody h...   Jun 27 2009, 11:02 PM
- - aggiegwyn   QUOTE (berka @ Jan 16 2009, 03:39 PM) Hi ...   Jul 15 2009, 10:34 AM
- - wallywest07   Okay this is what i've done,copy my movie into...   Sep 9 2009, 02:08 PM
|- - wallywest07   QUOTE (wallywest07 @ Sep 10 2009, 06:08 A...   Sep 9 2009, 02:28 PM
|- - dricc   QUOTE (wallywest07 @ Sep 9 2009, 03:28 PM...   Sep 10 2009, 03:28 AM
- - PnP   This is a really nice script and I would absolutel...   Sep 13 2009, 12:59 PM
- - wallywest07   OK here's what I've done.Before my compute...   Oct 1 2009, 11:12 PM
- - megamario   I Tried it and it makes my game freeze for about 3...   Nov 15 2009, 01:58 PM
- - Mefisno   Hey I was wondering is there a way to use this scr...   Dec 30 2009, 08:42 AM
- - DarkSarul   O..M..G.. IT ACTUALLY WORKS LOL SWEEET YOU ARE AWE...   Feb 24 2010, 01:38 PM
- - arokalot   I'm new to this site, but I've been hangin...   Apr 16 2011, 09:14 AM
- - Kread-EX   Yeah, you can't really do anything about that....   Apr 16 2011, 09:21 AM
- - arokalot   Thank you, I'll test a few things out and post...   Apr 16 2011, 03:14 PM
|- - Pharonix   I really hate necroing but I really need the help ...   Aug 15 2011, 08:48 AM
- - Zin Zero   I'm actually having the same issue as Pharonix...   Jan 9 2012, 01:58 AM
- - andyvrc [$]   can i use the another format except .avi ?? like ...   Jan 10 2012, 12:31 AM
- - berka   Hi, What are the scripts you want to use with my ...   Jan 11 2012, 05:39 PM
- - Zin Zero   Okay, well specifically I'm using the KGC_Larg...   Jan 15 2012, 05:56 PM
- - Ishtem   I've put the script in, put my video in the fi...   Feb 26 2012, 02:52 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 10:21 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker