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

#2361
Quote from: Khris on Mon 20/03/2023 17:46:21I'd use the 1 column inv window as CW suggested, then use dynamically drawn sprites for the inventory items (and put the image on the left, then a wrapped description next to it).

That's doable, although I think splitting this into multiple controls may make it more flexible. Especially if you like to add interactivity on separate "parts" of each item.
#2362
Quote from: Spocker on Mon 20/03/2023 01:30:25As for your explanation on strings, I litterally just understood that it really meant... "STRINGS". I thought it was a concept or a name, like variable or integrer. Not the actual "guillemets". ^^'

Well, there's type String, which means a variable that contains text, and then there's concept of "string literal", which means that you put text in quotes (guillemets?) right in script. Functions require the arguments of String type, and if you print literal string in "" there, it will be automatically converted to one.

Quote from: Spocker on Mon 20/03/2023 01:30:25Now I just need to find in the Dialog Manual how to do line breaks inside the ListBox' strings,

ListBoxes only support single-line items. If you need multiple lines per item, then either:
* add multiple items to listbox, but then you'd have to split them manually somehow. Probably you will have to write your own function that splits one string into multiple, by the pixel width it takes (GetTextWidth function may give an idea).

Another approach would be to have multiple Labels instead of a ListBox. Labels can have multiple lines and wrap text automatically. Hmm... maybe even one label, but then you'd have to program it to arrange the text somehow, so maybe that will become less convenient.

Quote from: Spocker on Mon 20/03/2023 01:30:25and how NOT to display any background in the ListBox (or a transparent one), and the inventory will actually look nicer.

ListBox itself does not have a background, so you see a GUI background underneath... or do you mean background under selected item? that's ListBox.SelectedBackColor, but I do not remember if it can be transparent. There *may* be a workaround, where you'd handle the "SelectionChanged" event in ListBox and unset the selection to "none".
Then again, given your previous question, maybe ListBoxes won't work here.
#2363
Quote from: Spocker on Mon 20/03/2023 00:34:02But first, when I try this as you corrected:
Code: ags
ListBoxInventory.AddItem(1);
I get the error: "Type mismatch: cannot convert 'int' to 'const string'". Would you be able to help?

Ahh, sorry, I did not notice that. Yes, ListBox's AddItem require strings. If you're adding explicit values you could write
Code: ags
ListBoxInventory.AddItem("1");
but if you have an integer as a variable, which you want to convert to string, it will be:
Code: ags
ListBoxInventory.AddItem(String.Format("%d", value));

String formatting (printing values in string) in AGS is done in C-language-style; it's quite flexible, but may be found complicated at first:
https://adventuregamestudio.github.io/ags-manual/StringFormats.html
#2364
Quote from: Spocker on Sun 19/03/2023 23:57:23However, I can't seem to find any way to get to the object coordinates when it is drawn in the inventory. I wanted to have slots under slots, and not next to each other.

You may probably achieve wanted result if you make a narrow and tall InventoryWindow, making sure only 1 item is fitting in a row.
Also check for ItemWidth and ItemHeight properties of the invwindow, they define the expected item sizes (it ignores actual sprite sizes when calculating item positioning).

Then place a ListBox for textual descriptions to the right. Or buttons, if ListBox does not look right for any reason. You may also use rows (or columns) of buttons for displaying extra images and whatnot.
In fact, you may use buttons for everything there, it just will be more work, as you'll have to update button images as you scroll this inventory.

Quote from: Spocker on Sun 19/03/2023 23:57:23But it simply doesn't work and return this very enigmatic error: "Must have an instance of the struct to access a non-static member".

That's because you are not refering to an actual list box's script name, but to a type ListBox.
Instead your code has to be
Code: ags
myListBox.AddItem(1);
where "myListBox" is how you called your list box in properties.



In the worst case, when you cannot achieve this using built-in gui controls, you may try DynamicSprite / DrawingSurface solution. AGS lets you create a sprite in script, and then draw anything on it. Then you may assign it to GUI background, and update / redraw as necessary. That's additional effort to program though, and I recommend keeping standard buttons, as it will be difficult for a beginner to program their clicking behavior in script.

About drawing surfaces:
https://adventuregamestudio.github.io/ags-manual/DynamicSprite.html
https://adventuregamestudio.github.io/ags-manual/DrawingSurface.html

But in any case, this is the last solution to try.
#2365
Currently there following known issues, counting the critical and regressions:

First priority to fix:
FIXED1. Touch controls on some iOS devices (for web port, but may relate to iOS port too); I believe eri0o is working on the fix now.
FIXED2. A potential crash when restoring a save, related to Crossfade transition; found in very particular scenario:
Quote* Game begins in room 1 with regular fadeout.
* Room 2 has crossfade fadeout set in "after fade in" event. (SetScreenTransition(eTransitionCrossfade))
* Player saves in room 2.
* Player quits the game, restarts, appearing in room 1
* Restores the save made in room 2, which leads to crash.

Not overly critical, but annoying:
FIXED3. PlayQueue not playing next clip seamless (ticket), there's a small random gap. This affects cases when one music track transitions into another (e.g. non-looping intro continues into the looping main track). There are "manual" workarounds though. The problem is due to the differences in audio "systems" in 3.6.0 and earlier ones. I postponed working on this, as was not completely certain how complicated that would be, and thinking that 3.6.0 will be released soon... I'd like to look into this again in the following days and see if there's a "quick" solution. If not, then I'd likely leave this for the next 3.6.* patches / minor updates.
EDIT: have an idea of a temporary "hack" in the engine...
4. AudioChannel.Position not working for MIDI and XM/MOD clips (ticket). PositionMs works though. Position property was returning "sample" index for MIDI/MOD, which is difficult to retrieve with the new sound decoder library we're using. So this is mostly a matter of updating the library , either doing that ourselves, or nagging library authors to do this. I am leaving this for the future 3.6.* updates.
5. Problems with MIDI, or rather with loading config and sound fonts. This is a long and complicated story, in brief, not all soundfont packs work as-is, and engine can only find them in a few preset locations, which may not be convenient for some users. Again, for the future updates (dealing with the decoder library).
6. It's been reported that Direct3D "real fullscreen" mode sometimes hangs when alt+tabbing. The behavior was improved, but according to reports it is still possible to make it hang if you alt+tab alot. The situation is not understood well, and personally I was not able to reproduce this on my machine.
#2366
Updated to RC10 (3.6.0.45).
(use download links in the first post)

Editor:
- Fixed "export sprites" command run with an option to export sprites with absolute source paths.

Engine:
- Fixed that `Animate` command did not work for room objects with ID >= 100.
- Fixed `SimulateKeyPress` command could break some engine mod-key combinations (such as alt+ctrl for mouse lock, and so forth).
- Fixed initial positioning of a game window on desktop.
- Restored `--gfxfilter` command arg support for explicit scaling multipliers.

Templates:
- Updated to the latest project format.
- Fixed Sierra-style template relied on a human text on a button for switching voice modes (this could break if you change the text, or use a translation).
#2367
If done upon the compilation, the script compiler gathers a list of functions, which one may request and pass to the "upper level", where it's compared with the patterns and check existing events as a post-compilation step.

I also know that some compilers optionally warn about functions that are defined but never called from within the program itself.
#2368
Quote from: eri0o on Tue 14/03/2023 21:52:44I would have it signed on the left bar with a lightning bolt if it's linked by something, and if matches the style of something that's normally linked but it's not linked, have an exclamation, like this ⚠️.

Sorry, I did not understand this sentence. Which "left bar" are you refering to?


Quote from: eri0o on Tue 14/03/2023 21:52:44I wouldn't automatically link things right now until the delegates idea advances, since that would probably change things.

Change things how, theoretically? Whether one idea contradicts the other depends on what is implied by both of these features. But it may only be seen if the idea is elaborate.

Afaik the idea of a delegate implies to have an "event" or "function pointer" type of property in classes, which may be set or unset in scripts, at runtime.
The "automatic linking", at least from what I see in posts above, suggests to utilize already existing functionality of binding a script function to event at design time. That is, something is done automatically in addition to manual work (which can be done anyway).

I would also not recommend to wait for the implementation, as, knowing how AGS progresses, delegates may never be implemented, or implemented 5 years later. IMO it's best to decide on theoretical goals; knowing goals would let us know what is safe to consider and implement, and in which direction to develop.
#2369
For this to have any progress, we would need a more detailed specification on how such feature would work, on which stage and which part of the program is responsible for this. Also, what's the input and the output, so to speak. Is this auto-link a one time operation that changes the project data, or it has only an effect on the output data (and thus fully repeated each time a game is recompiled)?

For one example, in regards to the compiler's warnings; a script compiler does not know anything about object links or objects themselves. This information is stored in a different data source which is not a part of a script compiler's input. Therefore it cannot make such warnings. Something else might (an extra process before compiling the script?).


On similar topic, I recall there have been another suggestion, where room handlers should be fully automatic, because there can be only 1 room loaded at a time.

On another hand, there's an idea of supporting delegates, where one would be able to link multiple handlers to the same event, right in script. Will that conflict with the above ideas in any way?
#2370
We have similar case noted in a FAQ (https://adventuregamestudio.github.io/ags-manual/FAQ.html) in the manual, but apparently people still miss it. Probably because they focus on idea that particular command does not work correctly.

There's a common advice: if you just wrote a new function and commands inside do not seem to work, then the first thing to try is to place a breakpoint, or a Display command near and see if it executes. If not, that usually means that the whole function does not run, and that is a problem you need to solve.
#2371
Quote from: Matti on Mon 13/03/2023 21:22:02
Quote from: Crimson Wizard on Mon 13/03/2023 15:08:53on_mouse_click is not called when you click on GUI. eMouseLeftInv/RightInv are only passed when you click on items themselves (in case "override inventory clicks in script" is true), but not on empty space in inventory window.

Are you sure?


Frankly, I was not fully certain, so I had to test this right now. In my test game it is called when clicking on items, but not on empty space.

In our BASS template we have a "on_event" handler for right clicking over empty inv space, similar to what Khris suggested.

Given the above, I cannot explain how your code works, if you are definite that it works on empty spaces too. Can you double check that it actually works, and you don't have anything in on_event related to eEventGUIMouseDown? or perhaps in rep-exec?


EDIT: oh, I could swear we even had a ticket opened for this, and found it:
https://github.com/adventuregamestudio/ags/issues/472
#2372
Quote from: Snarky on Mon 13/03/2023 15:17:58Fair enough, but wouldn't it still be easier to use the OnClick event of the GUI itself?

GUI's On Click event is not triggered when you click on controls.

I don't know which "empty space" is OP referring to, but in case it's an empty space inside the InventoryWindow control, only on_event will work.
#2373
Quote from: Snarky on Mon 13/03/2023 14:19:46Edit: Oh, I see, you couldn't find a way to add an event handler for that. It may not have an event to hook up. In that case, you do have to do it in on_mouse_click():

@Snarky, on_mouse_click is not called when you click on GUI. eMouseLeftInv/RightInv are only passed when you click on items themselves (in case "override inventory clicks in script" is true), but not on empty space in inventory window.

This is why there has to be these "hacks" with on_event, as in Khris's code.
#2374
So, there was a small bug found, where Objects with ID >= 100 failed to Animate.
(Objects limit was increased 40 -> 256 in this version, and there was some weird legacy behavior that had conflicts with this.)
If anyone interested, here's a temp build with a fix:
https://cirrus-ci.com/task/4928866972598272

Another thing, we need to update Sierra template again, because it contains a small bug noticeable if you have translations and kept the default options Panel.
FYI the fix looks like this:
https://github.com/adventuregamestudio/ags-template-source/commit/dac12352fa0dc398c1e6db45a1d5a35c4ad06e5c
#2375
@SarahLiz, I think something was changed in the forums, and now you have to type [ spoiler ] instead of [ hide ].
#2376
Updated to RC9 (3.6.0.44).
(use download links in the first post)

Editor:
- Editor now copies a acsetup.cfg file from the project's root folder (if one is provided by a user) as a base for generating default config file. Settings from Default Setup will be written over, but other found options won't be removed.

Engine:
- Added "emul_mouse_mode" and "emul_mouse_relative" options to config in "[touch]" category. Touch-to-mouse emulation (mobile and Web ports) now uses distinct relative motion setting.
- Added stubs for agsappopenurl plugin.
- Fixed UTF-8 translations in ASCII-sourced games not correctly working on Unix systems (Linix, OSX, Android, etc).

Compatibility:
- For pre-3.5.0 games support old behavior of coincidental dynamic sprite replacement on GUI backgrounds (and few other places) without explicit assignment; that is - when the new DynamicSprite is created right after deleting an old one. (Yes, apparently there are few games that rely on that...)

Web/Emscripten:
- Few improvements for the overlay UI controls.
- Fixed few problems with the game focus and scaling when run in iframe.



Reported issues remaining:
* Direct3D is said to still be not fully stable when alt+tabbing in exclusive fullscreen mode: https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-0-release-candidate-rc1/msg636650995/#msg636650995
#2377
Engine Development / Re: AGS engine Linux port
Mon 06/03/2023 00:10:08
So, I found a bug in the engine, which happens when:
1. You have a ASCII format game and UTF-8 format translation.
2. You're running on system where original game's ANSI locale is not supported (or maybe the locale's name is not correctly defined for that particular system)*
In such case the engine makes a mistake an randomly corrupts some of the translation keys.

I'll be fixing this bug soon.

condition 2 - that's an issue on its own, and we'll hopefully look into this later; but it only matters if you are using extended ASCII/ANSI characters in your original game text.

Also, if this is a game you're making in 3.6.0, my recommendation is to convert to Unicode format anyway, which would help to avoid all these problems altogether.
#2378
Engine Development / Re: AGS engine Linux port
Sun 05/03/2023 22:27:39
Quote from: cibersheep on Sun 05/03/2023 22:09:46I'm comparing the trs file from Czech (ascii/eol windows) vs Catalan (utf8/eol windows)

Czech looks more complete but also some of the strings are not translated only on Linux. I'm thinking: may the strings in the game and the strings in the trs be in different case? That would be ignore on Windows but not on Linux, right?

You are probably referring to the differences in name case in filesystems? There's no relation to this, the TRS must have lines 100% identical to the lines in script, including letter case. This is the internal engine logic, it does not depend on platform you're running on.

EDIT: again, supposed to... unless there's some error there.
#2379
Engine Development / Re: AGS engine Linux port
Sun 05/03/2023 21:52:24
Oh, I actually just spoke with the game author on AGS Discord, so I might also ask him some questions.
#2380
Engine Development / Re: AGS engine Linux port
Sun 05/03/2023 21:45:28
Well, the fact that the translation works on Windows means that tra is at least built correctly, as this data is used equally everywhere. (At least supposed to...)

Quote from: cibersheep on Sun 05/03/2023 21:00:32It is the same file (we are sharing it) and it is available online (the windows build): https://emabolo.itch.io/super-star-trek-25th

I might check that out. But I see that Linux version is not available for download yet, do you test the Linux build prepared in the Editor, or combine the game files with linux engine port by hand?

Also, could you please tell, how do I reproduce this problem on Linux; what is the easiest way to get there?
SMF spam blocked by CleanTalk