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

#681
Updated to Beta 5
(Please use download links in the first post)

Editor:
- Fixed a "unterminated string" error in Dialogs was not pointing to the actual error location.
- Fixed a possible "index out of range" exception that may occur while user types a function declaration (a regression in previous 3.6.2 Beta).

Script API:
- Changed eEventGUIMouseDown and eEventGUIMouseUp events to receive click position in GUI-relative coordinates.
- Renamed File.ReadBytes() and WriteBytes() to ReadRawBytes() and WriteRawBytes() respectively, in sake of consistency with other File functions.
- Added File.ReadFloat() and WriteFloat() that safeguards the written value with a tag.

Engine:
- Increased the cap of simultaneously loaded scripts to 1024 (this includes all regular script modules, a single active dialog script, and a single active room script).
- Character.FollowCharacter() can now have a distance parameter up to 32766 (was limited to 255).
- Ensure that the objects with identical z-order (baseline) always keep same relative sort order when being drawn (note: engine does not guarantee a predefined order, only a persistent one).
- Fixed inventory cursor's crosshair hotspot was drawn incorrectly if active item's sprite has a alpha channel.

Engine Plugin API:
- Added IAGSEngine.CreateDynamicArray(), which lets plugins to create dynamic arrays.
- Added IAGSEngine.GetDynamicArrayLength() and IAGSEngine.GetDynamicArraySize(), which tell the passed array object's number of elements, and total size in bytes respectively.
#682
I really wish to have any feedback on this:

Quote from: Crimson Wizard on Sun 24/11/2024 19:28:54I am in doubts about something again...

In the latest update I've expanded eEventGUIMouseDown and eEventGUIMouseUp events with following parameters:
- mouse button
- mouse x
- mouse y

the position is given in screen coordinates.

Would it be better to have them in respective GUI coordinates instead?

Because we are gradually approaching final 3.6.2 release, and this has to be resolved soon.



My own thinking of this is following:
the event is "mouse down/up on gui", and it refers to particular GUI, as one may notice from the parameter list, not "all or any guis".
Because it relates to particular GUI, it may be desired to know exact relative position of a click, as opposed to a case when have a "click on screen" for example.
Similarly to the case when the mouse changes position before "on_mouse_click" gets called (and that's why we need to pass click position as arguments),
a GUI may also change position before "on_event" is called. This may happen, for instance, if it's changed in gui's own OnClick event, or if there are multiple on_event functions in multiple scripts and one of them changes gui position. Not very likely in practice, but still theoretically possible.

These two considerations combined: that this event refers to a click on particular gui, and that gui position may change in between, - they make me think that it's better to pass relative gui coordinates for them.
#683
Variant 1. Try using "backup_acsprset.spr" file, that's a previous copy of your sprite file made by AGS. Remove current "acsprset.spr" and rename "backup_acsprset.spr" to "acsprset.spr". (Do this while AGS Editor is not launched, and don't save your game until you see that sprites were restored).

Variant 2. If you have sprite sources (original images) intact, then you can do File -> Restore all sprites from sources.
#684
Quote from: danmi on Sat 28/12/2024 18:35:30I got something to work using the last link you've given me, but now I am getting these weird transparency thing over my buttons. It is also happening on my portrait, which is made using a button. How could I fix this?

General Settings -> Visuals -> When player interface is disabled, GUI should -> Display normally
#685
I forgot to mention earlier; if you need not an instantly appearing text, but a typewriter effect, the script snippets may also be found around the forum if searching for "typewriter",
and also there are several modules that support this kind of effect, as well as maybe other effects for text:

Old Typewriter module, the simplest of them all, but has a limited functionality:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-typewriter-text-v1-2-customizable-typewriter-style-text/
TypedText module:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-typedtext-0-7-0/
Fancy module, supports typewriter effect as an option iirc:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-fancy-0-1-0/
#686
Hello. If you just search for "Visual Novel" on this forums, you will find a number threads on this topic.

When doing forum Search, expand "Choose a board in which to search or search all" and tick only "AGS Support" section - that will narrow the search.

Here are few more relevant of them (ranging from old to newer), but there may be more elsewhere:

https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/i-want-to-make-visual-novel-style-conversations/
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/dialog-like-visual-novels/
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/implementing-character-busts-during-dialogue/


Indeed, having a dedicated tutorial would be good, but I do not know if such exists.

Overall you need to learn these things:
1. Displaying characters can be done using either GUI or Overlays. GUI with Button on them may be the easiest if you want to have animations. If you don't need animations and only static pictures that can change sometimes, then Overlays would work too.
2. Display text can be done on a GUI with a label.
3. You will need to write custom speech functions that set label text and change portraits, and use them instead of standard Character.Say.
(again, there is a lot of discussions about that on forums, if you search for e.g. "custom speech")
#687
Quote from: Joacim Andersson on Fri 27/12/2024 10:47:31I spoke too early, it seems like nested structs are also not supported in v. 3.6.x. If AGS treats a struct as a type why can't I use that type in another struct?

The answer to this and other similar questions is simply that the original ags compiler is not complete, and cannot parse or handle certain constructs correctly.


EDIT:
But if you were speaking of managed structs, the situation is more complicated.
Having nested managed structs requires, besides compiler supporting this syntax:
a) runtime type information (reflection) in the engine, to let engine know which fields in struct are managed pointers, so that it could correctly dispose allocated objects when the parent struct is disposed.
b) full garbage collector to deal with managed object's cross-references of any complexity.

these were added only in ags4.
#688
AGS 4 does support both multidimensional and jagged arrays.
I suggest reading the list of changes for ags4, and a cheet sheet which explains new features in detail:
https://github.com/adventuregamestudio/ags/wiki/New-compiler's-end-user-cheat-sheet

The classic workaround for non-jagged multidimensional arrays is to have a linear array which stores all dimensions. For example 2D array emulation will be a 1D array that stores elements row by row, where element of (x,y) is located at (x + y * row_width).
#689
@yarooze there was a bug in AddWaypoint, here's a temp build with a fix:
https://cirrus-ci.com/task/5025614987526144
#690
Quote from: yarooze on Thu 26/12/2024 22:30:35and sometimes the game crashes then

Please tell is there any error message when it crashes?
#691
Please post technical questions in the Android port thread:
https://www.adventuregamestudio.co.uk/forums/engine-development/ags-engine-android-port/

EDIT: may any mod merge this post there?
#692
Quote from: eri0o on Thu 26/12/2024 12:01:59If you use the data tag it will be inside the game package so there is not anything to do differently in any platform. It will work the same. The data tag is read only as it's inside the game package and it can't be modified by the game itself.

I must clarify: $DATA$ tag reads all game assets from all registered asset paths:
- game dir (it may be a virtual directory depending on platform and installation method, e.g. APK on Android);
- game.ags;
- audio.vox;
- speech.vox;
- alternate audio and speech folders (when running from the Editor).
#693
There are 2 script modules which work with text-based file formats:

INI file module:
(i used this one)
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-inifile2-1-0-0-ags-3-x-read-and-write-configuration-to-files/
Among other things, this module can be used to read or write AGS own config file, since it's written in INI format.

JSON module:
(never tried this myself)
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-jsonparser-0-1-0/



$DATA$ tag should work anywhere, since it reads from installation package. The engine hides implementation details. $DATA$ tag supports subdirectories (actually, all tags do).

With Android, normally you should package all your game files into APK.
With Web, I guess that you place files together with the other game files.

Besides that, you can package custom files inside the game.ags. To do this use "Package custom data folder(s)" option in General Settings (see explanation here: https://adventuregamestudio.github.io/ags-manual/GeneralSettings.html#compiler)
#694
Quote from: Joacim Andersson on Tue 24/12/2024 08:02:33I understand that downcasting would require an explicit cast (unlike upcasting which can be done implicitly), but I still think it should be available.

This is not only a matter of supporting "explicit cast" syntax, it a matter of engine being able to distinguish types.
Because the downcast cannot be resolved at compile time, as compiler does not know which type exactly is pointed to by the base class pointer. so it must be resolved at runtime. And in order to do that engine has to know the type hierarchy, and know which type the pointer is.

Couple of years ago I had to implement RTTI (runtime type information) in the AGS engine from scratch, because it was not available originally.
Since then a number of new functionalities was based on rtti. Among other things, now it is theoretically possible to add a "dynamic pointer cast" operation. But it still has to be written by someone.
#695
So, I opened a try-out PR for the change that I described in my previous post.
https://github.com/adventuregamestudio/ags/pull/2632

I'd really like to hear someones opinion on this.

BTW, maybe there's something wrong with the way how I look at this, because now I began to wonder why did I make this flags in script API at all, and not just a set of boolean properties...
There's not too much of them.

EDIT:
Opened an alternate PR, which replaces a Result flag set with 3 distinct properties (and removes enum with flags):
https://github.com/adventuregamestudio/ags/pull/2633
#696
Quote from: Joacim Andersson on Tue 24/12/2024 08:02:33There are other quirks of the language I find strange, for example, why can't I do the following:
Code: ags
String s1 = "THis iS A stRIng";
String s2 = s1.Substring(0, 9).LowerCase();
Since the Substring method returns a String why can't I call the LowerCase() method directly on that?

That is not a quirk of a language per se, but rather a limitation of an old script compiler that could not handle parsing composite expressions well.
This problem has been dealt with in AGS 4 where a new compiler can do that.

The old compiler is written in a old and dirty code, thus it's difficult to change. That's why I try not to meddle with it much and only fix the mistakes that are easy to fix.
#697
Quote from: Joacim Andersson on Mon 23/12/2024 18:37:30But of course, I didn't know that I should search for AsButton, I just assumed that I could cast it this way.
Code: ags
Button* btn = (Button) someGuiControl;

Unfortunately, pointer downcasts (from base type to child type) are not supported by AGS at the moment.
This is one of the feature requests, which in theory could be implemented in AGS 4, where we have done the basic data reflection.

Upcast (from child to base) is supported though (fwiw).
#698
Quote from: Joacim Andersson on Mon 23/12/2024 18:10:50However, I didn't get a result in the index for AsButton.

Yes, this is the problem with the Index in the latest versions of the manual, it only lists full article names, i.e. it mentions "GUIControl.AsType" but not "AsType" nor "AsButton".

"Search" tab should find "AsButton" afaik.
#699
Quote from: Joacim Andersson on Mon 23/12/2024 16:10:30Thanks for the AsButton property, which is not documented in the help file that comes with AGS. That documentation is somewhat limited.

What do you mean? This property has been documented in the manual for many years, and help file that comes with the editor is near exact match with the online one (may be bit older depending on the version that you have installed).

EDIT: It's labelled "GUIControl.AsType", maybe that is the problem.
It's in the list of GUIControl's properties, at the top of its page though.
#700
Here's a Drag and Drop module that I wrote:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-dragdrop-1-1-0-helps-to-drag-things-around-your-ags-game!/

May be used as-is, or as a hint to how code this.

The quick summary for writing your own code:
- keep track of the mouse state in rep-exec or rep-exec-always; remember last position and button state each time, compare with new ones;
- if mouse button gets down, find if any control is under: if there's then remember it being "dragged" in a variable (GUIControl* pointer variable);
- if mouse changes position and control is dragged, then move the object relatively; adjust the movement if needed (clamp to certain range, ignore certain axis, and so on);
- if mouse button gets up, and there was a control dragged, then reset the GUIControl* variable to null.
SMF spam blocked by CleanTalk