AGS 4.0 - Alpha 20 for public test

Started by Crimson Wizard, Thu 01/06/2023 14:00:59

Previous topic - Next topic

Marion

Hello ! Sorry if this problem has been reported before.
It seems I can't start a dialog from another dialog.
When I start a dialog, all the options work fine, except the one that is supposed to start another dialog. When I choose this option, nothing happens.


// Dialog script file
@S  // Dialog startup entry point
return
@1
return
@2
 player.Neutre();
 cJoueur.Think("I will rest here for a little time.");
 player.Idle();
 FadeOut(5);
 aSave.Play();   Wait(40);  energie=energie+10;
 FadeIn(5);
 player.Joie();
 cJoueur.Think("I feel better.");
 player.Idle();
stop
@3
 dAmeliorerMaisonniveau2.Start();
stop
@4
stop


The @3 option doesn't start the dialog, it just makes the dialog stops.But the @2 works fine.

Crimson Wizard

#301
@Marion , haven't you already asked this question?
https://www.adventuregamestudio.co.uk/forums/advanced-technical-forum/ags-won-t-launch-the-correct-dialog/

There was a bug in the latest version of AGS 4, and it's fixed, but the new version is not released yet.
You will have to download a temporary version that contains this fix.
Here's the latest update on our build server:
https://cirrus-ci.com/task/6688808776761344

Scroll down and choose to download either as an installer or archive.

Marion

No, it's not the same problem. My previous question was about AGS always starting the dialog 0. In this problem, it doesn't start the dialog at all when it's coded from inside another dialog.

Crimson Wizard

Quote from: Marion on Sat 08/03/2025 12:40:21No, it's not the same problem. My previous question was about AGS always starting the dialog 0. In this problem, it doesn't start the dialog at all when it's coded from inside another dialog.

I see, I haven't fixed this problem to the end, I will look into this soon.


Crimson Wizard

@Marion

Note that in dialogs you don't have to use Dialog.Start command, you can do this instead:

Code: ags
@3
goto-dialog dAmeliorerMaisonniveau2

That seems to work in this version.


Crimson Wizard

A build with fixed Dialog.Start and StopDialog in dialog scripts:
https://cirrus-ci.com/task/4778145221443584


Crimson Wizard

#309
Updated to Alpha 20
(Please use download links in the first post)

This is a quite a big update, containing several new scripting features at once. Unfortunately, I was not able to test this extensively, being busy fixing 3.6.2... this does not mean that I did not test at all, but maybe I did not test much enough. If there any new bugs found, I shall make temporary updates as been doing previously.


This update contains all the new features and fixes from 3.6.2 RC2 (excepts ones related to backwards compatibility).


Own changes:

Editor:
- Added BlendMode and Transparency property for GUI Controls.

Scripting:
- Support for dynamic pointer cast: use syntax "pointer as Type" to cast the pointer to either a parent or child type (upcast and downcast respectively).

Script API:
- Added Touch and TouchPointer structs, meant to handle touch controls in script.
- Added MotionPath struct, which lets to read existing game object's motion plan, or create your own and use it as a reference when moving a custom object.
- Added GUIControl.BlendMode property that lets to select BlendMode for any GUI control.
- Added new Blend Modes: eBlendCopy, eBlendCopyRGB and eBlendCopyAlpha.
- Added Character.MotionPath and Object.MotionPath properties that let to get active character's or object's movement plan.
- Added Math.Random(), Math.RandomFloat() and Math.Round() functions.
- Added eRoundTowardsZero and eRoundAwayFromZero rounding styles for use in FloatToInt() and Math.Round() functions.

Engine:
- Support touch input directly, without touch-to-mouse emulation.
- Fixes launching games compiled in Release mode.
- Fixed restoring game saves which contain zero-length dynamic array.
- Fixed goto-dialog and stop commands in dialog script always returning to dialog 0.
- Fixed Dialog.Start() and StopDialog() failing to work in dialog script.



First, the new touch API, it's briefly explained in this topic (with a small demo game):
https://www.adventuregamestudio.co.uk/forums/engine-development/ags-4-touch-input-api/

From now on you no longer have to emulate mouse clicks on touch devices, and may script your game with exclusive controls for touch events. (Although touch-to-mouse emulation is still available as a backup option.)



Dynamic pointer cast finally allows you to cast down from a base pointer to a child pointer.
This feature uses classic C# syntax "pointer as Type". For example:
Code: ags
managed struct Parent {
    int a;
};

managed struct Child extends Parent {
    int b;
}

function game_start() {
    Parent* p1 = new Parent; // create instance of Parent type
    Parent* p2 = new Child; // create instance of Child type

    Child* test_child1 = p1 as Child; // fails, results in null pointer
    Child* test_child2 = p2 as Child; // succeeds, results in a valid pointer
}

This generic syntax also supercedes existing GUI control properties like AsButton, AsLabel etc.
Following two lines, although use different internal mechanism, are supposed to have same results:
Code: ags
Button* btn1 = control.AsButton;
Button* btn2 = control as Button;

NOTE: this feature works with both built-in engine types, and user types declared in script.
It also potentially works with plugins, but only if they are registering the script types correctly; which may not be always the case. In the worst case "as N" done with plugin types will simply return null pointer. Plugins which have this problem may be fixed for AGS 4 though.



New Blend Modes eBlendCopy, eBlendCopyRGB and eBlendCopyAlpha copy color to the destination surface, only RGB part of the color, or only alpha part of the color.
eBlendCopy mode can be used to directly replace pixels on DrawingSurface, and is meant to be used with COLOR_TRANSPARENT and when you want to make surface translucent in some places.
eBlendCopyAlpha is an equivalent of DynamicSprite.CopyTransparencyMask.
eBlendCopyRGB is for when you have a half-translucent surface already and you want to only change RGB color in its pixels, but not transparency level.

There's another application for these modes. If there's a "combined object" with child parts, where the child parts are first drawn over their parent before parent drawn to screen, then these modes could be applied to the child objects to achieve interesting effects, like cutting holes in the parent.
Unfortunately, at the time of writing this, the only real case where this will work is GUI. That's because of how rendering works. If you apply eBlendCopyAlpha to a character, then it will make holes not in other objects below, but in the final game view, so you will "see through" the game into the underlying black screen. Maybe we'll have more opportunities to use this effect with the rest of game objects in the future.

Here's an example of using eBlendCopyAlpha with Button control on GUI:
Spoiler
[close]



Finally, MotionPath struct in script is complementing new pathfinding API, which was added earlier.
There are two uses of this struct.
1. You can get it from a moving Character or Room Object, and read their moving plan and current state.
2. You can create custom MotionPath using its Create methods, and use as a reference to move custom objects.
Right now this struct only supports typical linear movement that AGS uses when walking a character or moving a room object. Maybe AGS will support more sorts of movements in the future versions (e.g. using splines or slerp techniques).

Eon_Star

Hi,

I just created a new game with the 4.0 Patch 20.
I get this error:



Thanks

Crimson Wizard

#311
Quote from: Eon_Star on Mon 17/03/2025 17:51:06I just created a new game with the 4.0 Patch 20.
I get this error:

Please note that you can right click on a output panel and select "copy all" then paste the error text directly, without having to make a screenshot.

In regards to this error, from the looks of it it seems like the "gActionBar" GUI have generated a ACTIONBAR constant that has non-latin capital I with a dot (probably from a Turkish alphabet)?
I am not sure how that could have happened.
Does the same happen in the previous versions, like 3.6.2 or 3.6.1?

Crimson Wizard


Eon_Star

#313
Quote from: Crimson Wizard on Mon 17/03/2025 17:59:34
Quote from: Eon_Star on Mon 17/03/2025 17:51:06I just created a new game with the 4.0 Patch 20.
I get this error:

Please note that you can right click on a output panel and select "copy all" then paste the error text directly, without having to make a screenshot.

In regards to this error, from the looks of it it seems like the "gActionBar" GUI have generated a ACTIONBAR constant that has non-latin capital I with a dot (probably from a Turkish alphabet)?
I am not sure how that could have happened.
Does the same happen in the previous versions, like 3.6.2 or 3.6.1?


Yes. Happens with 3.6.1 and upper versions. I am using 3.6.0 P1 right now.


PS:

The patch worked. I will try to open older game files made with 3.6.1.

New problem:

Failed to save room room5.crm; details below
Rooms\5\room5.asc(41): Error (line 41): Undefined token 'RemoveWalkableArea'
Room room1.crm was saved, but there were warnings; details below
Room 1: Hotspot (0) hHotspot0's event Look function "hHotspot0_Look" not found in script Rooms\1\room1.asc.
Room 1: Hotspot (0) hHotspot0's event Interact function "hHotspot0_Interact" not found in script Rooms\1\room1.asc.
Room 1: Region (2) Region2's event WalksOnto function "region2_WalksOnto" not found in script Rooms\1\room1.asc.


Can you help?




Crimson Wizard

#314
Quote from: Eon_Star on Mon 17/03/2025 18:43:03Rooms\5\room5.asc(41): Error (line 41): Undefined token 'RemoveWalkableArea'

RemoveWalkableArea is deprecated, but iirc may be turned back if you use "Script compatibility level" to "3.99.x Alpha". The new command is Room.WalkableAreas[n].Enabled.

Some information about new WalkableArea struct may be found here in this post:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-4-0-early-alpha-for-public-test/msg636661199/#msg636661199

We currently have an issue with how the manual is made, it prevents me from adding AGS 4 changes.
I might try to create a cheat-sheet for AGS 4 as a temporary measure.

Quote from: Eon_Star on Mon 17/03/2025 18:43:03Room room1.crm was saved, but there were warnings; details below
Room 1: Hotspot (0) hHotspot0's event Look function "hHotspot0_Look" not found in script Rooms\1\room1.asc.
Room 1: Hotspot (0) hHotspot0's event Interact function "hHotspot0_Interact" not found in script Rooms\1\room1.asc.
Room 1: Region (2) Region2's event WalksOnto function "region2_WalksOnto" not found in script Rooms\1\room1.asc.

These warnings mean that you have event functions inserted into the hotspot's event table, but not present in the script.
We added these warnings since 3.6.2 to let users know that they have events desynced with the script.

Eon_Star

I will try again and report if there are other issues.

Thanks.

Eon_Star

Hi,

another error occured. Script issuse from the A.S.S. Module:



Crimson Wizard

Quote from: Eon_Star on Tue 18/03/2025 10:49:46another error occured. Script issuse from the A.S.S. Module:

"savegameindex" is an ancient variable that was deprecated since AGS 2.72. It is no longer available in AGS 4.

The proper way is to use ListBox.SaveGameSlots instead:
Code: ags
lstLoadGames.SaveGameSlots[saveslot];


Note that we have a table of obsolete commands and variables, with their replacements:
https://adventuregamestudio.github.io/ags-manual/ObsoleteScriptAPI.html

SMF spam blocked by CleanTalk