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

#1
Are you planning to add the possibility to update games without losing saved files in this version of ags?
#2
Quote from: eri0o on Sun 25/02/2024 22:33:58In your code, just before WaitUntilKeyPressed (line 35 above), put a wait, and wait for something around 300ms, which if it's a 60fps game it would be around 20 game loops (Wait(20)). I think the problem is the debounce of IsKeyPressed which checks if a key is pressed and hold.
Hey, thanks for the response!
Adding that worked great, but sometimes it recognize the key pressed and sometimes you need to press the key 2 or 3 times. I will check the new wait functions, maybe I can fix it changing my code with that

Quote from: eri0o on Sun 25/02/2024 22:33:58I did this effect using the tty module in Don't Give up the Cat where I pointed it out.
I will try this module, maybe is more easy for me instead of trying my own code
#3
Quote from: eri0o on Sun 25/02/2024 12:41:43I think the best option would be using the Typewriter module instead

https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-typedtext-0-7-0/

Hey, thanks for the recommendation!

I tried to use that module before but I don't really understand how to use it correctly.

I will try to give it a second chance

Quote from: Khris on Sun 25/02/2024 13:10:04The main problem is the display command, which pauses the game until you press a key or mouse button.
If you use a GUI and a label instead, it'll work as expected.
Quote from: Crimson Wizard on Sun 25/02/2024 18:17:23Yes, what Khris said, Display is for showing blocking text only, for non-blocking display there are several variants:
- GUI with a label;


This worked like a charm but now I have a problem that I tried to fix it but I can't

My code is the following right now:

Code: ags
bool keyPressed = false;

bool IsAnyKeyPressed() {
    int i = eKeySpace; 
    while (i <= eKeyUnderscore) { 
        if (IsKeyPressed(i)) return true;
        i++;
    }
    return false;
}

function WaitUntilKeyPressed() {
    while (!IsAnyKeyPressed()) {
        Wait(1);
    }
}

function Typewriter(Character* ch, String text, int speed) {
    String textShow = "";
    gText.Visible = true;
    for (int i = 1; i <= text.Length; i++) {
        textShow = text.Substring(0, i);
        lText.Text = textShow;
        Wait(speed);
        
        if (IsAnyKeyPressed()) {
            keyPressed = true;
            break;
        }
    }
    
    if (!keyPressed) {
        lText.Text = textShow;
    }
    
    WaitUntilKeyPressed();
    gText.Visible = false;
}

This works "fine", the typewriter effect is shown in the gui and after pressing a button the GUI disappears, but I want this: if you press a button it overrides the effect and shows the full text. Also, when the full text is displayed, you have to press another button to make the GUI disappear.
#4
Hello everyone!

It's been a while since I've written on these forums, but I'm back with this wonderful program called AGS.

I'm a little rusty with the scripting part of AGS, so I want to ask for help

I'm trying to write a function to type text like a typewriter.

I have two problems with my current code:
1) I need to press any key (such as the mouse button) to skip the text and appear the next word (character).
2) The function does not work in the global script to be called in any room, but if you write the code in the room script, it works fine.

The code is the following:

Code: ags

function Typewriter(Character* ch, String text, int speed) {
    String textShow = "";
    for (int i = 1; i <= text.Length; i++) {
        textShow = text.Substring(0, i);
        Display(textShow);
        Wait(speed);
    }
}


And when I use the function for example when I look an object:

Code: ags
Typewriter(player, "Wow, Amazing", 10);

The function works fine, but I need to press a key, the text disappears and comes back with the next word, something like:
W
*presses a key*
*text disappears*
*text appears again*
Wo
*text disappears*
*text appears again*
Wow

Someone can help me with this?

Thanks in advance
#5
Quote from: eri0o on Tue 05/04/2022 12:03:54
Which Fullscreen you are using? Borderless windowed Fullscreen or the exclusive Fullscreen?

This problem is only with exclusive fullscreen.

Quote from: Crimson Wizard on Tue 05/04/2022 12:20:41
It's also useful to know which graphic renderer does this happen with (Direct3D, OpenGL, Software, all).


I will post below screenshots of the problem with the different graphic render modes.

Test with AGS 3.5.1:

With Direct3D 9 I get a screenshot of the window below the game (in this case google chrome) and a white rectangle in the left corner (that is the game window i guess).

Spoiler
[close]

With OpenGL I get a similar problem but the screenshot only show my desk (ignore the apps and programs hahaha) and the white rectangle in the left corner again.

Spoiler
[close]

And finally with software renderer I get the proper screenshot of the game
Spoiler
[close]

Test with AGS 3.6.0

With Direct 3D 9 you will get a screenshot of the window below the game (google chrome in my case), but the difference with 3.5.1 it's that this time there is no white rectangle, it's like a normal screenshot of my pc (the google chrome window, so I will not post the image).

With OpenGL it's the same result as Direct3D

And software renderer in this version it's different, you will not get the proper game screenshot, instead you will get the same as above (a normal screenshot of the desk).

If you use the new borderless window fullscreen you will get the proper game screenshot if you use direct3d or software renderer (so it's a way to fix this problem I guess), but if you use opengl you will get the desk screenshot like the above tests)

All of this tests was made with a game template and with the exe file generated, changing the configurations with the game setup.

But there is something more strange, If I run the game I working on (without any build) I will get a black screenshot with a white window on it.

Spoiler
[close]

This is very weird and strange (specially the last one).

Doing this tests I found that the "solution" will be using the borderless window fullscreen with direct 3d or software renderer.

I hope this can have a solution or maybe can help to find the problem that is causing this.
#6
This is so cool I feel like a child again hahaha

I read that the Guybrush's voice will be the same as CMI, that's cool because I liked the voice

Quote from: Babar on Mon 04/04/2022 17:38:09

Aaa....I'm not a fan of the art style. I don't see Mark Ferrari's name anywhere.

(and it's not even a heart-ripping April 1st update!)

Well I saw that David Fox and Dave Grossman are working on this so it's cool
#7
I know that the problem I'm going to talk about is not about skipping the dialog, but it is related to the print screen button so I don't think I have to create another post to talk about this.
I have this problem (don't know if it's just me or everyone) from the old versions of ags to the current one (3.6.0), so I guess it's not fixed. The problem is that if you use the print screen button with the game windowed, the screenshot is taken fine, you can paste it in paint/photoshop for example and everything is fine, but if you take the screenshot with the game in full screen and then paste the screenshot in any image editing program you will get a black image (in the current version it will be a black image with a white rectangle). Usually when you use the print screen button in full screen games you will get the actual image. I know you can use the ags built-in feature that saves a screenshot as an image in a folder, but sometimes people want to take a quick screenshot and paste it wherever they want. So this is an AGS problem or just me? Does this have a solution?
#8
Quote from: Crimson Wizard on Mon 17/05/2021 18:05:36
I did not yet look into this problem, but I am not quite sure what "Impr Pant PetSis" button is. Is this like "Print Screen" button?

Yes it's the print screen button. I don't know why in fullscreen game it's only work on Software renderer and not in OpenGL or Direct3D (That only shows the white square like I showed in the main post)

Quote from: Crimson Wizard on Mon 17/05/2021 18:05:36
OpenGL and Direct3D perform hardware accelerated drawing which improves perfomance by delegating tasks to GPU, especially in cases when there's object scaling and other visual effects (like sprite tinting).

And why Direct3D is more fluid and accurate than OpenGL, but OpenGL is better when it comes to scaling the game? (Direct3D depends on the configuration will blurring the game, how I showed it in the main post)

Is it convenient to use Renderer Software if your game is not 8-bit?
#9
Yes I know that "solution" but some players prefers using the screenshot in the resolution that they are seeing and in a fast way like the button impr. What's the difference with the graphic opengl and direct3d againts software renderer? The software renderer is bad?
#10
Hello, I didn't know in which part of the forum to ask or say this so I assumed that this would be the best forum section.
I'm creating a game in 1280x720 resolution(But I tested this problem in other resolutions and it happens the same, anyway I tested this problem only in Windows 10, since I don't have another O.S)

When you configure the driver in Open GL or Direct3D and play the game in fullscreen (since this error only occurs in fullscreen), if you use the keyboard button Impr Pant PetSis (To take a screenshot) the only thing that appears in the screenshot it's a small white square in one corner and below that the program or window you were using (The screenshot below to show what it looks like).

Spoiler
[close]

Now, on the other hand, if you use Renderer Software, everything is perfect, the whole game looks fluid as if you were using the windowed game. And the screenshot with full screen works perfectly.

Another error that I should also notice is that if you choose the option Mode Native Game Resolution in the Setup and use Direct3D, the game despite being in Scaling Method Nearest-neighbor is deformed and blurred. (Screenshot below of how it looks, I take it with the program Fraps, because the problem that I mentioned of not being able to take screenshots in fullscreen with that mode).

Spoiler
[close]

And finally also I noticed that if the OpenGL option is chosen the mouse doesn't move pixel by pixel as it should, if you move it slowly it takes time to move, it's slower, unlike Direct3D and Software Renderer where that options makes it fluid as it should.

This things I tested in both AGS version 3.5.0 and 3.5.1.

I also tested if this problem was still in the WIP version of AGS 3.6.0, and the problem still continuing occur the same and the only one that allows taking the screenshot in fullscreen with the button is the Renderer Software.

Maybe all these errors that I said have already been known for a long time and have no solution, but just in case I wanted to comment on it, especially the screenshot problem, I know many people who like to use that button to take screenshots and if that happens it would be annoying for the players.
#11
Well as I didn't find a way to fix it, I tried to create my own function, after many errors and tests to get my function work I succeeded. It works perfectly, the problem is I believe that it's not the properly way to do it, since for example if I want an inventory of 40 objects, it would be crazy to make an InventoryItem for 40 checks, there is a way to improve my code to make it "simpler" or more accesible the way to implement it. The script is the follow (the number of objects of the same item is applied to a label):

Code: ags

int itemcount[10];

void UpdateInvNumber() {
  InventoryItem *CountItem1 = PlayerMainShow.ItemAtIndex[0];
  InventoryItem *CountItem2 = PlayerMainShow.ItemAtIndex[1];
  InventoryItem *CountItem3 = PlayerMainShow.ItemAtIndex[2];
  InventoryItem *CountItem4 = PlayerMainShow.ItemAtIndex[3];
  InventoryItem *CountItem5 = PlayerMainShow.ItemAtIndex[4];
  InventoryItem *CountItem6 = PlayerMainShow.ItemAtIndex[5];
  InventoryItem *CountItem7 = PlayerMainShow.ItemAtIndex[6];
  InventoryItem *CountItem8 = PlayerMainShow.ItemAtIndex[7];
  InventoryItem *CountItem9 = PlayerMainShow.ItemAtIndex[8];
  InventoryItem *CountItem10 = PlayerMainShow.ItemAtIndex[9];
  if (CountItem1 != null) {
    lInv1.Visible = true;
    itemcount[1] = player.InventoryQuantity[CountItem1.ID];
    lInv1.Text = String.Format("%d", itemcount[1]);
  }
  else {
    lInv1.Visible = false;
  }
  if (CountItem2 != null) {
    lInv2.Visible = true;
    itemcount[2] = player.InventoryQuantity[CountItem2.ID];
    lInv2.Text = String.Format("%d", itemcount[2]);
  }
  else {
    lInv2.Visible = false;
  }
  if (CountItem3 != null) {
    lInv3.Visible = true;
    itemcount[3] = player.InventoryQuantity[CountItem3.ID];
    lInv3.Text = String.Format("%d", itemcount[3]);
  }
  else {
    lInv3.Visible = false;
  }
  if (CountItem4 != null) {
    lInv4.Visible = true;
    itemcount[4] = player.InventoryQuantity[CountItem4.ID];
    lInv4.Text = String.Format("%d", itemcount[4]);
  }
  else {
    lInv4.Visible = false;
  }
  if (CountItem5 != null) {
    lInv5.Visible = true;
    itemcount[5] = player.InventoryQuantity[CountItem5.ID];
    lInv5.Text = String.Format("%d", itemcount[5]);
  }
  else {
    lInv5.Visible = false;
  }
  if (CountItem6 != null) {
    lInv6.Visible = true;
    itemcount[6] = player.InventoryQuantity[CountItem6.ID];
    lInv6.Text = String.Format("%d", itemcount[6]);
  }
  else {
    lInv6.Visible = false;
  }
  if (CountItem7 != null) {
    lInv7.Visible = true;
    itemcount[7] = player.InventoryQuantity[CountItem7.ID];
    lInv7.Text = String.Format("%d", itemcount[7]);
  }
  else {
    lInv7.Visible = false;
  }
  if (CountItem8 != null) {
    lInv8.Visible = true;
    itemcount[8] = player.InventoryQuantity[CountItem8.ID];
    lInv8.Text = String.Format("%d", itemcount[8]);
  }
  else {
    lInv8.Visible = false;
  }
  if (CountItem9 != null) {
    lInv9.Visible = true;
    itemcount[9] = player.InventoryQuantity[CountItem9.ID];
    lInv9.Text = String.Format("%d", itemcount[9]);
  }
  else {
    lInv9.Visible = false;
  }
  if (CountItem10 != null) {
    lInv10.Visible = true;
    itemcount[10] = player.InventoryQuantity[CountItem10.ID];
    lInv10.Text = String.Format("%d", itemcount[10]);
  }
  else {
    lInv10.Visible = false;
  }
}

function repeatedly_execute_always() {
  UpdateInvNumber();
}
#12
Well I was able to fix the problem, apparently it was caused by an item that was one pixel wider, now if the inventory have 10 objects will start to adding the rest of items in the other inventory. But I have a new problem, I don't know why the Khris's "Stacking Inventory" module doesn't update correctly the numbers (quantity of the object). If, for example, I talk to a character and he gives me 10 cookies, 3 stones and 2 diamonds, only the number of the amount of objects I have appears in the cookies and the diamond, not in the stones. Now if you add after the diamond one stone more it will shows the cookies and the stones but no longer shows the number of diamonds. I do not know if it is a problem in the module code or something, the module is the following: https://www.adventuregamestudio.co.uk/forums/index.php?topic=56481.msg636595239#msg636595239

Thanks.
#13
Hi, in my game you will have 2 inventories, one (the main) only show 10 item spaces, and the other one (will show the items that you have in the main inventory and the rest of items) have more space (but will be restringed at first, something like resident evil that you can upgrade more space).

What I need to do is when you have your first 10 items, "block" in some way the inventory windows and start adding new items in the secondary one. Exist some way to know if you have the 10 inventory items spaces full? (Or know if more spaces are full, to implement the blocking inventory until upgrade like resident evil in the secondary inventory window)

I was reading the manual and tried to make my own function to add items, but I don't know why when you get the item number 11 the main and the second inventory suddenly have all the items sprites invisible.

My code is:

Code: ags
void AddInventoryExtend(InventoryItem *item, int addAtIndex) {
  if (PlayerMainShow.ItemCount >= (PlayerMainShow.ItemsPerRow * PlayerMainShow.RowCount)) {
    player.Say("Inventory full, will be added to the bag.");
    cSInventory.AddInventory(item, addAtIndex);
  }
  else if (PlayerMainShow.ItemCount < (PlayerMainShow.ItemsPerRow * PlayerMainShow.RowCount)) {
    player.AddInventory(item, addAtIndex);
  }
}


The code in some way work because the items are added to my inventory and the player says the message when I try to add the item number 11 but after that suddenly happen what I said above.

The other problem is that I will use the Khris script Stacking Inv (To stack the items and show the amount number), his code only works if I use with the global setting "display multiple icons for multiple items" deactivated, I delete the Krhis script and activated that option only to test my code because I read that the script ItemCount only works with that option activated. So exist some way to "fix" my code or do what I want (what I explained in the top of the post) and without using the itemcount (so I can use the Khris stacking inv too)?

Thanks in advance to whoever can help me
#14
I'm going to try to have something in time, the subject interests me a lot, so maybe count me in
#15
First of all I want to thank everyone for the help. Khris I tried your code and for some reason it didn't work, it didn't even get animated, the new number just appears.
Gilbert your code worked perfectly, now with small numbers it goes slow and with bigger  number it goes fast, thank you very very much.
#16
Quote from: Khris on Tue 04/05/2021 08:22:21
Please don't quote the entire previous post. There's a Reply button at the bottom.

Sorry I didn't mean to it, I'm new in the forums and didn't know very well how it was handled.

Quote from: Gilbert on Tue 04/05/2021 10:41:26

As KhrisMUC pointed out you can actually add or subtract more than 1 in each game loop, but you'll need to do additional checks (for example, if you add/subtract 5 each time and don't check the result, then say if at some instance realMoney = 8 and dispMoney = 7 then dispMoney will annonyingly fructuate between 7 and 12 indefinitely). The check would be easy. I just put out the simplest possible codes as a start:


Thanks Gilbert, this worked like a charm, but now I have a new problem. If I want to add a number of money such as 30000, if it only adds dispmoney+=5 in the script it's still very slow, if I change the number for example to dispmoney+=95 or 105 now it reaches the new value as quickly as I need, but now if I add money less than 105 only the value appears without the animation. Is there a way to regulate the animation depending on the amounts of money? I mean that the animation effect available to be seen with small numbers, but in very high numbers the animation beign much faster, for example only 2 or 3 seconds.
#17
Quote from: Snarky on Tue 04/05/2021 07:30:17
You also need to actually update the label. Something like this (assuming the label is called lblMoney):

Code: ags

int dispMoney, realMoney;

function repeatedly_execute_always()
{
  // ... (anything else you have in this function)

  if (dispMoney < realMoney)
    dispMoney++;
  else if (dispMoney > realMoney)
    dispMoney--;
  lblMoney.Text = String.Format("%d", dispMoney);
}


Hey snarky, I had already update the label. I found what the error was. I put the function to show the money on the label on repeatedly_execute and not on repeatedly_execute_always. Thank you very much

Now I just have to find how to do it not take so long to get to the new number and only take about 3 or 4 seconds for example
#18
Hey Gilbert thanks for the reply. I tried to do what you said but nothing happens, when I add money to the realmonie variable, dispmonie not only doesn't have the effect of increasing but it doesn't change the number either, I don't know why  :(

EDIT: I tried to put the script that you gave me in the repeatedly_execute only and it worked, I don't know why it didn't work in the always rep.
Anyway the effect works good but I notice that it takes too long to reach the new number. Is there a way to do it that only took a couple of seconds?
#19
Hello everybody. Today I was implementing a money system in my game. The int can already be seen in its respective Label GUI and I can add and subtract money from it, but I would like to know if there is a way when I add or remove money the numbers visually decrease or increase until the new value as many games do and how could it be done, since it would give more dynamism than just the new value suddenly appear.

I've been searching the forum but didn't find anything about it.

Thanks in advance
#20
Quote from: eri0o on Sun 02/05/2021 12:47:20
Hi WiseFrog!

Have you tried on your character, disabling the anti-glide? If you click the character on the AGS Editor, in the properties panel, look for the option MovementLinkedToAnimation and try setting it to false.

Also the character MovementSpeed and AnimationDelay have different meanings when MovementLinkedToAnimation is either true or false, so I would recommend still playing a bit with those values.

Also setting your game speed to 60 (ags defaults to 40) usually helps too.

Hi Eri0o. I did what you said and it works perfectly, now it's more fluid and the character doesn't make terrible jumps on the tapping walk. Thank you very much
SMF spam blocked by CleanTalk