Help with PlayVideo script command

Started by timrocket2, Sat 24/03/2018 21:23:40

Previous topic - Next topic

timrocket2

Hello,

I'm new to AGS, and ive been struggling with this scripting for the last hour. I have scoured the internet for help but I still cannot get it to work.

So i have started making a game, so far with one room and the default character and a basic background.

I just want to get AGS to play an intro video in-game but when i Run the game, no video plays and the character enters the room after fade-in.

I have put the video file (tried mp4 and ogg formats) in both the Compiled and the Compiled/Data subdirectory of the main game directory in My Documents but none work.

Is there anything wrong with this room script?:

// room script file
// PlayVideo "YuniWorldDemo1.mp4",1, 1


thanks in advance

Crimson Wizard

#1
Quote
// room script file
// PlayVideo "YuniWorldDemo1.mp4",1, 1

Is this literally the command you have in script? Thing is that it has "//" prepended, which means it is treated as comment, not command, and never actually executed.

First of all, the script must be put into a function in order to run.
In AGS script is not run if you just put a command into script file. You need to define an event which starts it.
If you go to the room properties pane and switch to events (lightning button), you will find a list of events you may bind a function to:



For example, "After fade-in" event takes place after room transition is over. Double click on empty string to the right from "After fade-in", this will create a function with default name in the script file. Then you can put your commands there.

Secondly, this is not how a function is called. You need to surround function parameters with round braces:
Code: ags

PlayVideo("YuniWorldDemo1.mp4", 1, 1);



Quote from: timrocket2 on Sat 24/03/2018 21:23:40
I have put the video file (tried mp4 and ogg formats) in both the Compiled and the Compiled/Data subdirectory of the main game directory in My Documents but none work.
Just in case, OGG files need to be placed in the game's root folder, not Compiled folder, they are dealt with a bit differently.


Quote
I'm new to AGS, and ive been struggling with this scripting for the last hour. I have scoured the internet for help but I still cannot get it to work.
Have you actually tried any tutorials from the manual? These will cover most basics, including how to create functions and call them.

SMF spam blocked by CleanTalk