Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Lionheart on Tue 14/06/2005 18:33:55

Title: Some Questions dealing with music and gui [Solved]
Post by: Lionheart on Tue 14/06/2005 18:33:55
I looked around but couldn't find any answers to these questions, not to mention I have no scripting knowledge what so ever.

Ok so the first question i had was how can i  put 2 screens in the game, as an introduction? I want the first screen  to appear and say the name of the team that makes it, then fade and then another screen appears and it shows the title of the game, and then fades to the main title screen where you can Start Game and Load Game.

How can i do that? I tried making them as rooms with the character invisible and then i tested the game and the gui bar was there and sort of messed it up, not mention i wasn't sure how to automaticaly fade into the next screen.

and Question #2 was, how do i add a sound effect/music into a room, is there a script i have to know and put it in somehow? because i am totally clueless.

Sorry for these newbish questions but i am sure i'll get the hang of it eventually..

Thanks in advance.
Title: Re: 2 Questions dealing with main intro + music
Post by: Akumayo on Tue 14/06/2005 18:59:59
Answer 1:  I did something similar to this when I entered last year's july mags.  I used objects rather than new rooms, (btw, change your GUI to a popup-modal and turn it off when the game starts).  Anyway, make objects that are your game's resolution, then show them one at a time with simple Object On and Object Off commands.  Then, when they are all off, your main menu (the actual room background) will be visable.  (At this point turn the GUI back on)

Answer 2:  I think there's a child function for play music, stop music, etc.  But I'm not good with music so someone else would be a better answerer to this one.
Title: Re: 2 Questions dealing with main intro + music
Post by: Lionheart on Tue 14/06/2005 19:08:15
Ok i sort of see what your saying, but how do i turn the GUI off momentarily, and how do i do the object on and off commands?

Title: Re: 2 Questions dealing with main intro + music
Post by: Akumayo on Tue 14/06/2005 19:18:51
The only way I know how to do it is with a TINY bit of scripting so bear with me and at least try this okay?

First!  Make your title screen a room,
Second! make object 1 a picture of the game title and set it so that it lays on top of the room, make object 0 a picture of the team that makes it and set it so that it lays on top of the room, and change the name of your GUI to INTRO. 
Third!  In the GUI editor, go to where it says "popup-modal, popup-y-pos, constant, etc" on your INTRO GUI and set it to popup-modal.
FOURTH!:  Under First time player enteres screen, go to Run Scipt at the very top of the function list, a window will open, insert the following:


ObjectOff(0);
ObjectOff(1);
GUIOff(INTRO);
ObjectOn(0);
Wait(200);
ObjectOff(0);
ObjectOn(1);
Wait(200);
ObjectOff(1);
GUIOn(INTRO);



The code above will display your Team object for 5 seconds, then your Game Title object for 5 seconds, then will show the main menu and the INTRO GUI.

Title: Re: 2 Questions dealing with main intro + music
Post by: Lionheart on Tue 14/06/2005 20:57:08
Thanks, i'll have to try that..

Another Problem i am having now is with the GUI, i can't seem to get the talk box to fit correctly, there are always blue lines on the top, and its the same size as the other default ones. I measured it at 32/27.

http://www.2dadventure.com/ags/Grr.JPG
Title: Re: 2 Questions dealing with main intro + music
Post by: Akumayo on Tue 14/06/2005 21:02:35
Simply move the button up one pixel, that should eleminate the blue line (btw), next time add a link to a screen image this large to avoid taking up forum space.
Title: Re: 2 Questions dealing with main intro + music
Post by: strazer on Wed 15/06/2005 14:20:17
QuoteAnother Problem i am having now is with the GUI, i can't seem to get the talk box to fit correctly, there are always blue lines on the top, and its the same size as the other default ones. I measured it at 32/27.

It looks like your new icon has a transparent background, showing the GUI beneath. And since the GUI has the border color set to blue, you see the blue lines.
Set the GUI's border color (/foreground color) to 0 to remove the blue border.
Title: Re: 2 Questions dealing with main intro + music
Post by: Lionheart on Wed 15/06/2005 14:51:08
wow thanks strazer, its fixed.

and i couldn't find where you were talking about with the room script, so i went under room and went to edit room script, and copied and pasted it and it said there was a problem with it

it said error 2: parse error object 2 or something like that.
Title: Re: 2 Questions dealing with main intro + music
Post by: strazer on Wed 15/06/2005 15:37:24
You can't just put the script somewhere into the room script. It has to be inserted into a function:

Quote
FOURTH!:  Under First time player enteres screen, go to Run Scipt at the very top of the function list, a window will open, insert the following:

Room Editor / Settings -> "i" button -> Right-click "First time player enters screen" -> "New action..." (or double-click if it's the first action you add) -> "Run script" -> "Edit script..." -> NOW paste the code -> Ok ok ok ok etc.

Press the room script button ("{}") again and you will see that a function named room_a or something has been created by the interaction editor and your code is contained in there.
Title: Re: 2 Questions dealing with main intro + music
Post by: Lionheart on Wed 15/06/2005 16:28:09
http://www.2dadventure.com/ags/Error.PNG

Thats what the screen says, when it gave me an error, and i did what you guys said.

The Objects are on top of the title and the script  is on the new player thing.

Heres what it says:
// room script file

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: First time player enters screen
ObjectOff(0);
ObjectOff(1);
GUIOff(INTRO);
ObjectOn(0);
Wait(200);
ObjectOff(0);
ObjectOn(1);
Wait(200);
ObjectOff(1);
GUIOn(INTRO);
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE
Title: Re: 2 Questions dealing with main intro + music
Post by: strazer on Wed 15/06/2005 16:50:20
If you're using AGS v2.7 and have "Enforce object-based scripting" checked in the General settings, you won't be able to use old-style functions.
So either use
  object[0].Visible = false;
instead of ObjectOff(0);
or uncheck "Enforce object-based scripting" in the General settings.
Using new-style coding is recommended though. You can enter old function names in the search box in the help file, it redirects you to the new commands.
Title: Re: 2 Questions dealing with main intro + music
Post by: Lionheart on Wed 15/06/2005 17:13:00
Alright it works,

now i just have to try and figure out how sound and music can be added?

do you know how to add that in?

Thanks to both of you for your help by the way.
Title: Re: 2 Questions dealing with main intro + music
Post by: strazer on Wed 15/06/2005 17:21:25
No prob. :)

Check the BFAQ for all your newbie needs: AGS Beginners FAQ (http://americangirlscouts.org/agswiki/Music%2C_Sound_%26_Speech#Getting_sound.2Fmusic_into_your_game)
Title: Re: 2 Questions dealing with main intro + music
Post by: manny.p on Wed 15/06/2005 19:22:24
1. is there anyway to ignore a function just for one room?
    (like the gui that appears at the bottom of the MI2 template)

2. How can i make my character invisble in the starting room?
Title: Re: 2 Questions dealing with main intro + music [SOLVED!]
Post by: strazer on Wed 15/06/2005 21:15:57
1. Do you mean you want the GUI at the bottom not to show in a specific room?
If so, just turn it off when entering the room ("Player enters screen (before fadein)" interaction) and on when leaving the room ("Player leaves screen" interaction).

2. Have you tried the "Hide player character" checkbox in the room settings?
Title: Re: 2 Questions dealing with main intro + music [SOLVED!]
Post by: manny.p on Wed 15/06/2005 22:16:37
Found it
Title: Re: Some Questions dealing with music and gui
Post by: Lionheart on Thu 16/06/2005 00:57:54
Ok so i am trying to add music into my game now and i followed the instructions to the best of my ability..

i put the midi file into the game folder

then i renamed it MUSIC1.MID

then i went into interaction editor, and then went to play music when player first enters screen and put in 1 for the number.

i started up the game, and i hear nothing..



Title: Re: Some Questions dealing with music and gui
Post by: Gilbert on Thu 16/06/2005 02:45:24
Is it possible that explorer of your computer was lamely set up to 'hide known file extensions' (yes I know it's probably the default setting, but it surely is lame)? if that's the case it's possible that you had actually named your file:
MUSIC1.MID.MID
Title: Re: Some Questions dealing with music and gui
Post by: Lionheart on Thu 16/06/2005 03:33:07
Quote from: Gilbot V7000a on Thu 16/06/2005 02:45:24
Is it possible that explorer of your computer was lamely set up to 'hide known file extensions' (yes I know it's probably the default setting, but it surely is lame)? if that's the case it's possible that you had actually named your file:
MUSIC1.MID.MID

WOW!!!! It Works!!! Thank you so much i am in your debt..

i have tried for hours to get it to work and now it does, that relieves a lot of stress..

Thanks to everyone who has helped me, now i can work on my game some more.
Title: Re: Some Questions dealing with music and gui [Solved]
Post by: manny.p on Thu 16/06/2005 15:54:00
Got 2 questions.

1. How do i make a gui non default?
Because if i create a new room my main menu gui pops up, when i only want it to pop up when i tell it to ie. my intro

2. How do i change room, without taking that room settings with it?
I change from room 1 to room 2 still having the gui[5].Visible = false; function activated, i just want to stop all commads given up to room 1 when entering room 2.
Title: Re: Some Questions dealing with music and gui [Solved]
Post by: strazer on Thu 16/06/2005 16:37:24
Please open a new thread if you have further questions that are unrelated to the current thread. Anyway:

1.) Set its visibility to "Popup Modal" in the GUI editor. This way it will be off when the game starts and only be displayed when you turn it on manually. Keep in mind that in this case the game will be paused while the GUI is displayed.

If you want the game to keep running while the GUI is displayed, leave its visibility at "Normal" and just turn it off in the game_start function. Then turn it on when you need it.

2.) I don't quite understand. You don't start and stop commands. If you turn a GUI off, it's off. If you want it to turn back on, you have to turn it on again yourself. Just put the command in the "Player leaves screen" interaction of the room, for example.
Title: Re: Some Questions dealing with music and gui [Solved]
Post by: manny.p on Thu 16/06/2005 19:49:59
Thnx m8 that popup modal thing worked great.

And this one reason why it took me so long to figure out is because i was re-enabling the dialouge box which covered my inventory so i didn't think the gui was back on.

Silly me