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 - Snarky

#181
Advanced Technical Forum / Re: Wordle in AGS?
Thu 23/03/2023 06:07:42
To reset the game, I think you just have to blank out all the WordleGuesses in WordleGrid:

Code: ags
for(int i=0; i<MAX_GUESSES;i++)
{
  for(int j=0; j<WORD_LENGTH; j++)
  {
    Button* b = WordleGrid[i].LetterField[j];
    b.Text = "";
    b.TextColor = Game.GetColorFromRGB(0, 0, 0); // Set this to whatever color you want to type with
  }
}
#182
Quote from: Sakspapir on Tue 21/03/2023 10:26:28I completely agree with this. However, the functionality I'm implementing is kind of a "background" thing. It is sort of idle chit-chat that the player can choose to ignore.

Even so. There are a lot of benefits to splitting it up and keeping a one-to-one relationship between a line of text dialog and an audio clip. For example, if you were to translate it, you could do so without having to change all the subtitle timings. And you wouldn't have to write a whole bunch of special-purpose code to time the subtitles to the audio. (Though admittedly you would need to write code, or use a pre-written module, to provide queued background speech with voice.) And you would be easily able to vary it more dynamically; so that for example if the player leaves the room and comes back, it resumes at the next line (if you want); or if you try to talk to the person speaking in the background, you can interrupt them, and then they'll be able to resume afterwards with some kind of transition, like "What was I saying? Oh yes..."
#183
AGS doesn't come with collision detection out of the box, but there is a very old module that adds it (this dl link is still active).
#184
Nice work!

The way to do OR is to put it inside of the if-condition. The symbol "||" (two bars) means a logical OR, while "&&" (two ampersands) means a logical AND. So you could instead write:

Code: ags
function room_RepExec()
{
    if (mouse.x <= 480 || mouse.x >= 1101) {
      mouse.Visible = false;
    }
    else {
      mouse.Visible = true;
    }
}
#185
Great, I see what you're trying to do.

With a game resolution of 1600x900, that is (basically) the maximal resolution you can display in-game. So if you want to fit all of a 900x1600 image on-screen, you will need to scale it down (in an image editing app) so that it fits, i.e. to 506x900. This necessarily means you will lose image quality. You can then pad it with black on the sides to fill the screen.

Spoiler
Now, there is an exception to this, in that it's possible to "render sprites at screen resolution," a setting affecting characters and objects. If you made your background an object, you could scale it down in-game to fit the screen, and depending on the player's screen resolution, it might show in the full resolution. However, the AGS in-game scaling is primitive, so this could also introduce even uglier artifacts, and it wouldn't work at all for people playing the game in a window without upscaling, or in traditional full-screen.

I would not recommend this solution.
[close]

The easiest way to make sure the mouse cursor doesn't move outside of the active parts of the image is to check the position against the borders in the room's repeatedly execute function. However, note that this can be a problem for people who play the game in windowed mode, since it can trap the cursor over the game window.
#186
Hi Spocker, and welcome to AGS.

No, the game resolution is fixed, but you can achieve various effects by changing the Viewport/Camera and the room resolutions. So the question is more how you want this screen to appear in game. For example, do you want it to scroll vertically? And since the width is smaller than the width of the other rooms, would you want the sides to be filled with black, or the background to be "zoomed in" so that it fills the whole width of the screen, or what?
#187
The Rumpus Room / Re: *Guess the Movie Title*
Thu 16/03/2023 18:23:00
Oh wow, shock twist! You're... wrong.

Sure enough, you have the right director and the right actress; she was in Three Colors: Red, but this is the first movie she did with Kieslowski.

#188
Sorry to hear that, @cat. I don't think we've fully gotten used to the lower level of forum traffic and how it affects things like arranging Mittens.
#189
OK, so to me that suggests that the proposal could be implemented as follows:

As a post-compilation step, go through every entity in the game project, and every possible event for each entity (that hasn't been linked to an event handler). Generate the default signature of the event handler for that event (as it would be created if you double-clicked on the event in the editor). Compare that signature to the list of functions returned by the compiler. If you get a match, emit a warning.
#190
The theoretical goal here is to help users avoid this common mistake. As mentioned in the post where I linked to this thread, on second thought I think it's better to provide some kind of warning in the editor than to actually auto-link the event.

So the behavior I propose is this: When a user gives a command to build the project, the process detects if there are any functions (currently only in GlobalScript or a room scrip) that match the signature of the default event handler (i.e., matches the function name that would be auto-generated, and has the right argument list) for any event, but isn't linked to that (or any other?) event. If so, it produces a warning that is displayed to the user (in the editor, in the default case). Optionally, there could be a way in the editor to "automatically" resolve the issue by for example double-clicking on the warning to link the function to the event.

As Gurok adds, there should also preferably be some way to turn off this warning for a particular case, though I don't think this is essential.

I don't think this is incompatible with the delegate idea, unless we move to a system where you no longer link event handlers in the property pane at all (i.e. no longer defined in the project file), but always hook them up via code.

Quote from: Crimson Wizard on Tue 14/03/2023 16:51:02For 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?).

Sure. I don't think it makes much difference to the user what internal process is responsible.

Quote from: Crimson Wizard on Wed 15/03/2023 01:12:31Sorry, I did not understand this sentence. Which "left bar" are you refering to?

I'm fairly sure eri0o means the column to the left of the code editor where you can set breakpoints, do code folding, etc.

In general I think it's a nice idea to use it more to display errors, warnings, etc. I'm unsure whether marking event handlers would be helpful or just add clutter.

It also suggests that the analysis might happen as you type rather than at compile time, like in Visual Studio. That seems like a more ambitious idea.
#191
This is such a common mistake that I still think something like this would be a good idea. (Perhaps the best version would be a compiler warning whenever you have a function that matches a default event handler signature, but isn't linked to an event.)
#192
Yeah, thanks for bringing this back up, @AGA! In order to gauge interest among potential attendees, it might be useful to reach out to people who have attended or expressed interest in Mittens in latter years. I've put together this list, based mainly on attendee lists plus some people who have posted in past Mittens threads (each person being listed only for the most recent year):

2021 (?)
cat
LimpingFish
TheFrighter (?)
FormosaFalanster (?)

2020 (Cotswolds)
AGA
Creamy
Disco
Esseb
Igor+1
Matt Frith
Privateer Puddin'
Snarky
tampie85

2019 (Australia)
CJ+1
Layabout
scotch
Wiggy

2018 (Boston)
Grundislav
Jess
Quintaros+1
sonneveld
Terri
JenniBee
MillsJROSS+1
m0rph84
Pesty

2017 (Iceland)
2ma2
yamipanda

2016 (Sweden)
Andail
Chrille

Obviously not all of these are likely to attend. Any other names that should be added?

I can PM and try to email them, but if someone has other contact options, like Facebook, it would be great if you could ping them.

I would think it's also quite important to decide how to handle families bringing children, as you started to discuss earlier in the thread, but as a non-parent I don't think I can really contribute there.
#193
Matti, are you sure that is the code that is making it happen? There could be an on_event somewhere, perhaps in a module. Because I'm testing it, and indeed it does not seem like on_mouse_click() is getting called except over actual inventory items.
#194
Fair enough, but wouldn't it still be easier to use the OnClick event of the GUI itself?

Code: ags
function gInventoryBar_OnClick(GUI *theGui, MouseButton button)
{
  if(GUIControl.GetAtScreenXY(mouse.x, mouse.y) == invCustom)
  {
    // Do stuff
  }
}

No, dammit. I see that doesn't work either: the GUI doesn't get the event when you click on the Inventory Window. OK, so Khris was right. Seems to be the only way to trigger when clicking on the empty part of an inventory window.

(Incidentally, this part of AGS click handling is insane.)
#195
I still think eri0o's first suggestion was basically correct. (I'm not sure I understand what Khris is doing, but it seems more complicated than necessary.) However, it could be affected by the project setting "Handle inventory clicks in script": if that is set to true, I think you might have to deal with it in on_mouse_click()?

I am also puzzled by your latest attempts. Going by the function names and other contents, they handle clicking on buttons on the inventory GUI for setting the cursor mode. Why would you put this code there? It needs to go in a function to handle clicking on the Inventory Window control.

Edit: 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():

Code: ags
// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused())
  {
    // game is paused, so do nothing (i.e. don't process mouse clicks)
  }
  else if(GUIControl.GetAtScreenXY(mouse.x, mouse.y) == invCustom) // Put the name of your Inventory Window here
  {
    if(InventoryItem.GetAtScreenXY(mouse.x, mouse.y) == null)
    {
      //drop the current inventory item
      player.ActiveInventory = null;
    }
    else
    {
      //change the active inventory to item in which the mouse is over
      player.ActiveInventory = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
      mouse.Mode = eModeUseinv;
    }
  }
  else if (button == eMouseLeft)
  {
    // left-click, so try using the current mouse cursor mode at this position
    Room.ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight)
  {
    // middle-click makes the character walk to clicked area, regardless of cursor mode
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
}
#196
Having finally got around to playing the demo, I really enjoyed it. The gameplay is good, as it is fun to gradually uncover more subjects to ask about (it reminded me a good deal of Her Story, complete with hilariously bad database search functionality; though in this case I can more easily believe in it; I imagine they're using a ten-year-old+ system built by the nephew of some manager, with buggy behavior that's been getting worse over time), and at least at this stage, the note-taking requirement is not too onerous. The videotape puzzle was particularly satisfying, and well hinted if you don't immediately spot it. I did have a bit of difficulty with the shorthand, since the last letter looked quite different joined together than by itself (I took it for a '>'), perhaps due to the low-res pixel art.

I did occasionally feel that the UI/mechanic prevented me from doing or asking things that seemed like obvious investigative reporting steps, which could be frustrating. For example, IIRC, at The Chippy I could not ask Jared directly about his brother simply because I didn't get his name, and I definitely couldn't ask anybody else, even if in reality it would have been easy to ask them about "the owner of The Chippy" (though now I'm thinking maybe I should have tried to search the newspaper database for articles about the shop).

And I for one find it frustrating to type in AGS's TextBox control, what with the lack of any ability to move the cursor—among other things. So I would suggest trying out my TextField module, which offers a more fully-fledged control for text editing: it would also allow you to add undo, history (arrow up to autofill previous commands, like on many command lines), copy/paste, etc. to make it more user-friendly. (However, due to how AGS processes keypresses it has compatibility problems with some keyboard setups, so if you do use it you should probably have an option that would allow players to use the standard TextBox control instead.)

I'm also a little unclear about the tone the game is going for, and so what kind of mindset to adopt as I'm playing. Am I in for some light drama and a generally good time, or should I expect to find Iris' body in a freezer at some point? (I got a bad feeling in the back room of The Chippy, but I assume the police would have examined it?)

Although the dialog is quite limited, I thought the writing was good. I particularly enjoyed getting different perspectives on the same topics from different people. For example how Nathaniel thinks Hayfield Academy (like everything in Runeton) is posh, while Katie says the school has a dodgy reputation locally that it's been trying to shake.
#197
In many cases this won't be necessary, but if you need to keep track of the fact that the other character actually has the item, you can also add it to their inventory when you remove it from the player's:

Code: ags
  cPerson.AddInventory(iMartini);

(Also, I would recommend being consistent in whether you use player or cEgo—or whatever the name of your player character is—at least within a single block of code. Code is easier to follow and debug if you use the same name to refer to the same thing.)
#198
For the graying out part, that's a project setting. It's called something like "When game is paused, GUIs should display... (grayed out/normally)"
#199
The Rumpus Room / Re: *Guess the Movie Title*
Sun 12/03/2023 06:19:53
Quote from: TheFrighter on Sat 11/03/2023 08:40:03She looks like french actress

She is, though it's not Marceau. She is dubbed into Polish for the first half of the film.

Quote from: LimpingFish on Sun 12/03/2023 01:24:58I'm leaning towards a Krzysztof Kieslowski film...

You're not wrong. (And since it's not so fun for others to try to work it out after you've clearly got it and all but named it, I would suggest you just go ahead and say.)

#200
There was a spelling reform (by the Chicago Manual of Style, I think) a few years ago.

Spoiler
They took out the hyphen, and also changed "internet" to no longer be capitalized. (Though I personally still use uppercase most of the time.)
[close]
SMF spam blocked by CleanTalk