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

#141
There's a GUIControl.AsButton property.
There's also a Mouse.SetBounds() command which should allow implementing the limited block movement, at least in theory.
#142
AGS does not currently allow to create new instances of built-in objects like inv items.

You can call player.AddInventory(iPage); multiple times but all this really does is increase the count stored in player.InventoryQuantity[iPage.ID].
You can also set the game to display each page individually in your inventory window but there's no way to distinguish which page the player has clicked on; to AGS it's all iPage.

I'd go with either of these two solutions:

1. create an inv item for each page (click handlers do not also need to be duplicated; you can use a single function for all items and react differently based on the page's ID)

2. use a container inventory item like a binder or folder, then use a custom struct to keep track of which pages have been found. Looking at the binder will display a dynamic message telling the player about the page numbers
#143
Those two lines don't affect the inventory GUI, just the iconbar one.
Anyway, an icon bar up top is typical of the Default / Sierra template, not the 9-Verb / LucasArts / Tumbleweed one.

So assuming you used the Sierra template (which doesn't have a permanently visible inventory at the bottom of the screen but uses a separate window), check the inventory GUI's PopupStyle setting. Since you didn't want the GUI to stop animations, you most likely have that set to "Normal", which means the game keeps running in the background and the player can still click on hotspots without closing the inv window first.
The quick fix is to change the PopupStyle to "Pause game when shown", but this will most likely stop background animations.

So the proper fix is to block mouse clicks while the GUI is open. An easy way is to simply insert this into on_mouse_click as the first line:
Code: ags
  if (gInventory.Visible) return;
(If you're using modules that also handle mouse clicks, you should create a new script at the top of the list and prevent clicks there by also calling ClaimEvent(); )

The proper, proper fix is to add a screen-sized, (semi-)transparent background to the GUI's background graphic sprite so the inventory GUI actually covers the entire screen, if not necessarily visibly so.
#144
Sounds like the GUI's visibility changed from "pause game when shown" to "normal" maybe?
#145
Just for reference, calling room functions from the global environment is possible using CallRoomScript().

In the click handlers for the buttons:
Code: ags
  CallRoomScript(1); // 1 = melee attack
Code: ags
  CallRoomScript(2); // 2 = block

In the battle room script, below the other functions:
Code: ags
function on_call(int p) {
  if (p == 1) MeleeAttack();
  if (p == 2) Block();
}

The parameter is simply an int value of your choosing so you can run different room commands/functions.
To keep things more readable you can use an enum for the various int values.
#146
player.Room is readonly.

Since I already explained in detail how to fix the issue, let me quote myself:

Quote from: Khris on Wed 04/12/2024 11:32:18If you started from a template that doesn't have any characters, create a new character (which will become the player character by default). Then set this character's starting room to 1 (or whatever the first room of your game is supposed to be.)
#147
Yeah, this approach is obviously not a good solution in general for various mentioned and unmentioned reasons.

The idea behind my suggestion was that @mawilbolou learns the basics of AGS while also getting quick results.
There's no good answer to a thread like this short of actually writing the exact step-by-step tutorial that was asked for, so I tried to think outside the box :-D
#148
The error is unrelated to OneDollar's code.

If you started from a template that doesn't have any characters, create a new character (which will become the player character by default). Then set this character's starting room to 1 (or whatever the first room of your game is supposed to be.)

(AGS is room-based and needs to know in which room to start the game, and also which character to use as player. This is a requirement to run any game. Switching to another room is done by having the player character change to that room, or by setting another character currently residing in another room as the active player character.
Another way to look at this is AGS will always display the room to the user that is stored in player.Room, so player cannot be null, and player.Room must be a valid room number.)
#149
Just 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.
#150
Note that you can add these bools in the "Global Variables" pane in the editor. This way you do not need to import/declare the variable manually in the global header/script.

Next, you can reference objects by script name in the room script:
Code: ags
function oBlueSphere_Interact(Object* the Object, CursorMode mode) {
  if (BlueSphereIsTakeable) {
    oBlueSphere.Visible = false;
    player.AddInventory(iBlueSphere);
    Display("You successfully pick up the sphere.");
  }
  else Display("The sphere hissen at you and tries to bite you. You decide to keep your hand off of it for now.");
}
#151
Please do the tutorial in the manual first, it covers all the basics:

https://adventuregamestudio.github.io/ags-manual/StartingOff.html

You can also press F1 in the editor to open the offline manual.
#152
I was thinking about the easiest way to do this and came up with a somewhat weird solution:

1. put the crossed out words in the background image
2. create a room object for each hidden object as usual but compose the sprite of the object image and the non-crossed out version already in the correct position, so that when the object is placed in the room, the box with the name covers the crossed out name
3. in each object's "any click" handler, hide the object, which will also reveal the crossed out name
4. block being able to also click the words by putting a transparent but clickable GUI on top
#153
I wrote my own version; it works just like Steve's:

  btnInvOK.SetMouseOverSound(aBonk, aDonk);

The second parameter is the mouse off sound. Both params can be null.

https://drive.google.com/file/d/1UbveGm-lV2KM4OkboO1aJGgBLKhHE66d/view?usp=sharing
#155
You can start with the award winning ones:
https://www.adventuregamestudio.co.uk/site/games/awards/
#156
In the other thread you wrote
Quotebut I get an error with the undefined symbol 'KnownNPC'.
and posted code that throws a different error (because you had 'char' as variable name).

My point is: post the exact code you have in your actual game, and chill. You're just starting out with AGS, but it sounds like you aren't new to coding. You should know that every single character matters. Yet your posts feel rushed, and you go back and edit posts, then try a few more things, then post another five replies. It just seems like a lot of wasted time and energy for everybody involved.

Edit:
Quote from: Joacim Andersson on Mon 18/11/2024 23:19:34I didn't use char in my actual code; I typed it wrong in the simplified example I posted here in the forum.
I'm well aware, that's why I told you to not do that. Fixing the wrong error is a waste of time.
#157
This is the second time you've
a) posted code and an error message that do not go together
b) posted code that should absolutely work but mysteriously fails, then suddenly and mysteriously does work

I'm glad you're able to get your issues resolved, but please keep in mind that these forum threads are also supposed to benefit future readers.
#158
Quote from: Joacim Andersson on Mon 18/11/2024 10:06:29I have other functions in a separate script and the import statement in that header file, but I need this function in my GlobalScript.asc file for a specific reason.

Can you elaborate on this?

Also, the word "char" is a keyword and not allowed as variable name. Changing it to "cha" makes the code work as expected.
#159
General Discussion / Re: Trumpmageddon
Wed 13/11/2024 23:44:43
I'm so torn about whether I should or shouldn't laugh my ass off at the people who voted Trump only to immediately faceplant.
At least this is a lesson for other countries. Maybe? ...what's the latest from Argentina?


#160
Calling UpdateInventory() reorders the items in the window, it might also reset the top item.
@DrLilo Can you show the actual code you're using?
SMF spam blocked by CleanTalk