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 - Joacim Andersson

#21
Yes, I know how to convert a non-jagged multidimensional array into a 1-D array, but in this case, I would need a jagged array.

I'm glad to hear all the new stuff that will arrive with AGS 4 however, I'm not using that since it's still in alpha.

So, I'm guessing I'll have to use the struct workaround for now.

As always, thank you so much for your rapid reply.
#22
Does AGS support multidimensional or jagged arrays? I've tried to declare one but only get errors, my workaround is to create a struct containing one array member and then create an array of that struct.

That works, for now, I'm just interested if there's a "traditional" way of doing it.
#23
Quote from: eri0o on Thu 26/12/2024 12:01:59The web only use a virtual file system, and files in the save directory are persisted through a domain dependant key value database in the browser itself
I'm guessing that Window.localStorage is used in the WASM since the save files are persisted even if I close the WebBrowser.

In any case, I'm not going to hack the Web Assembly just to be able to store some basic data files, so I guess I will do it some other way.

But as always, thank you both for your response.
#24
First I want to start with an apology since I, asked for 2 different things in this post, but in my mind, they are connected.

1. The File* functions in AGS seem simple enough to use, I just wondered about file locations when building for the web or Android, I only need read permission but the files also have to be "installed" somehow.

What is the best solution for this? Can the $DATA$ tag be used and if so where do I place the files for them to be included in the build?

2. Are any modules available for AGS to read and traverse a structured file, as in JSON or XML format?
#25
Quote from: Khris on Tue 24/12/2024 11:49:51Why would one say "feature X should be available"? Why should it be available? Because you paid $0 for the product?
I will never understand this mindset. Especially if it's a "problem" that is extremely easy to work around.
I don't think I've asked for any new features, unless you count my comment on downcasting as a request.

My comment on why I can't call a String method directly on a function that returns a String wasn't a request it was just something I found weired.
#26
I'm using the latest stable version 3.6.2
#27
I understand that downcasting would require an explicit cast (unlike upcasting which can be done implicitly), but I still think it should be available.

There 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?
#28
But 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;
Which of course didn't work.
#29
Quote from: Crimson Wizard on Mon 23/12/2024 18:05:00What 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).
Yes, I apologize, it was under AsType which is probably why I missed it. However, I didn't get a result in the index for AsButton.
#30
Quote from: eri0o on Mon 23/12/2024 16:46:25https://adventuregamestudio.github.io/ags-manual/GUIControl.html#guicontrolastype
Yes, I found that online after I read Khris's reply above, but that doesn't really help the locally installed help file.
#31
Quote from: Khris on Mon 23/12/2024 11:40:57There's a GUIControl.AsButton property.
There's also a Mouse.SetBounds() command which should allow implementing the limited block movement, at least in theory.
Thanks for the AsButton property, which is not documented in the help file that comes with AGS. That documentation is somewhat limited.

I don't think I will use the SetBounds method though, I just use either the X or the Y property depending on the block I want to move. I also have to figure out how to stop the dragging of a block (I will most likely use GUI Buttons for this) if there's another block in the way.
#32
Quote from: Crimson Wizard on Sun 22/12/2024 18:19:01Here'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!/
I will have a look on that, and probably get back to you on it.
Quote from: Crimson WizardThe 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.
That sounds easy enough. Can I cast from a GUIControl to a Button? Also, I'm guessing that if there's only a mouse.IsButtonDown method I have to keep track if it was just pressed or not myself?

Quote from: Rik_Vargard on Sun 22/12/2024 21:52:57- When you select the object, make it disappear, and make the mouse cursor that object's image.
Thank you for your idea, but unfortunately, that won't work since you should only be able to drag the object horizontally or vertically, depending on its original orientation. Also, there might be blocks stopping you from dragging the block altogether.
#33
I'm currently developing a game that includes a few mini-games as part of the puzzles. I've already created one, but I had the idea of another that is like the Unblock Me game, except instead of a red block, you would unblock a key.

I wanted to do this in a GUI, but I'm OK with it being its own room if I can't use GUI controls. The thing is that I want to have buttons (or Objects) that you can drag & drop, but if you're familiar with the Unblock Me game, you can either drag a block horizontally or vertically, not in both directions.

A GUI control has a very limited number of events, so is there a way to implement this?
#34
Thank you both for your suggestions. It's too bad I couldn't use code like this:
Code: ags
function AddPage(int pageNum)
{
  InventoryItem* page = new InventoryItem;
  page.SetProperty("PageNum", pageNum);
  page.Graphics = ...;
  page.Name = String.Format("iPage%d", pageNum);
  player.AddInventory(page);
}
But I guess I have to add a bunch of the same iPageX (where X is a number) inventory items. I've already figured out how to do the rest, which includes using InventoryItem.GetByName() to get the correct page depending on the page number. I also have the rest figured out, I just didn't want to create all the inventory items in the editor, to begin with, but I guess I have to do that.
#35
In a game I'm working on some pages of a book have been lost and are spread around in the world. Now, I thought that I could use a single inventory item and add a "PageNum" property to it and then create different instances of this item in different locations, but that doesn't work. When I change the PageNum property of one, they all change.

Is there a way I can do this or do I have to have to have different inventory items for each page?
#36
I've considered using save slots but skipped that idea since I want this to be playable in the browser. So, I just wrote my own code around it. It was fairly straightforward in my case; I just thought I remembered another way of doing it. In my case, I just had to change a boolean variable into an enum so it could have a couple of different states, that could be checked in two different locations. If the intro was skipped it just also needed to set a couple of other variables and move the player character to a certain position when the game starts.

So thank you again, I guess I just remembered things wrong.
#37
Thank you CW, I do realize that I can write my own code around this, and that's not really the problem. It's just that I kind of remember that I once used some built-in feature for this, something similar to SetRestartPoint except that would require that you've already played through the intro.

Maybe I just remember it wrongly.
#38
The intro part ends in the same room as the game begins in, and the continuation is still within this room.

To clarify, the game starts within a room, the player has to leave and follow a path to another specific room where he gets some information. He then returns to the original room and on the way he meets another character that follows him inside the starting room and a conversation is had. The other character then leaves and this is the end of the intro.

The whole intro takes place in 4 different rooms.
#39
When my game starts the user has to play through a very restricted part of the game that sets the premise off the rest of the game. This is not really a cutscene since you still play the game and have to move through a few rooms. However, I want the user to be able to skip this part of the game from the start screen if they so desire, especially if they've played the game before. I did this in an old game of mine, but that was 20 years ago and I can't remember the code I used.

If anyone understands what I'm talking about and can give some advice I surely would appreciate it,
#40
Quote from: Khris on Wed 04/12/2024 10:50:32Just for reference: I just had Windows Defender scan my entire AGS folder which contains tons of compiled games ranging from v3.2.1 to v4 and the scan came back completely clean.
And yet, when I tried to download your Floaty Rog' game Windows Defender reported that as a Trojan at my end. Maybe, you don't have the latest Defender database installed.
SMF spam blocked by CleanTalk