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 - Crimson Wizard

#2841
I've read this several times, but still not quite certain, if you want to access struct's member inside a function, or pass struct's value into a function as parameter?

Because if latter, it's done as:
Code: ags

function melee_combat(int dmg_value) { // here the function receives a damage value from any source
     ....
     citizens[2].hp -= dmg_value;
     cEnemy.SayBackground(String.Format("-%d", dmg_value));
     ....
}

and then called like:
Code: ags

melee_combat( citizens[0].melee_dmg ); // here you pass a value of citizens[0].melee_dmg into the function



EDIT: What puzzles me in this question is the purpose of this function. As the function is called "melee_combat", it seems like there's no need to know the damage type, as it is defined by the function itself.
#2842
As an experiment, I am making a new version of this plugin, that will work with both Direct3D and OpenGL. The latter theoretically allows to use the plugin on other platforms.
Just mentioning it here for the reference; perhaps should be posted in its own thread later.

dll: https://www.dropbox.com/s/w5b31vm0iow7psa/ags_sprite3d.zip?dl=0
64-bit linux so: https://www.dropbox.com/s/mrp3kv5do8mqhxr/libags_sprite3d.zip?dl=0
source: https://www.dropbox.com/s/bp6k5nwg4izvgzz/ags_sprite3d_source.zip?dl=0
The plugin file is called differently (ags_sprite3d), but it's 100% script compatible, which means that you may:
- rename it to ags_d3d.dll and use in same game.
- disable ags_d3d and enable ags_sprite3d in your project and recompile, for the similar result.
No script changes will be necessary.
WARNING: currently not working: theora video playback, creating textures directly from files.

UPDATE: support building for Linux (OpenGL only).
UPDATE: reintegrated video playback.
UPDATE: created a thread for the new plugin: https://www.adventuregamestudio.co.uk/forums/index.php?topic=60089.0
#2843
Quote from: Baguettator on Mon 04/07/2022 17:24:37
1 tone down is about the "pitch" of the music. I could send you my project so that you can test and see.

Yes, please.

Quote from: Baguettator on Mon 04/07/2022 17:24:37
Any update of AGS 3.6 with the fix for ListBox.RowCount bug ?

It has been fixed, if you like you may download the latest build here:
https://cirrus-ci.com/task/5111025316921344
#2844
Please tell, which operating system you are running on? This was a known issue in the earlier versions of AGS, but I cannot reproduce this with AGS 3.5.1 nor 3.5.0 anymore, thus I was under impression that this was fixed.

Do you have this problem with 3.6.0 Beta?
#2845
Updated build with a stricter script API syntax, fixes this plugin for the new compiler from ags4 branch, but should work normally in AGS 3.5 and 3.6 as well; no functional changes.
https://www.dropbox.com/s/fogrd0v3xry0vso/ags_d3d_for399.zip?dl=0
Source project:
https://www.dropbox.com/s/nahgib8xay692p5/ags_d3d_for399_source.zip?dl=0



Quote from: Tarnos12 on Sun 03/04/2022 17:40:05
Hey, anyone using this plugin figured out how to fix an issue with full screen alt-tabbing?

There have been few fixes to Direct3D fullscreen in the engine since, please try again with the latest 3.6.0 / ags4 branch.
#2846
Quote from: Baguettator on Sun 03/07/2022 18:50:28
Is it planned to change it ? Or there is a reason for that kind of "maths" to exist ? (I believe yes, because why to do difficult when you can do easy).

I have no idea why it was made like that, it could be a random attempt to make it look in certain way.
No, there were no plans to change how gui look like, at least not in 3.6.0, because changing this now may break looks for someone else who already adjusted to this behavior; also rushing things may cause us missing something. Maybe this will be changed in the future versions, but this has to be well thought through, how the sliders should look, work, and which parameters to use. It's probably not the only thing that could've been adjusted too.

Quote from: Baguettator on Sun 03/07/2022 18:50:28
About my audio problems I told before, could you have a look if the PlayMp3File function works normally ? My code uses this function, I don't do anything excepting playing MP3 files normally, and I encounter "randomly" the bug while the files are played 1 tone under the original.

I cannot tell what does 1 tone down means... Could you give an example of mp3 file, or record how it sounds in some media player and inside a game for comparison?

Quote from: Baguettator on Sun 03/07/2022 18:50:28
Also, the Audio.Play function works like before ? Because in the 3.5 versions, I didn't write parameters (I did myaudio.Play()), and it played once normally. Now the same audio files are playing several times, and I didn't change the code ! As you worked on audio before (as I saw in this thread), maybe things have changed a bit ?

Nothing was supposed to change in script commands. But according to AudioClip.Play, if you dont pass any parameters, then the default values for this clip/audio type will be used. Please check what your clip properties and audio type properties say in the editor.
#2847
Quote from: Baguettator on Sat 02/07/2022 21:23:14
About the slider :

Arrow buttons, Handle : 50*50
Slider width:50
Slider Max value : 7
I tried these situations :

-slider height=200
-slider height=273
- slider height=259

I always place the arrow buttons so that at max and min values, the handle is placed just next to the buttons corners.

In each case, there were 4 pixels between the arrow button (up) and the handle when it's in the max value position.

That's just how AGS calculates the slider positions, it has strange math, it has been like that since ancient times.

There's a "handle range" value that tells in which range the handle can move. This range is calculated as "width - 4" for horizontal and "height - 4" for vertical sliders.
When calculating current position of the vertical slider the formula is "current_pos = (int)(((float)(MaxValue - Value) * (float)handle_range) / (float)(MaxValue - MinValue))".
In addition the handle position is always shifted 2 or 4 pixels to the right or down from the slider's left or top edge (depending on orientation). It's 2 extra pixels for low-resolution games and 4 pixels for high resolution games (640x400 and above).
The handle's graphic is then centered around this position.

For example, if vertical slider has height 200, min value of 0 and max of 7, then:
- handle range = 200 - 4 = 196

- the position at minimal value will be = ((7 - 0) * 196) / (7 - 0) = 196
but there's also +4 pixel offset for a high res game (I'll just assume your is high res, because you have large sliders), so it's = 200.
The sprite handle is then centered around slider's Y 200.

- the position at maximal value will be =((7 - 7) * 196) / (7 - 0) = 0
but there's also +4 pixel offset, so it's = 4.
The sprite handle is then centered around slider's Y 4. This is where the 4 pixels come from in your case.

#2848
Quote from: Amir on Sun 03/07/2022 09:33:04
I have a question. As far as I remember I tried android launcher back then and it worked fine, but in my new game there are a lot of "strings" fields where you have to type something. Will this also work with the android launcher? Will the keyboard appear on mobile phones, so that you type something?

There's a built in keyboard, which you may bring by holding "back" key and choosing "keyboard" from the menu. But that is meant mostly for games which were not specifically designed for touch screen. If that does not suit your game you could script your own on-screen keyboard.
#2849
Quote from: Amir on Sat 02/07/2022 19:04:46
Ok, now I'm sure the problem is with AGS. I created a new game. Esc works at the beginning. As soon as you press ctrl or alt, esc no longer works. You have to press any letter key to activate Esc  :(

Please tell, which version of AGS are you using? I recall there have been similar problem few years ago, but I thought it was fixed eventually.
#2850
I apologize for this necroposting, but I've been looking into fixing this lately, and in case someone finds this thread:

I'm fairly certain the root of the problem is that the editor must have room loaded into the memory to show its object names in autocomplete. If the room itself is not loaded in the editor, then there's simply no way for it to get these. So to have the object, hotspot, etc, names in auto complete would require opening the room itself in the editor.
#2851
Quote from: Baguettator on Fri 01/07/2022 21:59:07
The slider has the same width as the handle. My slider is vertical

Well, then, please tell what it's height. I need to know the slider's size, most importantly the size along which the handle is moving to reproduce this and investigate. Also Min and Max values, just in case.
Since you mentioned slider is vertical, this 4px offset, is it vertical or horizontal?
#2852
Quote from: Baguettator on Fri 01/07/2022 15:41:41
- the LisBox.RowCount value seems bugged.When I launch my game, I add items in my listbox (for example 7 items). The gui where my listbox is is not visible yet. If I display the rowcount value, it's 0 ! then I make the gui visible, and display again the value : 5 ! ( the right value !) is it a bug that the listboxes' row count value are not set up propely until they appear at screen ?

This appeared to be an old bug (reproduced as early as AGS 3.2.1), but will be fixed now.

Quote from: Baguettator on Fri 01/07/2022 15:41:41
About sliders, OK I understand, my question was if it was possible to get more options for the handle offsets, maybe it's not planned for now.

No, nothing else is planned for 3.6.0. Right now there's a HandleOffset property for sliders which creates a horizontal offset, it may be both positive and negative.
Changing anything there would require a good design plan on how control should behave. Frankly, I doubt this will be done in AGS 3.* versions, maybe within experimental "AGS 4" branch.

Quote from: Baguettator on Fri 01/07/2022 15:41:41
- If my handle is 50*50 pixels, when the slider value is minimal, the handle is perfectly 25 pixels out from the slider background. If the slider value is maximal, the handle is only at 21 pixels out from the slider background. There is always a 4 pixels "offset" when the value is maximal. Strange ?

Please tell what is the width of the slider itself?

Overall this is probably because of how handle position is calculated. From my memory, the slider's width is divided by value range, and that's how handle positions are set up.
For instance, if you have values 0-10, this means 11 positions. If your slider is 110 pixels wide, that would mean a position each 10 pixels, distributed along all the slider's width. If slider is 100 pixels wide, that would mean 9 pixels for position and so on. On top of that AGS may add some extra tweaks to create offsets/margins for a handle. This may result in slightly different offsets; the larger the graphics the larger this difference may be (in absolute pixel value).
#2853
Quote from: Baguettator on Thu 30/06/2022 17:33:11
Maybe I don't know how to make a good custom slider :) Well, I know it could be out of this thread because it looks like a technical question, but it's mainly a request - until someone tells me that there is an other already existing solution (sorry eri0o for always saying me that I'm out of this thread :( ).

At this point my advice is to script your own slider. For example, you could use buttons for slider elements, or raw drawing (DrawingSurface, DynamicSprite). That way you may design literally anything, and script any behavior. People were using raw drawing to create custom controls for years, there were modules made with custom text boxes, scrolling chats, and so on. But yes, this is a topic for Technical Questions section.

Quote from: Baguettator on Thu 30/06/2022 17:33:11
I also encountered problems with the last 3.6 version: I'm playing MP3 audioclips, using the old audio functions (PlayClip or something like that), and at one moment, I heard like a distorsion sound for about 5 seconds, then the music played, but 1 tone lower...!!!

As usual, we would need to know details. What precisely version of AGS, what clip, what was the script command, and so on. We won't be able to do anything without knowing detailed information.
#2854
Quote from: Baguettator on Tue 28/06/2022 19:06:20
I would like to "merge" the functions for 3 controls : the custom slider and the customs arrows I made for scrolling a list box. As there are many listboxes in my game, I would like to minimize the number of functions in global script. Merging would allow to do that in one single function, instead of 3 : 1 arrow for Scrolling up, 1 arrow for scrolling down, 1 slider for scrolling up or down. For me it's just an optimization for the script (less functions, less lines etc...).

Hm, no, it would be incorrect to change the event function only for that purpose. The solution here is to modify the editor and engine and allow to put event handlers in different scripts, not only global script.
Alternatively, there's a plan to let connecting functions to events in script: this way one would be able to create complex gui setups dynamically.

I guess at this moment you may still merge all arrow buttons in one event handler, and all list sliders in another event handler.
#2855
Quote from: Baguettator on Tue 28/06/2022 10:20:14
- Would it be possible to make "Slider_OnClick" functions to allow 2 parameters like "Buttons_OnClick" functions ? (so "Slider_OnClick(GUIControl *control, MouseButton *button"). If it's not a big problem, it will allow to simplify the code when we make our own sliders and arrows, gathering all of these controls into 1 function (and not 3).

Quote from: Baguettator on Tue 28/06/2022 18:10:36
Oh sorry, I wanted to write "Slider_OnChange". But I didn't realize that it's an "OnChange" function, and not a "OnClick". There would be no needs to make the "OnChange" function working with 2 parameters ? (control and mousebutton)

I think it would be best if you described your actual situation, like what are you trying to accomplish in your game. That would make it easier to think of a good solution.
#2856
Quote from: Pax Animo on Sat 25/06/2022 12:30:33
Oh this seems to work but not for all characters.

The code looks correct though. What happens instead? Are you absolutely sure you dont change Baselines somewhere else in script?
#2857
I don't think there's a direct command like that in the Editor, but there are 2 simple ways to do this:
1) Rooms are stored as "roomNNN.crm" files. Simply copy/paste your room as a new file with new number, and then import it using "Import existing room" in the editor.
2) You may create a room template by right clicking and choosing "create template from room". Then, when creating a new room, this room will be available in the template list.
#2858
On current situation.

The 3.6.0 seem to be stable enough to make games. There are few known regressions since 3.5.* related to move from Allegro4 to SDL2 backend library and new audio library, related primarily to sounds, but I think these are "edge cases" and won't affect everyone. Some of these might still be possible to fix within 3.6.0. Other bugs which were found and fixed recently were mostly oversights made during last feature additions.

From looking around and talking to users, I know that at least 3 people/teams are making commercial games with it:
- Wadjet Eye (Dave Gilbert, Dualnames, etc) are making their new game with 3.6.0: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59868.0
- Grundislav is making his new game "Rosewater" in 3.6.0 (I learnt this because he was reporting bugs).
- Stranga's "Ashina: The Red Witch" (at least the demo was made in 3.6.0): https://www.adventuregamestudio.co.uk/forums/index.php?topic=59052.0
Perhaps there are more.


@Baguettator, at this point we try to not add any new functionality to 3.6.0, unless it's absolutely required to cover some "gaps" in the already planned tasks, which we missed earlier. Fixing mistakes is the priority now.

Quote from: Baguettator on Tue 28/06/2022 10:20:14
- Would it be possible to make "Slider_OnClick" functions to allow 2 parameters like "Buttons_OnClick" functions ? (so "Slider_OnClick(GUIControl *control, MouseButton *button"). If it's not a big problem, it will allow to simplify the code when we make our own sliders and arrows, gathering all of these controls into 1 function (and not 3).

There's no Slider_OnClick right now, there's OnChange which is somewhat a different thing. I guess the point is to support "OnClick" event in all controls? I may open this as a feature suggestion for the future.

Quote from: Baguettator on Tue 28/06/2022 10:20:14
- Any way to add a parameter for list boxes that allow to "cut" the text of the items if they are too long (out of the listbox) ? And without "changing" the real text of these items (like the items are always the full text, but the listbox displays only what it fits into the box). Could be nice to allow a true/false option for this.

This is already implemented, and I think it was done following your own request some time ago. The option is called "GUI Controls clip their contents" in "General Settings" -> "Visual". It makes all the gui controls to visually cut their texts if they expand beyond their borders. This is actually a default behavior in all the game templates now.


Quote from: Baguettator on Tue 28/06/2022 10:20:14
- it seems that the "_" symbol doesn't allow to correctly find the "keyword" we are writing into the editor. For example, if I have to write into the editor my variable "is_bright", when I write "is_", it should appear in the list and select my variable (so then I just press enter and it's done). I mean for "autocompletion". Since 3.6, it doesn't understand the "_" symbol. Maybe other symbols do the same problem, I don't know.

- When I write "int p=player.Room", the word "Room" becomes in blue, because it's like the editor considers that we are talking about the struct "Room". Normally, it should stay in black, because it's not the struct, but the part of the "player" struct.

Looks like these are mistakes within autocomplete feature, I shall open a bug report for these in our tracker.
#2859
Updated to Beta 9
(use download links in the first post)

Engine:
- Fixed a script linking problem in games made with 3.6.0 alpha which used Button.Animate() with new parameters.
- Fixed MP3 sounds not reporting their length properly.
- Fixed sound clips not stopping by command if they had a crossfade enabled.
- Fixed scheduled sound fadeout effect was not cancelled by skipping a cutscene (a very old bug from early 3.*).
- Fixed false positive detection of a script hung in a do..while loop that could stop the game.

Android:
- Fixed AGS Player (universal launcher) crashing when launching any game (regression since 3.6.0.18).
- In AGS Player fixed Credits option not showing anything.
#2860
What about the "Modules, Plugins & Tools"? It already has a WFN fonts thread. We need to ask Gilbert or Dualnames if that's okay. Maybe even sticky it there.

On the other hand, why are these called "pixel fonts" if they are TTFs?
SMF spam blocked by CleanTalk