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

#381
Quote from: AndreasBlack on Tue 18/03/2025 12:28:59it's complaining about a parameter missing  ???

I skipped String.Format:

Code: ags
all_info = all_info.Append(String.Format("Object %d is at %d,%d\n", i, object[i].X, object[i].Y));

Quote from: AndreasBlack on Tue 18/03/2025 12:28:59I'm trying to get the values for the player tint now aswell. I've set up a basic gui where i change around the values. Would be nice to be able to push a button and see where the settings are at "now".

There is a group of Character properties related to its tint like TintBlue, TintRed, etc:
https://adventuregamestudio.github.io/ags-manual/Character.html#charactertintblue
they are used to read current tint values.
#382
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
#383
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.
#384
@Eon_Star, please try downloading this archive and copy the files into AGS 4 editor's program folder:
https://www.dropbox.com/scl/fi/mxqzjef9izvle9q9dpwp5/AGSEditor-4.0.0.16-fixscriptnameuppercase.zip?rlkey=xoep48uhuq9ugfhfampaxbu6t&st=lxf7hiik&dl=0

and see if that fixes the problem.
#385
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?
#386
Quote from: AndreasBlack on Mon 17/03/2025 07:53:37I'm trying to change the font size (searching in the manual) can't find it. There's no reason for AGS to give me two or three messages of display with coordinates of all objects when it could easily fit in one display message if only i knew how to change font size or perhaps change the font the basic 'AGS display' is using.

AGS does not let change the existing font size, but it lets to import same font with the different size as another font. This refers to TTF fonts of course, as bitmap fonts don't have such ability, they may only be scaled up using "Size multiplier" property.

Basic Display message box uses Game.NormalFont. Speech uses Game.SpeechFont.
https://adventuregamestudio.github.io/ags-manual/Game.html#gamenormalfont
https://adventuregamestudio.github.io/ags-manual/Game.html#gamespeechfont

GUIs themselves don't have "font". Text window guis use the font associated with the type of message (standard message or speech). Normal GUIs can have Labels and other textual controls (buttons, list boxes) on them, which do have a font selection.

Another option is to use DrawingSurface, which can draw text on a sprite, and that sprite may then be used on any object, such as overlay image or gui background graphic.

At last, but not least, there's System.Log command that prints to the log rather than displaying text in game.
The log is written to the file (on Windows it's located in "%USERPROFILE%/Saved Games/Adventure Game Studio" for historical reasons), but may be also viewed during game testing in the Log Panel of the Editor (https://adventuregamestudio.github.io/ags-manual/EditorLogPanel.html). Log Panel is enabled in Window menu.


Quote from: AndreasBlack on Mon 17/03/2025 07:53:37How do i create the same function as the ctrl + d debug is using and displaying it on a custom windows instead. I can't seem to find how to display all objects positions in a room via the manual. I've searched object getobject, object.getposition, etc. All i've seen is get object where it's currently at.

There's a global array for each type of objects in AGS, except ones created dynamically.
https://adventuregamestudio.github.io/ags-manual/GlobalArrays.html

You may iterate all objects in a loop and print their information.
Code: ags
String all_info;
for (int i = 0; i < Room.ObjectCount; i++)
{
    all_info = all_info.Append("Object %d is at %d,%d\n", i, object[i].X, object[i].Y);
}
#387
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).
#388
Quote from: glurex on Sun 16/03/2025 23:28:26I continued testing with brand-new games, and the same error occurs with all the templates except the blank template. Throughout my tests, I noticed that on some occasions, the first time I modify the first script in the list (e.g., TwoClickHandler.asc in the BASS template), the error doesn't happen. However, from the second time onward, it always does. The error only happens with Script (.asc) not the Header (.ash).

I also noticed that saving the game after modifying the script doesn't trigger the error. So, as long as I don't close the tab with the script and choose to save, everything remains safe enough.


So far I have not much ideas and was not able to reproduce this problem myself.
I opened a bug ticket for now:
https://github.com/adventuregamestudio/ags/issues/2704
#389
I remembered now. There was a mistake in previous versions of AGS where it won't create a script function if you entered its name into the events table yourself. This mistake is fixed in version 3.6.2. But if you're using older version, then you should either:

1) Don't enter any names, and just click on "...", then editor will do everything itself, or
2) Enter your name, but then you will also have to write function in script yourself.
#390
Quote from: catacatacaterpillargirl on Sun 16/03/2025 17:16:58I'm on 3.6. It was for a new hotspot and the event wasn't empty.

If that's a new, previously unused hotspot, then all events are supposed to be empty.

On another hand, if event was not empty and had a function name already, then the editor won't create a new one when you press on "...", but will point to where that function is in script.

Since you mentioned "glowing orb", that's one of the default templates, it has Hotspot 1 already in use. You may erase or repaint it, delete associated function from the script and replace with your own.

Have you tried creating other events, or using other hotspots, does that work and create new script functions?
#391
Please tell which version of AGS are you using?
Are you making a function for the new hotspot or for existing one? Was the "Look at hotspot" event empty before you clicked on "..."?
#392
Quote from: Creamy on Sun 16/03/2025 10:31:00In the last versions of AGS you cannot set script compatibility level below 3.2.1.

That's true if you are referring to AGS 4.0, but 3.6.2 can still do that.

Of course it's still better and future proof to update the script.
#393
Quote from: glurex on Sun 16/03/2025 00:12:35How strange! I just created a brand-new game to test it (I used the Bass template), and the error happened. Here I'm attaching a video:

Does this happen if you close unmodified tab, or close modified and choose to not save?
#394
Quote from: glurex on Sat 15/03/2025 23:06:29I think I found a bug. If I modify any line in any script, then close it from the tabs and click 'Yes' when prompted with 'Do you want to save your changes before closing?', I get an 'Unhandled Error'.

I cannot reproduce this in either version... there might be some conditions for this error to happen.
#395
Updated to Release Candidate 2
(Please use download links in the first post)

Changes:

Editor:
- Fixed hotspots and other mask items were not redrawn correctly after user changed selection using a navigation bar (regression since 3.6.2 beta).
- Fixed a check for an imported room mask size did not correctly account for the room's mask resolution setting (it worked, but mishandled some edge cases).
- Fixed translation compiler mistreating escaped opening bracket in a text line (`"\["`); it must keep it as-is, because "[" char is a old-style line break in AGS.

Script API:
- Added static Dialog.Stop() function, a OO-style alias to StopDialog().
- Added Game.InBlockingWait property, that tells whether game is waiting for any blocking action or a Wait* call to complete.
- Added optional "width", "height" and "layer" parameters to SaveScreenShot().
  SaveScreenShot() now accepts paths containing standard file tokens (`$SAVEGAMEDIR$` etc).

Engine:
- Engine will no longer quit with error if any object is assigned a non-existing sprite, but continue, using a sprite 0 as a placeholder instead.
- Fixed Character.SayAt clamping speech position to the screen's bottom and right edge (regression since 3.6.2 beta).
- Fixed character may rarely finish walking on a non-walkable pixel.
- Fixed calling Character.StopMoving() after AddWaypoint() succeeded a regular Walk() call with eWalkableAreas parameter will wrongfully teleport the character to the nearest walkable area, even though AddWaypoint is supposed to ignore walkable areas.
- Fixed a number of region or hotspot's "Stand on hotspot" events may unexpectedly run after a blocking character's walk, even if character is no longer standing on that region/hotspot.
- Fixed a AudioChannel did not report a correct Position right after a AudioClip.PlayFrom() call.
- Fixed Button resizing to sprite 0 size if NormalGraphic is set to 0 (default button look).
- Fixed object's look not updated after it was assigned a dynamic sprite, redrawn, sprite deleted, object redrawn without a sprite (used a placeholder), and then another dynamic sprite assigned with coincidentally the same number.
- Fixed objects begin to have incorrect z-sort order after changing room at least once (regression since 3.6.2 beta).
- Fixed font outline index limited to 127 (although we theoretically support higher font numbers).
- Fixed font outline parameters not initialized correctly if engine is built by a system that treats "char" as unsigned 8-bit type.
- Fixed accessing DynamicSprites in script could crash a game after restoring a save, if that save was made with eSaveCmp_DynamicSprites component excluded.
- Fixed a crash upon InventoryScreen() call in case there are no items (regression since 3.6.2 beta).
- Fixed a crash caused by any text messages using default text window (regression since 3.6.2 beta).
- Fixed voice lipsync triggering character body animation along with the speech if character went to idle state during a dialog (regression since 3.6.2 beta).
- Fixed SDL log level was defaulting to "verbose" if not read from config (should be "info").

Compatibility:
- Fixed old rooms with rare x3 resolution not displaying correctly.

Plugin API:
- Fixed a crash in IAGSEngine::OpenFileStream() if the stream failed to open for any reason.

WinSetup:
- Fixed "Save and Run" command sometimes caused 2 engine processes, one of which terminated later. This did not prevent a game from running, but could result in temporary CPU and memory overload.
#396
@Grundislav , I made a fix for 3.6.1 and 3.6.2 versions, will you require this for 3.6.0, or you have decided to go with your workaround?
#397
Quote from: Rik_Vargard on Thu 13/03/2025 16:51:11I clicked on the four links which, as I understand, lead to the same page but at that precise part of that page.

No, they lead to separate 4 pages.

Quote from: Rik_Vargard on Thu 13/03/2025 16:51:11I clicked on the the "Tutorial" and then  the "StartingOff" link
Then I clicked on the "acintro" link and there is this:

Ah... To be honest, it took me a while to find the "acintro" link that you are speaking of. Finally I found that it's added on the sidebar in the wiki. This link leads to an old version of the "Tutorial" page, and seems to be an oversight. It's no longer compiled in the manual, and probably should be deleted.

EDIT: I think that we may have an extra section in Tutorial with "external resources", and add links to user-made tutorials there.
#398
Quote from: Grundislav on Thu 13/03/2025 12:47:48In order to display correctly, I have to add a \ before the opening bracket, otherwise the bracket is treated as a line break.

However, the translation ignores the string because it starts with \

This seems to be an opposite problem compared to the one reported here earlier. Translation compiler tries to resolve escaped sequences like "\n", but when it finds "\[" sequence it does not consider that a valid standard escape sequence, so turns it into "[". This causes mismatches with the original line in game.
#399
The patches are made with a purpose to keep existing games working, so it should be okay to upgrade at least to the latest patch of a 3.5.1.
Or you may follow Khris's advice, make backup, and upgrade to the 3.6.1, which is the latest stable version.
Some people have upgraded their old ready games from version like 3.2.1 or 3.4, and they only required several fixes in settings or script to keep working.

To clarify this just in case, the last number in X.X.X.Y version does not match the patch number, these numbers also can mean beta versions etc, so that may be not convenient to find based on patch number.

I used to post "full editor version" in each release post, under the title. If you want to find exact 4-digit number, look for "Full release number: X.X.X.X" on the top of the first post. If you checked the wrong one you may usually deduce the correct version by adding or subtracting patch number. For example, if you opened some version and is sais 3.5.1.18, then your version is 7 patches behind.
#400
Quote from: Khris on Thu 13/03/2025 10:24:19The only way to keep existing ones is to temporarily replace the room background with a single-color image, take a screenshot at 100% zoom level and combine that with the new map in a paint program.

There's no need to make screenshots.
You can export existing walkbehind mask to a file, there's a button on a toolbar. Then paint changes over that and import back.

SMF spam blocked by CleanTalk