Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - nightmarer

#81
Beginners' Technical Questions / Array length
Thu 08/04/2021 22:42:52
Hello.

I would like to transfer all the items from one character to another character which is going to be the player.ç
I was trying to create a for to transfer them from one to another, but I don't know which property gets the number of that array

Code: ags
  for(i = 1, i < CharacterA.InventoryQuantity[].length(), i++) {
    CharacterB.InventoryQuantity[i] = CharacterA.InventoryQuantity[i]; 
  }


Thank you.
#82
Hello.

I want my player to move inmediatly to another location in the room. I tried Change Room using as room the same room, but it does again the room Load.
I'm sure there is a way to do it but I didn't get it yet. Does anybody know how to do it?

Regards.
#83
Good idea, thank you!
#84
Hello.

There is many functions to set the direction that a character is facing to, but I would like to know if there is a why to get which is that direction in orden to build an script that will run the proper loop and save many lines of code.
Any idea?

Regards.
#85
Hi, this error has been fixed in the new version 3.5.1.
Thank you very much!
#86
Great! Thank you
#87
Thank you very much.
#88
Hello all again.

I'm trying to build somekind of SMS application for my game in which the main character will be able to read all the incomming messages other charaters may send to him.
To achieve this I have defined an struct in a script header in order to have two strigs, one with the sender, and another one with the text message.
Code: ags

struct MsgPDA {
 String Sender;
 String Msg;
};


Following the struct documentation in the following link https://www.adventuregamestudio.co.uk/manual/ags43.htm#struct
Following the recommendation I am trying to combine it with an array.
Code: ags
MsgPDA msg[10];
msg[0].Sender = "Sara";
msg[0].Msg = "Hello, its me.";


My intention is to call this array from any room. But I don't know where I need to place each part of the code, as I am receiving
My questions:

  • The struct I guess it goes in the header of the script. Is that right?
  • Where I should place the array definition? If I enter in the body of the script it says that msg is unexpected.
  • Do I need to do something else to call this array from any room?

Thanks and regards.
#89
Thank you, Monsieur.

I've been really busy during last weeks.
I want to first finish some parts of the game before I show any game file.

Regards.
#90
Hi.

I've been trying to build an exe file, but I don't know why I am getting an error in this compiled file which I don't having while playing the game from AGS.
As soon as I got it I'll get back to you.

Regards.
#91
During the execution it stops and it pops up the message with the text I written above.
#92
Quote from: Crimson Wizard on Tue 02/03/2021 18:19:42
This is weird.
As a random thought, how long are your clip names? AGS has still a hidden limit of 30 (or 29) chars for a audio name, but it does not warn about it.

The audio filename is aEden, so as you see is not really long.

Quote from: Crimson Wizard on Tue 02/03/2021 18:19:42
How exactly do you use audio in script (how do you play it)?

I am using this script, but let me tell you that it works perfect with any of the files below 175 id, even this same file now it works as I deleted 2 audio files just for testing.

Code: ags
static void SetBGM::Play(AudioClip *music, SetBGM_Channel index) { //Canal principal de música bgm para el 1 bgm para el 2
  if (music != seekaudio && Isaac.Room != 30) {
    SetBGM.Stop(seekaudio);
  }
  if (bgm[index] == null || bgm[index].PlayingClip != music) {
   bgm[index] = music.Play(); //Music is played
   seekaudio = music;
  }
  else if(music == null) {
    music.Stop();
  }
}

seekaudio is a global variable that stores the last song played, so if you enter in a room with the same song it won't play it back, it will just continue playing it.
#93
Hello.

QuoteAs I'm trying to play one music file I am receiving:
An internal error has occurred. Please note down the following information.
If the problem persists, post the details on the AGS Technical Forum.
(ACI version 3.5.0.29)

Error: Error running function '_run_dialog15':
Error: Pointer cast failure: the object being pointed is not in the managed object pool

It just happens with the new audios (since number 175) I am entering in the game. It doesn't happenen if play another audio file below 175.
Any idea?

One clue that may not have relation. When I enter a new audio the auto fillcode doesn't recognize this file it untill I restart AGS. Anyway, even adding the audio file and after restarting doesn't solve this issue.

Update: I made sure that the audio is able to be played in the audio menu.

Update: If I delete audio files, this last audio id goes down and now is it able to be played.
#94
Anyway, let me let you know that finally I made it possible.
Out of the script I can set the volume to the pointers without having this issue.
So I just needed to make different methods for that and call them in the next line.

Regards.
#95
Thanks for your answers, both of you.
#96
Good morning all.

Let me continue this thopic as I found something really weird.

As usual there are one array with two indexes pointing 2 different AudioChannels

Code: ags
AudioChannel *bgm[2];


Everything is fine untill I play a new track in any of the two channels. Untill the stack is not finish it will copy the same values in volume for both indexes.
Also I must mention that the AdioChannel ID is changing. Is that normal?

I'm going to put in the comments the result of the Displays.

This is the instruction for running the script.
Code: ags
SetBGM.Play(aDecadance_disco, ChannelA, 57);


Now these are the results of the script.
Code: ags
static void SetBGM::Play(AudioClip *music, SetBGM_Channel index, int initialvol) { 
  if (bgm[index] == null || bgm[index].PlayingClip != music) {
   if (bgm[1] != null) {
     bgm[0].Volume = 41;
     bgm[1].Volume = 42;
     Display("Channel ID of A = %d", bgm[0].ID); //Channel ID of A = 2
     Display("Channel A before playing track = %d", bgm[0].Volume); //Channel A before playing track = 41
     Display("Channel ID of B = %d", bgm[1].ID); //Channel ID of B = 1
     Display("Channel B before playing track = %d", bgm[1].Volume); //Channel B before playing track = 42
   } //So far so good
   bgm[index] = music.Play(); //Music is played and now the issue begins
   if (bgm[1] != null) {
     Display("Channel ID of A = %d", bgm[0].ID); //Channel ID of A = 1    ---Why now does it have another ID?
     Display("Channel A after playing track = %d", bgm[0].Volume); //Channel A after playing track = 100
     Display("Channel ID of B = %d", bgm[1].ID); //Channel ID of B = 1    ---Now both arrays are pointing the same index
     Display("Channel B after playing track = %d", bgm[1].Volume); //Channel B after playing track = 100
   }
   bgm[index].Volume=initialvol; //initial vol is 0;
   bgm[0].Volume=57; 
   if (bgm[1] != null) {
     bgm[1].Volume=59;
     Display("Channel ID of A = %d", bgm[0].ID); //Channel ID of A = 1 
     Display("Channel A now = %d", bgm[0].Volume); //Channel A now = 59
     Display("Channel ID of B = %d", bgm[1].ID); //Channel ID of B = 1
     Display("Channel B now = %d", bgm[1].Volume); //Channel A now = 59
   }
  }
  else if(music == null) {
    music.Stop();
  }
}


If I enter a new change out of this script everything goes fine, but I don't now why the function Play() is temporally pointing both index to the same AudioChannel ID.
#97
Quote from: Crimson Wizard on Wed 24/02/2021 23:45:18
So, how many channels are reserved for music audio type? I have a feeling there's MaxChannels set to 1. If it is, you just need to increase it to 2.

This is done by going to Audio -> Types -> Music in the project tree.

Ohh! That was the error. So maybe this should be moved to the beginners questions.
Thank you again for your help.
#98
Quote from: Crimson Wizard on Wed 24/02/2021 23:17:27
Quote from: nightmarer on Wed 24/02/2021 23:14:55
Can you see the Display text added in the code?
This is the way I tested it.

Yes, but what did these displays show? Was the index correct, or same all the time regardless of what you pass?

Quote from: nightmarer on Wed 24/02/2021 23:14:55
I hear the same song in both channels. Maybe it is the same channel?

You can test what the channel is by doing so:
Code: ags

Display("channel ID = %d", bgm[index].ID);


I've added your line and it shows the same for both indexes. ID = 1.
https://ibb.co/VxGXWRh
#99
Quote from: Crimson Wizard on Wed 24/02/2021 23:03:50
Quote from: nightmarer on Wed 24/02/2021 22:54:31
The second line seems to overwrite the same pointer in spite it is using different index in the array.

How do you test that it overwrites same pointer? Does it actually overwrite wrong element in array, or you just noticed that playing second music stops the first one?
How many channels are there reserved for music audio type?
Can you see the Display text added in the code?
This is the way I tested it.
I hear the same song in both channels. Maybe it is the same channel?
I used these different testes to check it.
Code: ags
  SetBGM.SetVolumen(ChannelB, 0);
  Display("B to 0");
  SetBGM.SetVolumen(ChannelB, 100);
  Display("B to 100);
  SetBGM.SetVolumen(ChannelA, 0);
  Display("A  to 0");
  SetBGM.SetVolumen(ChannelA, 100);
  Display("A to 100");
  SetBGM.SetVolumen(ChannelB, 0);
  Display("B to 0 again");
  SetBGM.SetVolumen(ChannelB, 100);
  Display("Be to 100 again);
#100
Good evening all.

I am continuing this thread I changed the name as now the issue is another.
https://www.adventuregamestudio.co.uk/forums/index.php?topic=58871.0
First I wanted to make the script work but seems that AGS doesn't like to play two tracks at the same time in this way.

In this enum:
Code: ags
enum SetBGM_Channel {
  ChannelA = 0,  
  ChannelB = 1
};


With these array of pointers:
Code: ags
AudioChannel *bgm[2];


With this function:
Code: ags
static void SetBGM::Play(AudioClip *music, SetBGM_Channel index, int initialvol) { 
  if (bgm[index] == null || bgm[index].PlayingClip != music) {
   bgm[index] = music.Play();
   bgm[index].Volume=initialvol;
   Display("index = %d", index);
   Display("Initial volumen = %d", initialvol);
  }
  else if(music == null) {
    music.Stop();
  }
}


If I enter this code.
Code: ags
  SetBGM.Play(track1, ChannelA);
  SetBGM.Play(track2, ChannelB);


The second line seems to overwrite the same pointer in spite it is using different index in the array.
So this way of doing it doesn't work.
Is there any other way to do it?
SMF spam blocked by CleanTalk