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

#261
Hi Snarky,

Thanks so much for your response! I changed the general settings as you suggested which fixed the blinking issue. Much appreciated.

Changing the ZOrder on the floating label unfortunately did nothing, but I managed to fix it somehow by moving the code block from rep_exec to rep_exec_always. I have no idea what was blocking it before, but I'm not complaining.

Also, thanks for your code to simplify the timer -- it seems so simple reading it, but my brain goes to needlessly complicated logic before it goes to simple math.   :)    Also I didn't know about the automatic 0-padding which is awesome.

Thanks again for your help! You and the others who've helped me out here will get a mention in the acknowledgements for sure.


#262
Hey all. Wish I weren't posting for help again so soon after the last time, but here we are. :(

I have been testing out small blocks of code in a mostly empty default template game, and those block work perfectly there. Unfortunately, when I write the same code in my actual game, they don't work anymore.

Here are the issues, which I theorize are related because they both have to do with the custom inventory GUI:

1. I have a speech-based countdown timer running. In the test game it works perfectly. In my real game it causes the inventory GUI to flicker once per second as the timer counts down. I know it's the timer that causes it because when I remove the timer block, the blinking stops. There's no such behavior in the test game, however.

2. There's also a hovering text label that follows the cursor and gives the name of whatever inventory item is under the cursor. It runs perfectly in the test game. In the real game the hover text does not show up at all (the label is marked enabled, visible, and clickable in settings).


I have scanned the code multiple times trying to figure out what the discrepancy is. The settings for the inventory and hovertext GUIs are identical. The code itself, other than character names (cTimer vs. cRoger), inventory item names (iKey vs. iTest1) and GUI label numbers (Label1 vs. Label11), is also nearly identical. The timer is nested within an if statement in the real game (if dying == true), but removing that made no difference.

I then commented out every piece of the room script until I was left with only the relevant code, which still looks identical.

I am well and truly stumped. :(

I honesty can't find where the two rooms are significantly diverging, or what could be causing these issues. Many thanks and a place in the game credits for anyone who can help me solve this.

This is the room script where everything works perfectly:

Code: ags

// room script file

int min;
int sec;
String TimerText;
bool timeout;

function room_load()
{
  min = 2; //set number of minutes before timeout
  sec = 15; // set number of seconds before end of current minute
  timeout = false; //timer has not run out yet
    
  SetGameSpeed(40); // game loops per second
  
  SetTimer(1, 600);  // set minutes timer (seconds * 40) and whether initial minute expires in less than 59 seconds
  SetTimer(2, 40);  // set seconds timer
  
  cRoger.y = 100;
  
  cRoger.AddInventory(iCup);
  InvItemTotal ++;
  cRoger.AddInventory(iKey);
  InvItemTotal++;
}

function repeatedly_execute_always()
{
if (IsTimerExpired(1))                              //check minutes timer
  {
  min -=1;   // decrease counter by 1 minute
  SetTimer(1,  2360); //reset timer for another minute
  
    if (min == -1) // keep minutes from going below 0
    {
    min = 0;
    }
  }
  
  if (IsTimerExpired(2))   // check seconds timer
  {
    sec -=1;
    
    if (sec >=10)
    {
      TimerText = String.Format("%d:%d", min,  sec); // countdown from 60 to 10
      cRoger.SayBackground(TimerText);
      SetTimer(2,  40); //trigger next code block
    }
    else if (sec <10 && sec >-1)
    {
      TimerText = String.Format("%d:0%d", min,  sec);   // count from 9 to 0 and switch format from "9" to "09" etc.
      cRoger.SayBackground(TimerText);
      SetTimer(2,  40);
      if (sec == 0 && min == 0 && timeout == false)
      {
        sec +=1; // cancel out seconds countdown
        timeout = true; // time has run out
        SetTimer(3,  180); // how long to display final second of timer (0:00)
      }
      if (sec == 0 && min == 0 && timeout == true && IsTimerExpired(3) == false)
      {
        sec +=1;
      }
      
    }
    if (sec == -1 && timeout == false)
    {
    sec = 59;  // reset to keep seconds from counting into negative numbers and change format back to 2 digits
    TimerText = String.Format("%d:%d", min,  sec);
    cRoger.SayBackground(TimerText);
    SetTimer(2, 40);
    }
  }
  
}
function room_AfterFadeIn()
{

}

function oHandbag_AnyClick()
{
  if (gInventory.Visible == false)
    {
        gInventory.Visible = true;
        gInventory.Y = oHandbag.Y;
        gInventory.X = (oHandbag.X -1) - (InvItemTotal * 26);
    }
  else if (gInventory.Visible == true) 
      {
        gInventory.Visible = false ;
      }
}

function room_RepExec()
{
  InventoryItem *InvUnderMouse;
  InvUnderMouse = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);

  if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y) == null)
  {
    gInvLabel.Visible = false;
  }
  else
  {
    gInvLabel.Visible = true;
    gInvLabel.X = mouse.x;
    gInvLabel.Y = mouse.y - 20;
    Label1.Text = InvUnderMouse.Name;
  }
}



And this is the code from the room with problems:

Code: ags

// room script file
int min;
int sec;
String TimerText;
bool timeout;

function room_Load()
{
  Mouse.Mode = eModePointer;
  
  min = 1; //set number of minutes before timeout
  sec = 31; // set number of seconds before end of current minute
  timeout = false; //timer has not run out yet
    
  SetTimer(1, 1300);  // set minutes timer (seconds * 40) and whether initial minute expires in less than 59 seconds
  SetTimer(2, 40);  // set seconds timer
  
  cRoomController.AddInventory(iTest1);
  cRoomController.AddInventory(iTest2);
  cRoomController.AddInventory(iTest3);
  InvItemTotal +=3;
}

function repeatedly_execute_always()
{
 
  
    if (IsTimerExpired(1))                              //check minutes timer
    {
      min -=1;   // decrease counter by 1 minute
      SetTimer(1,  2360); //reset timer for another minute
  
      if (min == -1) // keep minutes from going below 0
      {
      min = 0;
      }
    }
  
    if (IsTimerExpired(2))   // check seconds timer
    {
      sec -=1;
    
      if (sec >=10)
      {
      TimerText = String.Format("%d:%d", min,  sec); // countdown from 60 to 10
      cTimer.SayBackground(TimerText);
      SetTimer(2,  40);
      }
      else if (sec <10 && sec >-1)
      {
        TimerText = String.Format("%d:0%d", min,  sec);   // count from 9 to 0 and switch format from "9" to "09" etc.
        cTimer.SayBackground(TimerText);
        SetTimer(2,  40);
      
        if (sec == 0 && min == 0 && timeout == false)
        {
          sec +=1; // cancel out seconds countdown
          timeout = true; // time has run out
          SetTimer(3,  180); // how long to display final second of timer (0:00)
          DisplayAtY(10, "Crap, what is... Feels like I'm falling.");
        }
        if (sec == 0 && min == 0 && timeout == true && IsTimerExpired(3) == false)
        {
        s  ec +=1;
        }
      
      }
      if (sec == -1 && timeout == false)
        {
        sec = 59;  // reset to keep seconds from counting into negative numbers 
        TimerText = String.Format("%d:%d", min,  sec);  //change format back to 2 digits
        cTimer.SayBackground(TimerText);
        SetTimer(2, 40);
        }
   
    }
  
}




function oHandbag_AnyClick()
{
  if (gInventory.Visible == false)
  {
    gInventory.Visible = true;
    gInventory.Y = oHandbag.Y;
    gInventory.X = (oHandbag.X -1) - (InvItemTotal * 28);
  }
  else if (gInventory.Visible == true) 
    {
      gInventory.Visible = false ;
    }
}

function room_RepExec()
{
  InventoryItem *InvUnderMouse;
  InvUnderMouse = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);

  if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y) == null)
  {
    gInvLabel.Visible = false;
  }
  else
  {
    gInvLabel.Visible = true;
    gInvLabel.X = mouse.x;
    gInvLabel.Y = mouse.y - 20;
    Label11.Text = InvUnderMouse.Name;
  }
}
  



What am I missing?  ???
#263
AGS Games in Production / Re: TUNNEL VISION
Tue 17/01/2023 18:10:44
ANOTHER UPDATE:

I've finished animating the opening cutscene! It was a ton of work, but very fulfilling to see it play through.

Here's a tiny piece of it (it's not embedding, so here's a link):

https://i.imgur.com/7joyiPw.mp4

It's nice to feel like I'm making progress.  :)

#264
Looks amazing. I love the premise, art, and atmosphere!
#265
Matti, thanks very much--I knew it must be something simple like that, and your fix worked perfectly.

And Khris, I appreciate the explanation--it's helpful to understand not just the structure of the code but what's going on "under the hood."

Thank you both for answering! Much gratitude.
#266
Hi scripters,

I know there are modules for countdown timers out there, but I wanted to see if I could script my own based on the background speech of an invisible character rather than a GUI. It seemed simpler, but evidently is not.

The problem is this: I can't get the countdown to update - it will display the initial value of the min and sec variables but never change. I've read the "string formatting" and "string.format" sections of the manual several times, and my "repeatedly_execute_always" function is running other things like looping animations perfectly well.

I have tried reordering the lines of code several different ways, and changing the frequency of updates to the timer (for example, updating only every 3 seconds), as well as substituting "if" statements for "while" statements. Nothing changes. I feel like I must be missing something obvious but cannot figure out what it is.

Any help would be hugely appreciated. Relevant code is below (I haven't coded what to do at 0 yet because this problem has gotten in the way):

Code: ags

int min;
int sec;
String TimerText;

function room_Load()
{
  min = 2;
  sec = 60;
  TimerText = String.Format("%d : %d", min,  sec);
  SetGameSpeed(40);        //40 loops = 1 second
  SetTimer(1, 2400);       //2400 = 40*60 = 60 seconds
  SetTimer(2, 40);         // 40 = 1 second
}

function repeatedly_execute_always()
{
  if (IsTimerExpired(1))
  {
    min -=1;
    SetTimer(1,  2400);
  }
  if (IsTimerExpired(2))
  {
    sec -=1;
    cTimer.SayBackground(TimerText);
    SetTimer(2,  40);
  }
}

#267
Hey all,

I already announced my current game in production before noticing this thread, but better late than never!

I have been writing fiction for over 15 years, got started in pixel art by drawing custom icons in Windows 3.1, and have steadily progressed as a musician from learning to play random folk songs into this past year more seriously composing music. I also took logic classes in college, so programming isn't a huge leap so far. Bringing all of these hobbies together in game dev has been awesome.

I'm having a lot of fun making my game, even when that means perusing old forum threads for the answers to basic problems (which I'm grateful I usually do find). I dabbled in AGS like 12 years ago and have wanted to get back into it ever since, so I'm excited to be here!
#268
My quick stab at a dump truck.

#269
Hey all,

I'm new here--I have a game in production, and I'm very grateful for how helpful you all are in the forums.

Yesterday I read this article on the Guardian about trying to design the next Wordle.

The game the author came up with is fun, and while it's not an adventure game, I think the discussion touches on fundamental aspects of game design and puzzle design that directly relate to making adventure games enjoyable yet challenging for the player. I found it useful for myself, at least.

Here it is for those interested:
https://www.theguardian.com/lifeandstyle/2022/dec/22/i-was-asked-to-invent-the-next-wordle-how-hard-could-it-be

Hope you enjoy!

--RootBound
#270
Happy release day! 4 years of development sounds like a journey--and the game looks extremely polished. A job well done.
#271
AGS Games in Production / Re: TUNNEL VISION
Tue 13/12/2022 00:22:02
Thanks for all the positive comments! It's definitely motivating.
#272
AGS Games in Production / Re: TUNNEL VISION
Mon 12/12/2022 19:49:22
Thank you so much! I've been working hard on the art, so that's very validating!  :-D
#273
UPDATE: RELEASING AUGUST 20! :)

Hello! I've been reading the forums and relearning AGS for a while now (I first played with it over a decade ago), but this is my first post here and will be my first completed game.

TUNNEL VISION is a first-person point-and-click adventure. You must stop a sabotaged runaway train from reaching the tunnel where a bomb lies. First, save the passengers, then save yourself--the clock is ticking! Yes, it's basically the movie SPEED on a train. I'm okay with that.

Features:

-A simple one-click interface
-1980s 4-color CGA-style pixel graphics
-5 puzzles to solve
-Original music
-As much story as I can cram into a game with 4 playable rooms.

I'm aiming for this to be a short game (probably playable in five minutes once you know all the puzzle solutions). I wanted to make something small and manageable enough to complete in a few months (provided the coding stage doesn't massively delay things--fingers crossed). I've been reading the AGS manual a lot and have been practicing the coding a bit already, though, so I'm hopeful.

Some images (not necessarily the final versions of graphics).







This project is still in early stages, but I've been making consistent progress.
On the whole this has been fun so far, and I plan to release the game as freeware given how short it is. I'm excited to keep you all updated. Thanks for reading!


[UPDATE Aug 10 2023]

Art: 100%
Music: 100%
Story and puzzle design: 100%
Coding: 100%

SMF spam blocked by CleanTalk