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

Topics - Laura Hunt

#1


Would it be possible to make these arrows a bit taller, or replace them with elements that are a bit easier to click? It really is a bit of a pain to have to click on an area that's like 4 pixels tall in order to scroll through lists of room elements.
#2
This is kind of a weird one and it might be difficult to explain, but I'll try my best. Using 3.6.0 RC 2.

In a test room for my game, I'm doing the following:

Code: ags
oExampleObject.SetView(FIRSTVIEW);
oExampleObject.Animate(2, 6, eOnce, eBlock);
oExampleObject.SetView(SECONDVIEW);
oExampleObject.Animate(2, 6, eOnce, eBlock);
oExampleObject.SetView(THIRDVIEW);
oExampleObject.Animate(2, 6, eOnce, eBlock);

I know that when you call SetView without the optional loop and frame parameters these default to 0, so that what I'm doing here is equivalent to oExampleObject.SetView(FIRSTVIEW, 0, 0).

However, I made a tiny mistake here, because loop 0 for FIRSTVIEW, SECONDVIEW and THIRDVIEW is empty.

I would expect the game to maybe crash or throw a warning in this case, but what it's doing instead is playing a frame-linked audio that belongs to a completely different view from any of these three every time the SetView command is triggered.

Furthermore, I have not called SetView on any object or GUI button before this.

Obviously what I need to do is set the correct loop in the SetView command: oExampleObject.SetView(FIRSTVIEW, 2). Still, this is very confusing, because I have no idea why AGS is choosing to trigger that specific view and frame when it finds an empty loop.

Anybody have any idea what might be going on here?
#3
Hey all,

Apologies in advance for throwing three issues into a single post, but since two of them are pretty short questions and they're all kind of related, I thought I would save time this way.

1) How do I properly check for null pointers?

For example, let's say I have this in room 2 of my game (tickingclock has already been defined through the global variables panel):

Code: ags
tickingclock = aClock.Play(eAudioPriorityNormal, eRepeat);
tickingclock.Volume = 50;


And this in room_load() in room 3:

Code: ags
if (tickingclock != null) tickingclock.Volume = 10;


I still get an NPE if tickingclock has not been initialized (for example, if I teleport from room 1 directly to room 3 via the debug key combo Ctrl+x). Is this not the correct way to check if an audiochannel is null? I seem to recall I've done it this way before and it worked ???


2) This section of the manual confuses me (talking about the Play command):

QuoteThis command searches through all the available audio channels to find one that is available for this type of audio. If no spare channels are found, it will try to find one that is playing a clip with a lower or equal priority, and interrupt it to replace it with this new sound.

So if I have reserved 2 max channels for "Ambient sound" audiotype clips and I do this (again, assuming myatmo1, myatmo2 etc are defined in the global variables panel and all these audio clips are "Ambient sound" types):

Code: ags
myatmo1 = aAtmos1.Play(eAudioPriorityHigh, eRepeat);
myatmo2 = aAtmos2.Play(eAudioPriorityHigh, eRepeat);


And later in the game I do this:

Code: ags
myatmo3 = aAtmos3.Play(eAudioPriorityNormal, eRepeat);


I would expect for aAtmos3 not to play at all, since the two slots for ambient sounds are already occupied and both have a higher priority. However, what I gather from the quote above is that AGS will simply look for another empty slot and play it there. Am I reading this correctly? Doesn't this defeat the purpose of limiting the amount of clips of a certain type that can be played simultaneously?


3) Creating an audio debug GUI

In order to help me sort out these issues, I'm trying to create a simple GUI that I can bring up with a key (say, F2) which will display which clip, if any, is playing in each of AGS' audio buses. So I would simply have 8 labels saying "Channel 0", "Channel 1", etc, and next to each, a label that would be populated with either the name of the clip (aAtmo1, aMusicTrack, aClock, etc) or "Nothing" if there's nothing playing.

But I'm totally lost, as I have no idea how I would get the audio clip that's playing on each channel and then display its name in the label. I tried this (in my global script's repeatedly_execute_always)

Code: ags
if (gAudioDebugUI.Visible) {
  for (int i = 0; i < 8; i++) {
      if (System.AudioChannels[i].PlayingClip == null) gAudioDebugUI.Controls[i+8].Text = "Nothing";
      else gAudioDebugUI.Controls[i+8].Text = System.AudioChannels[i].PlayingClip;  // (using "i+8" because the relevant label indexes go from 8 to 15)
  }
}


...but I'm getting a "GlobalScript.asc(249): Error (line 249): must have an instance of the struct to access a non-static member" error. What am I doing wrong?

Thanks in advance for any tips you can give me!


EDIT: I found this post by Snarky in which he does something similar, and apparently it's not possible to get the name of an audio clip? If that's the case then... I guess what I want to do is simply not possible? (I have several dozen audio clips in my game, I'm not going to index them one by one like Snarky does in this example.)
SMF spam blocked by CleanTalk