Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.


Messages - Snarky

Pages: [1] 2 3 ... 231
1
(One limitation of this approach is that simple IndexOf() will find matches inside words. So "scratch" will match to "rat," for example, and "stiffly" to "fly". There are ways to fix that, but more robust parsing is quite difficult in general.)

2
Please can someone suggest best way to check if the string contains one of many words, and return the position?

I can use IndexOf to check if a user input string contains specific words, but it's quite cumbersome to set up multiple IndexOf and If's for each word I want to recognise.

I'm thinking if I could somehow have a numbered list of words, I could have a loop to check through until a match is found.

Yes, do that:

Code: Adventure Game Studio
  1. #define MAX_NOUNS 50
  2. int nounCount=0;
  3. String noun[MAX_NOUNS];
  4.  
  5. // Add a noun to the dictionary. Return false if dictionary full.
  6. bool addNoun(String newNoun)
  7. {
  8.   if(nounCount<MAX_NOUNS)
  9.   {
  10.     noun[nounCount++] = newNoun;
  11.     return true;
  12.   }
  13.   else
  14.     return false;
  15. }
  16.  
  17. int foundNounId=-1;
  18. // Returns the index of the first noun in the string. Also sets foundNounId to identify that noun
  19. int findNoun(String s)
  20. {
  21.   int n=s.Length;
  22.   foundNounId=-1;
  23.   int i=0;
  24.   while(i<nounCount)
  25.   {
  26.     int nounIndex = s.IndexOf(noun[i]);
  27.     if(noundIndex>=0 && nounIndex < n)
  28.     {
  29.       n = nounIndex;
  30.       foundNounId = i;
  31.     }
  32.     i++;
  33.   }
  34.   if(foundNounId == -1)
  35.     return -1;
  36.   else
  37.     return n;
  38. }
  39.  
  40. // Gets the noun that was found with the last call to findNoun()
  41. String getLastFoundNoun()
  42. {
  43.   if(foundNounId == -1)
  44.     return null;
  45.   else
  46.     return noun[foundNounId];
  47. }

And similarly for the other word classes.

3
The Rumpus Room / Re: *Guess the Movie Title*
« on: Yesterday at 16:29 »
Have a cigar, babe!


4
The Rumpus Room / Re: *Guess the Movie Title*
« on: Yesterday at 15:40 »
Much closer, but still no.

This might be a giveaway:


5
The Rumpus Room / Re: *Guess the Movie Title*
« on: Yesterday at 14:56 »
This film considerably pre-dates film noir. Also, don't Google Image "naked street" with Safe Search turned off.

6
The Rumpus Room / Re: *Guess the Movie Title*
« on: Yesterday at 14:38 »
No. You're entirely on the wrong track.

7
The Rumpus Room / Re: *Guess the Movie Title*
« on: Yesterday at 09:21 »
No guesses? OK...


8
I thought of some further testing to do, and as far as I can tell, it's actually a problem not with running out of channels as such, but with stopping/preempting channels playing certain clips. In this case, it seems like all copies of the clip aLostCraftHowl (which is a WAV file) will usually stop playing if you stop or preempt any channel that is playing the clip (even if you preempt it with itself).

I still haven't figured out the conditions under which it doesn't break.

9
With this debug code, I was able to spot what I think must be a bug in the AGS sound system: If you try to play a clip when you've run out of AudioChannels for that AudioType, so that it has to preempt a currently playing clip, it actually stops all copies of that clip (at least sometimes). This explains some weird behavior that a number of people have noticed but not been able to fully describe in the past (including bugs with the applause system in the AGS Awards Ceremony, and possibly the problems Monsieur OUXX was having that started this whole thing in the first place).

I'm using the two-click game template default game, and I've added this code in Room 1:

Code: Adventure Game Studio
  1. #define MAXCHANNELS_SOUND 5    // This matches the Sound AudioType setup
  2. int soundTracks=0;
  3.  
  4. function hTeeVee_Interact()
  5. {
  6.    soundTracks++;
  7.    if(soundTracks%2==0)
  8.       aBirthday.Play(eAudioPriorityHigh, eRepeat);    // AudioType Sound
  9.    else
  10.       aLostCraftHowl.Play(eAudioPriorityHigh, eRepeat); // AudioType Sound
  11. }
  12.  
  13. function hTeeVee_Look()
  14. {
  15.    aLostCraftHowl.Stop();
  16.    aBirthday.Stop();
  17.    soundTracks=0;
  18. }

So each time I click on the TV, it starts playing another copy of one of the sound clips. The first five times, it correctly alternates between the two clips. But then on the sixth time (i.e. once we've run out of channels), things break. Usually, it will stop all the channels playing aLostCraftHowl (so you end up with three channels playing aBirthday and two playing nothing). Sometimes it will do the right thing (stop only one of the channels), in particular after the first time: if you keep playing more clips, it won't (ever?) happen again even once you run out of the channels that were freed up by the clips that stopped playing, but if you stop all the clips and start over, it does recur.

I've tested a few variations. Most notably, the behavior differs if you switch the audio clips around, which indicates it has something to do with the clip itself. As far as I can tell, it has to do with the clip being preempted (not the one you're trying to play): in this case, preempting the clip aLostCraftHowl tends to stop all copies of the clip, while preempting aBirthday is (usually?) OK.

It doesn't matter whether the channel limit is set explicitly by MaxChannels or implicitly by how many are left over from other audio types. It doesn't matter if the clips are playing on eRepeat or eOnce.

10
I this is true for custom types? I think there are 3 built-in types that reserve channels  unconditionally, which is done for backwards-compatibility (functions like PlayMusic).

It's not true at all, I was wrong.

I was inferring the reservation of an AudioChannel per AudioType from the fact that when setting MaxChannels to 6+0+0, one of the "unlimited" types was only able to use one AudioChannel. However, upon further testing it seems like there are actually only 7 AudioChannels available for use by the AudioTypes, since one is always reserved for speech, so my logic was off. (If there is a way to free up this channel, I couldn't find it. It's off-limits even if you set Speech.VoiceMode=eSpeechTextOnly)

In fact, AudioTypes for which MaxChannels is set to 0 do not reserve any AudioChannels, at least not under any circumstances I could find.

Here's a snippet of code to examine the audio channel status (it uses a debug GUI with a label lblStatus), which goes in repeatedly_execute_always():

Code: Adventure Game Studio
  1. // Displays the status of the audio channels in format '[Channel#]: [AudioType] - [ClipName/SpeakingCharacter]'
  2.    String status="";
  3.    int i=0;
  4.    while(i<System.AudioChannelCount)
  5.    {
  6.       String clipType="NONE";
  7.       String clipName="";
  8.       AudioChannel* channel = System.AudioChannels[i];
  9.       if(channel != null && channel.IsPlaying)
  10.       {
  11.          AudioClip* clip = channel.PlayingClip;
  12.          if(clip == null) // If the channel is playing but the clip is null, it means it's playing speech
  13.          {
  14.             clipType="Speech";
  15.             // Figure out which character is speaking
  16.             int j=0;
  17.             while(j<Game.CharacterCount)
  18.             {
  19.                if(character[j].Speaking)
  20.                   clipName=character[j].Name;
  21.                j++;
  22.             }
  23.          }
  24.          else
  25.          {
  26.             if(clip.Type == eAudioTypeAmbientSound)
  27.                clipType="Ambient";
  28.             else if(clip.Type == eAudioTypeSound)
  29.                clipType="Sound";
  30.             else if(clip.Type == eAudioTypeMusic)
  31.                clipType="Music";
  32.             else if(clip.Type == eAudioTypeCustom)  // This is a custom audio type I created for testing
  33.                clipType="Custom";
  34.             else clipType = "Unknown";
  35.            
  36.             // There's no way to get the name of a clip, so if we need to identify it specifically, we have to special-case the check
  37.             if(clip==aLostCraftHowl) clipName="Aircraft";
  38.             else if(clip==aElectricNoise) clipName="Electric";
  39.             else if(clip==aRadioNoise) clipName="Radio";
  40.             else if(clip==aTone_01) clipName="Music1";
  41.             else if(clip==aTone_02) clipName="Music2";
  42.             else clipName="Unknown";
  43.          }
  44.       }
  45.       String line = String.Format("%d: %s - %s[",channel.ID, clipType, clipName);
  46.       status = status.Append(line);
  47.       i++;
  48.    }
  49.    lblStatus.Text=status;

11
The system makes sense on its own terms, but could be explained a lot better in the manual.

As far as I'm concerned, the big gotcha is that even if you set its MaxChannels to 0, each AudioType still reserves 1 channel for its exclusive use. (Edit: Wrong)

12
Beginners' Technical Questions / Re: Use Character
« on: 29 Nov 2016, 20:02 »
You really need to read the manual.

If you can't see the main character, check:

-that you have assigned proper, visible sprites for the character NormalView
-that the character is placed on coordinates that are within the visible region of the screen
-that the room has ShowPlayerCharacter set to true
-that there isn't a walkbehind or object covering up the character
-that player.Transparency is < 100 (should usually be 0)

13
Beginners' Technical Questions / Re: Lip-sync question
« on: 29 Nov 2016, 18:17 »
It's not a very often-used feature, but I think it should work better than what you describe. It's hard to say without seeing either how you have it set up or how it looks whether it's working correctly.

One way to test it would be with some specially designed lines. Like, if you have eight different lip sync frames, try a line that is something like "aaabbbeeefff wwwuuudddooolll" (or whatever your different lip positions are) and just count them. If it's still too fast, you can turn down the game speed.

14
Well, there's a comic adaptation of Fate of Atlantis, a TV show based on Maniac Mansion, and Ron Gilbert wrote up one of the design documents for Monkey Island as a short story...

15
I am not so sure about them reserving channels, I kept thinking this is the number of most used per type at any given moment. This might need clarification.

That would be better, but it's not how the system works (at least as of 3.3.3).

-Every AudioType reserves at least 1 channel (even if MaxChannels is set to 0) (Wrong)
-If MaxChannels is set to some other number, the AudioType reserves that many channels

Method of testing:

With default game, three audio types (Ambient, Music, Sound). The game tries to play first one music track, and then another at the same time, without using Ambient or Sound at all.

1. Set MaxChannels to 0 for Music and Sound, 1 for Ambient. Result: Both music tracks play, as expected.
2. Set MaxChannels to 0 for Music and Sound, 7 for Ambient. Result: No music, because the setup tries to assign 9 channels, which doesn't work. (actually because 7 for ambient + 1 for speech leaves none for any other type of audio)
3. Set MaxChannels to 0 for Music and Sound, 6 for Ambient. Result: The first music track plays. On trying to play the second, the first one stops.

The third test demonstrates that having assigned 6 channels to Ambient (and implicitly 1 for Sound one reserved for speech), there is only one audio channel left to play music.

16
So does that mean that the AudioType that has MaxChannels=2 reserves the channels?

Yes.

17
General Discussion / Re: Alternative Knowledge
« on: 29 Nov 2016, 11:50 »
Post deleted and thread locked in response to member complaint, and because the AGS Forums will not be used for harassment against individuals or to spread allegations based on flimsy circumstantial inferences. Posting pictures of children implying that they're the victims of sexual abuse based on nothing but speculation particularly crosses the line.

18
General Discussion / Re: Alternative Knowledge
« on: 29 Nov 2016, 10:18 »
Having wasted a little bit of time looking at the Pizzagate "evidence" (with damning proof such as "someone once used the word 'afterparty'", "there's art by an artist who has done other work that would be inappropriate to display", and "a friend of theirs went to Burning Man" – which they seem to think is some kind of witches' sabbath... yes, this is a literal witch hunt), it occurs to me that it would be pretty easy to put together a similar dossier of circumstantial evidence that AGS is a pedophile ring, starting with the highly suspicious americangirlscouts.org URL (what is this, a group that scouts for little American girls?) and "Mittens" (which represent childhood, and visually resemble, if arranged a certain way, the butterfly in one of the umpteen secret pedophile signs). I'm sure if you go looking you'd find that some forum members have some kind of connection with some sex offenders, so that's guilt by association right there. Add in some off-color jokes and bits taken out of context from various games, old forum posts and IRC, and voilà! Who will dare expose this powerful conspiracy?

19
The Rumpus Room / Re: *Guess the Movie Title*
« on: 28 Nov 2016, 22:09 »
I've only seen the Alec Guinness Ealings, but KH&C is probably my favorite, or maybe tied with The Ladykillers.

While we're on black and white movies:


20
Good choice and good luck!

Pages: [1] 2 3 ... 231