Import an older AGS Game

Started by Ghostlady, Mon 24/07/2023 04:59:42

Previous topic - Next topic

Ghostlady

I'll check those out.  One other thing.  In the old version, if there is music playing, I can travel from room to room without it interrupted.  What it is doing now is restarting the music from the beginning each time I enter a room.  Its the same song.  How do I fix that?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

Quote from: Ghostlady on Sun 30/07/2023 21:10:32I'll check those out.  One other thing.  In the old version, if there is music playing, I can travel from room to room without it interrupted.  What it is doing now is restarting the music from the beginning each time I enter a room.  Its the same song.  How do I fix that?

Please tell how the music was commanded to play? Is it by script command, or using "play music on room load" setting?

In the last case, the Editor would convert this setting to a command in script, which will start a music anew every time you enter a room.
If that's the case, then you need to add a condition that checks if this music is already playing. With old commands that would be IsMusicPlaying() probably.

Ghostlady

It's in the Event where the player enters the screen before fade in:

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  aMusic3.Play();
  // script for Room: Player enters screen (before fadein)
mouse.DisableMode(eModeWalkto);

I'll try the  IsMusicPlaying()  command.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

#43
IsMusicPlaying may be a wrong check actually, because it does not let to test if particular music is playing.

If you are using imported audio clips, then there are few other methods, but the most straightforward is to save the current music channel, returned by the aMusicN.Play() command, in a global variable of type AudioChannel, and check that. In this case the code would be:
Code: ags
    if (musicChan == null || musicChan.PlayingClip != aMusic3)
        musicChan = aMusic3.Play();



There's another option, which I will mention just in case, where you write a custom function that scans all the channels and checks if particular clip is playing:
Code: ags
bool TestIfClipPlaying(AudioClip* clip)
{
    for (int i = 0; i < System.AudioChannelCount; i++)
    {
        AudioChannel* ch = System.AudioChannel[i];
        if (ch.IsPlaying && ch.PlayingClip == clip)
            return true;
    }
    return false;
}

If you put this function in a global script, you then may use it in every room like
Code: ags
    if (!TestIfClipPlaying(aMusic3))
        aMusic3.Play();



or even....
Code: ags
// Start the clip unless it's already playing, returns the audio channel which has it playing
AudioChannel *PlayIfNotPlaying(this AudioClip*)
{
    for (int i = 0; i < System.AudioChannelCount; i++)
    {
        AudioChannel* ch = System.AudioChannel[i];
        if (ch.IsPlaying && ch.PlayingClip == this)
            return ch;
    }
    return this.Play();
}

which may be used like
Code: ags
    aMusic3.PlayIfNotPlaying();

Ghostlady

PERFECT! I used the first suggestion and it's working as expected.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

Is there a way to globally turn up the volume whenever a sound is being played?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

#46
Quote from: Ghostlady on Sun 06/08/2023 01:45:30Is there a way to globally turn up the volume whenever a sound is being played?

Please clarify what do you mean by this? Do you mean changing the sound volume in game, or altering it for a particular sound temporarily while it plays and then lowering back down? or something else?

On a side note, as this no longer seem related to upgrading a game, I might suggest opening a new forum thread for the new technical questions.

Ghostlady

#47
I was thinking of changing the sound volume in game but if I can do a particular sound file and turn up the volume while it is playing in the room that will work.

I'll create a new post for any new questions not related to upgrading a game. 
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

I've added some extra backgrounds into a room to allow some things to animate.  It doesn't seem to be working. It's marked in the properties that animate is active. Is there some code I need to add due to adding a new function to older code?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Khris

One thing that can cause the animation not to play is having SetBackgroundFrame() in your room script.

Ghostlady

I don't have that set in the room script. Actually it's a very small script with not too much going on.  That's why I was thinking it's an old game script vs current AGS version issue.

Here's the script:

// room script file

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: Repeatedly execute
if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hLeft) {
      mouse.UseModeGraphic(eModeUsermode3); }

}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot1_a() {
  // script for Hotspot 1: Interact hotspot
player.ChangeRoom(94); 
}
#sectionend hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: Player enters screen (before fadein)
mouse.DisableMode(eModeWalkto);
PlaySound(32); 
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

#51
Quote from: Ghostlady on Thu 17/08/2023 19:29:10I don't have that set in the room script. Actually it's a very small script with not too much going on.

Do you have this in any of the global script perhaps? You may search for SetBackgroundFrame in the whole project using Find dialog in AGS.
What is the value of BackgroundAnimationDelay?

I don't think there's any other condition under which this won't run.

Ghostlady

#52
I couldn't find how to "Find dialog in AGS" but I searched the two global scripts and neither of them have SetBackgroundFrame.  The BackgroundAnimationDelay is set to 25.

I have another room that uses background animation, which is set to 25, and it came in with the old game and it works perfectly.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

The "Find" dialog is in Edit menu, which is only visible when any script is open.


Can you double check that the room has a second background? Do you see it in the list of backgrounds when you open  "Background" list in the room editor, and is it visibly different from the first one?

Could you perhaps upload your room file to let us check it out?

Ghostlady

I figured it out.  I forgot about the saving and you can't add anything new to the rooms and I was using a save.  Instead I teleported straight to the room and now it is animating.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

#55
Quote from: Ghostlady on Mon 21/08/2023 04:27:51I figured it out.  I forgot about the saving and you can't add anything new to the rooms and I was using a save.

This is strange. When you restore a save the room's backgrounds still should be in place since these are not written to a save but taken from the current room file. Room bgs animate by default, so unless there was a "fixed bg" parameter set at the time the save was done, I cannot explain why animation was not playing.

Ghostlady

These are the items done and the timeline:
1. Imported old game into latest AGS software
2. Had to make numerous coding changes to get a final run
3. Started playing the game and making new saves since I am updating numerous things
4. Decided I wanted to animate a particular room that was not animated previously
5. Updated that room with a total of 5 images where before there was only one
6. I used a save from item #3 since I was near the end of the game and didn't want to play it again to this point
7. Got to this room and it was not animating
8. Changed my first room to teleport me to the room I wanted animated (#5) and it immediately started animating
9. I did not have a fixed bg for this room or in the global script.
Hope this helps.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

#57
No, unfortunately, this is not what I experience if I try to test this.
I created a small dummy game in AGS 2.72, with 2 rooms, each having only 1 bg.
Imported this game to AGS 3.6.0. Started the game, went to room 2 and saved in there.
Quit, added more bg frames to the room 2. Started the game and loaded the save. Room 2 was animating.

Possibly there could be other factors, but I am not sure this is worth testing further, since the problem seem to have been solved.

Ghostlady

The only difference is that I probably overwrote a save and not created a new one.  But like you said probably not worth testing anymore.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

SMF spam blocked by CleanTalk