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 - Gal Shemesh

#61
Thanks @Nahuel! That will work. Though this route will require me to make this bool for all frames I want to play audio in when calling to reset the bool, making the code too cumbersome.

Any idea of a way to check whether a specific sound file is actually playing, and to combine this with the frame check to make it play only once, just like checking if the bool is false?
#62
Hi everyone,

I'm working on a game with digitized actors (a lot of frames) and willing to play certain audio clips such as gun shots and other effects on specific frames.

I'm aware that I can use the view editor for adding sound at the exact frames that I want, but the process becomes very exhausting when dealing with loops that have dozen or hundreds of frames in them, as seeking for each frame in the view editor is way too slow, and also requires me to leave the script I'm working on and to go back to editing the view and slowly look for the frame I set a sound on for tweaking or changing it.

Therefore, I'm willing to call for the audio files to play from within my scripts, where I could easily tweak them as I want in a much faster way.

I've set my view animation cutscene to run at the delay of 3, and then under the room_repExec() function I put a check for the frames that I wish to play audio files on, like this:
Code: ags

function room_RepExec()
{
  if (oEgyptRun1.Frame == 126)
  {
    aGUNSHOT1.Play(eAudioPriorityNormal, eOnce); // first gun shot
  }
  else if (oEgyptRun1.Frame == 149)
  {
    aGUNSHOT2.Play(eAudioPriorityNormal, eOnce); // second gun shot
  }
}

The problem is, the audio clips play multiple times instead of only once, which I trust is due to as long as the frame I'm checking is showing on the screen (based on the delay that it runs in).

Is there a way to make it play the audio clip only once?

Thanks
#63
Hi everyone,

Didn't found that anyone has reported about this so I want to bring this up.

When working in the Views editor, selecting a frame box in a given loop changes the selected frame in the Properties panel, which is great. However, it does not change to that frame in the Preview which is essential for seeing what frame you're working on when you're dealing with high res graphics with small details.

This makes the process of seeking for a specific frame for adding audio very difficult, especially when the view loop has a lot of (not very small) frames in it, which already takes about a second for changing from one frame to another.

Is there a way to make the selected frame to sync in the preview panel, and to also make it work vise versa when manually changing frames and loops with the small arrow buttons in the preview panel, so the current frame that shows in it will be selected in both the row of frames of the loop and in the dropdown list of frames in the properties panel?

I'm aware that this might make the entire View editor to perform even slower then it already is when working in high res graphics and a huge amount of frames, but perhaps we can have an option to turn such sync feature on and off? Or instead to just have an input box for writing the frame number that shows in the preview to select it, or to have another button in the preview panel for selecting that frame. I think that an input box or a button will be the more effecient way in terms of performance.

Thanks
#65
Hi everyone, hope you're all doing well. :)

Trying to do something that should be really simple:
1. Play an audio file of some loud wind.
2. After about 2 seconds, to make the wind sound decrease its volume gradually from 100% to about 50%.
3. Play a speech file.

I tried doing it manually but then read that the Tween module can be used for this. However, when I import it to my project, the moment I test my game (without writing any code related to the module yet), it gives me this error message and takes me the module script:
 
Tween1.asc(1275): Error (line 1275): Undefined token 'inventory'

The code in line 1275 is: inventory[this.RefID].SetProperty(this.StringRef, _value);

If I remove the module and test my game it runs successfully. It's only when the module script is present in the top of the Scripts tree that it gives this error.

Any help would be appreciate. And if there's another recommended way to achiving what I'm after I'm open to hear and learn.


Thanks!
#66
Thanks so much @Crimson Wizard. You help me a lot and no doubt to many others. Sorry if my queries required you to repeat yourself. I'll try to take it from here to see how I can tune it to meet my needs. Many thanks again. :)
#67
Quote from: Crimson Wizard on Mon 07/08/2023 15:51:16If your meaning is to play a sequence of actions in parallel to your fade effect, then you would have to implement  a cutscene/sequence state check in repeatedly_execute_always. This may go two ways:
1) play fade effect in a loop with Wait(1) inside, while running & checking for other actions in rep-exec-always
2) script fade effect in rep-exec-always without Wait, advancing its transparency step-by-step with every rep-exec call. This will allow to trigger it, and then play any sequence of blocking actions, while the Fade effect is running in "background".
Option 2 looks interesting. I tried to take my custom fade function from the GlobalScript header and to put it inside the rep-exec-always in the GlobalScript to calling it from there, but it tells me that nested functions aren't supported. I guess I misunderstood something...
#68
Thanks @RootBound & @Crimson Wizard!

I followed the suggestion here and made a black GUI for my custom fades.

I will sure check the scenario with the rep-exec-always. I never tried this and it sounds interesting.

Regarding the Tween module, I tried using it but got errors... My feault probably. Will need to re-read the instructions and to perhaps try it on a clean project rather than on my current one which has too many things in it already.

As for the on_event - thanks a million! What a great feature - just removed all the manual NewFadeIn() and NewFadeOut() calls that I made and put them one in a 'eEventEnterRoomAfterFadein' and the other in 'eEventLeaveRoom'. That works fantastic and will save me a lot of work. :)
#69
Following the custom 'FadeIn' and 'FadeOut' route I went with - is there any way to make it run in a non-blocking behavior? I mean, when changing the transparancy in a 'while' loop we must use 'Wait(1)' for the least, so I guess this is what makes function a blocking one. Yet, I'm willing to play the custom fade while animations are running simultaneously.

I tried putting the .Animate function before the custom fade with eNoBlock, but I'm not sure if it's the right way to doing it, and besides I do wish to have the animations that plays during the fade to be with eBlock, like when a walk-in animation of the player is playing when he enters the room.

Another thing I'm trying to figure out is if I could make my custom FadeIn and FadeOut to play automatically upon changing rooms and entering rooms, so I won't need to copy and paste the code for every room.

Thanks

#70
Hi everyone,

Just encountered this when trying to import an animated GIF of 514 frames - working on a game with plenty of sprites (digitized actors footages). During the import, it gave me this message which suggested to post it on the technical forum. No idea what it means apart from that it has to do something with memory - just want to mention though that I have 64GB of RAM and most of it available.

I also wish to mention that after closing and re-launching AGS and importing the same GIF file again, the process finished without any problem.

Thanks

Code: ags
Error: memory allocation failed `' [member=0][/member] error/quantize.c/QuantizeImage/2713
Version: AGS 3.6.0.50

ImageMagick.MagickResourceLimitErrorException: memory allocation failed `' [member=0][/member] error/quantize.c/QuantizeImage/2713
   at ImageMagick.MagickExceptionHelper.Check(IntPtr exception)
   at ImageMagick.MagickImage.NativeMagickImage.WriteStream(MagickSettings settings, ReadWriteStreamDelegate writer, SeekStreamDelegate seeker, TellStreamDelegate teller, ReadWriteStreamDelegate reader)
   at ImageMagick.MagickImage.Write(Stream stream)
   at ImageMagick.MagickImage.ToBitmap(ImageFormat imageFormat)
   at AGS.Editor.Utils.SpriteTools.<LoadSpritesFromFile>d__0.MoveNext()
   at AGS.Editor.Utils.SpriteTools.ImportNewSprites(SpriteFolder folder, String filename, Boolean alpha, Boolean remapColours, Boolean useRoomBackground, SpriteImportTransparency transparency, SpriteSheet spritesheet)
   at AGS.Editor.SpriteImportWindow.DoImport()
   at AGS.Editor.SpriteImportWindow.btnImport_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
#71
Quote from: Snarky on Sat 05/08/2023 20:33:50What happens if you set it to 65536?

(Personally I usually just import a fullscreen black sprite.)
Me too. But just tried 65536, took a screenshot of it and went to check the color with the eye-dropper tool in Photoshop and what do you know - PURE BLACK! RGB values are 0,0,0. :-D Thanks!

When I set it to 65536 then in AGS, the RGB are shown as 0,0,0 and the Hue, Sat and Lum values are 160,0,0. But if I set the RGB and the Hue, Sat and Lum values manually then the transparent index takes over. So I guess using the actual color number is the better way of setting up colors in AGS. I wonder what's the equivalent for pure white of 255,255,255 then, as in AGS white gets 248,252,248.
#72
Hah hah, "Because it's AGS" :-D I like this comment.

Thanks @Crimson Wizard. Then I'll just use a pure black graphic that covers the whole screen. It's nice that this method of 'fade' using a GUI keeps showing the mouse cursor with the Wait cursor like @Cassiebsg has mentioned, so I disregarded the fake 'Wait' cursor GUI I made altogether. :)
#73
Quote from: Cassiebsg on Sat 05/08/2023 19:22:45Forget about the built in fade in and fade out. Write your own, using a GUI, it's easy and it'll solve all your problems. That means you set in the setting the effect to instant, and instead you just turn on the GUI, fade (change transparency from 0% to 100%) the GUI to black, change room instantly, and then fade to normal to the new room. This will keep your cursor behaving normally.

And then instead of using FadeIn() and FadeOut(), you just use MyFadeIn() and MyFadeOut(). (and you can just use a find & replace in script. ;)

And of course, you need to set the wait cursor to the same sprite you normally use (or a special one you might want).
Yep, that would probably be the best way to doing it. Though, the pure black is considered as transparent... Any way to make my GUI color a solid black instead of using a background image?
#74
Appearantly I mixed between the methods. Thanks @Crimson Wizard for the clarification. :)
#75
Quote from: Crimson Wizard on Sat 05/08/2023 15:50:33Are you using FadeOut/FadeIn functions for translation, or a GUI?
Just the built-in transitions, either the default behavior of FadeInAndOut or manually calling for them with the FadeIn() and FadeOut() functions.
#76
Quote from: Snarky on Sat 05/08/2023 14:46:44If your pseudocursor is on a GUI and your custom fade relies on a fullscreen black GUI, then it's just a matter of setting up the GUI z-order to decide whether the "cursor" is in front of or behind the black screen.
Thanks for the suggestion. However, not matter what high number I put in the ZOrder, the cursor remains below the transition...
#77
Thanks @Khris! Just checked that up. It's great! I'm new to modules, but I can see that it can also be modified within AGS which is awesome. :) I modified it to show a text string astertix based on Font0.

Is there a way to make it to also show a symbol and label for characters?
#78
It's so great to have good and talented members that make such modules!

Yet, I think that a dedicated adventure game engine like AGS should have such option built-in, even just by using a GUI label with an 'asterix' that would blink for a second at the center of each and every hotspot, object and character in the room, while pausing the game when it does. Like in Simon the Sorcerer 2:


I tried making a GUI for this purpose, with labels to cover all 49 hotspot slots, and just about enough to cover all objects and characters in a given room, and to position them while they're hidden when entering a given room before FadeIn, based on the existence of the elements they're related to.

The logic as far as I understand should first count the number of elements when entering a given room; that is the number of characters, hotspots and objects, and save them in a temporary variable for each element. Then, a for loop comparison should be built to cycle through each of the elements in the room and compare them with the labels name within the GUI. If there's a match, it should position the label at the center of its corresponding element.

I thought about using IDs for both elements and labels for the comparison, but this won't be consistent when using a single GUI with labels for all the 3 elements (Characters, Hotspots and Objects), as ID numbers are unique, and can't have the same ID number for different labels. So I thought about using the 'Name' property of the labels with a certain syntax name, following with number. And then it should be sliced to grab only the number in it, and then to convert it into an 'int' for the comparison to work.

An example of what I mean is something like this:

lblCharacter0 == 0: cCharacter --> this is character index 0
lblHotspot1 == 1: hHotspotID1 (starting from 1 since 0 is the Eraser) --> this is hotspot index ID 1
lblObject0 == 0: oObjectID0 --> this is object index ID 0

Then, when the 'hint' key is triggered, the hint GUI will show up, revealing all the labels that has an existence element in the room, make them blink for a second, and then set them to be hidden again and close the GUI; only labels that have their corresponding element existence in a given room will be triggered. All the rest should remain hidden and ignored.

I'm not an expect yet to make such logic in script - only have it in my head. Maybe someone else could take this idea and put it into an actual script logic. :)
#79
Thanks @Cassiebsg. :) That's another thing I tried solving which remained opened. I just can't find a way to make the fake 'Wait' cursor (the GUI I made) to keep showing on-top of the fade when it plays - in other words, to exclude it from the fade transitions; the transitions affect it even if I set the default fade to Instant and use the FadeIn() / FadeOut() functions...
#80
Quote from: Crimson Wizard on Fri 04/08/2023 19:01:56Gal Shemesh, please tell which version of AGS are you using exactly?
AGS Editor .NET (Build 3.6.0.50)
v3.6.0, July 2023
SMF spam blocked by CleanTalk