Recent posts

#1
Yes CreateOverlayText is a custom function, to create text with a coloured edge:

Code: ags
//outlined text overlay 
Overlay* CreateOverlayText(int x, int y, int width, FontType font, int color, int bgColor, String text) {
  int border = 2;
  textOverlay = DynamicSprite.Create(width + border * 2, GetTextHeight(text, font, width) + border * 2);
  DrawingSurface* ds = textOverlay.GetDrawingSurface();
  ds.Clear(COLOR_TRANSPARENT);  // background color
  ds.DrawingColor = bgColor;
  ds.DrawStringWrapped(border, border, width, font, eAlignLeft, text);
  ds.DrawStringWrapped(-border, border, width, font, eAlignLeft, text);
  ds.DrawStringWrapped(border, -border, width, font, eAlignLeft, text);
  ds.DrawStringWrapped(-border, -border, width, font, eAlignLeft, text);
  ds.DrawingColor = color;
  ds.DrawStringWrapped(0, 0, width, font, eAlignLeft, text);
  ds.Release();
  return Overlay.CreateGraphical(x, y, textOverlay.Graphic, true);
}

Any idea why this subject is failing with the above error?

#2
Advanced Technical Forum / Re: My game crashed
Last post by Marion - Today at 07:25:49
Only one view, I don't use any, only unanimated objects.
The game crashed only when I tried to reach one room, it works well when I go to the other rooms.
I have re-made the exact same room, same sprites, same code, and it works. Total mystery...
#3
I have a lot of trouble with dialogue trees. Mine usually wind up forcing the folks playing the game to click-click-click their way through the options offered, and almost always force them to do it from top down to make any sense. It's the way the story lays out in my mind.

I was having a problem with the mechanics of the dialogue and went to Densming's AGS tutorial to refresh my memory on a couple of things. Again, I was looking at the mechanics and not the structure. The tutorial explained how Densming laid out his tree. Okay, it made sense, until Sammy asked Donatello his age. Now I haven't played the game Densming made for his tutorials, but I'm curious to know if Donatello's age had any relevance to the story line. Or was it just fluff, thrown in to give the folks playing the game something to click? Something that made it appear interactive.

I never seem able to subdivide my dialogues into neat packages. That's not the way my muse reveals the story to me. I don't think it's fair, or enjoyable, to force the folks playing my game to do all that clicking, when they could grab a pop and a bag of popcorn, sit back, and watch the "movie."

I guess what I'm asking for is some insights into how you folks manage to make a dialogue tree interactive while advancing the story at the same time.
#4
For voiced speech, you could test whether Speech.DisplayPostTimeMs does the trick. Otherwise you'll need to add some padding to the voice clip.
#5
Thank you Khris that worked. A combination of making the objects a little smaller and playing around with these settings marked in red circle did the trick.



#6
There is a function called TintScreen that should affect the background, but it is pretty limited. As I mentioned, the (demo game for the) module I linked has an example of room tinting, using a non-interactive GUI.
#7
Oh did you do this Arjon?! I was only admiring it elsewhere on the web the other day.
#8
So the top of the main script should look something like this:

Code: ags
// game starts at 10:00 on day 1
int _minutes = 600;
int _day = 1;
TimeOfDay _timeOfDay = eTODMorning;

void UpdateScreen() {
  // tint screen, update label etc.
}

void TimePasses(int minutes) {
  _minutes += minutes; 
  // if end of day was reached
  if (_minutes >= 1440) {
    _minutes -= 1440;
    _day++;
  }
  TimeOfDay now = ((_minutes + 240) / 360) % 4;
  if (now != _timeOfDay) {
    _timeOfDay = now;
    UpdateScreen();
  }
}

#9
You must make a copy of original background when you enter the room and save it in a DynamicSprite variable for using in drawing, because next time you call "DynamicSprite.CreateFromBackground" it will return a already modified background.

Another thing: your drawing code repeats same action every game frame, so long as the time is in certain range of hours. That's very inefficient. Instead, do that once the time reaches certain checkpoint, and dont do anything until the next checkpoint.
#10
Quote from: Crimson Wizard on Today at 00:33:49
Quote from: GildedSpaceHydra on Today at 00:23:18I can't seem to figure out a way to tint the room background with script.  Is there something I'm missing?

AmbientTint is not applied to the background for some reason.

If you want to apply a shading effect to the whole room, including objects and characters in that room, then create a screen-sized GUI, give it certain background color, and assign non-zero transparency.

If you want to apply a shading effect only to the room background, then create a DynamicSprite from the original room background, tint that sprite, and draw onto the room bg. The DynamicSprites and drawing is explained in these articles:
https://adventuregamestudio.github.io/ags-manual/DynamicSprite.html
https://adventuregamestudio.github.io/ags-manual/DrawingSurface.html

EDIT:
Or you may draw a whole new room background for the night time, add it as a second background to your room, and switch when necessary:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Room.html#setbackgroundframe
Actually, I think that's the best solution, as then you may also include different lighting, shadows, and other time related changes.

Thanks!  I'm attempting the DynamicSprite method now.  Unfortunately, it's turning my background solid black so I'm clearly doing something wrong.  I'll keep reading about how DynamicSprite and DrawingSurface work to see if I can figure out what I'm doing wrong here.

SCRIPT:
Code: ags
// new module script

// game starts at 10:00 on day 1
int _minutes = 600;
export _minutes;
int _day = 1;

// background tint stuff
DynamicSprite* bgSprite;
DrawingSurface *bgSurface;

void TimePasses(int minutes) {
  _minutes += minutes; 
  // if end of day was reached
  if (_minutes >= 1440) {
    _minutes -= 1440;
    _day++;
  }
}

int _frames;
function repeatedly_execute() {
    //Display("Repeatedly exceute.");  
  
    // display time on label
    int hours = _minutes / 60;
    int minutes = _minutes % 60;
    lblTime.Text = String.Format("%02d:%02d", hours, minutes);
    //Display("Displaying time on label.");
  
   
    // increase by one
    _frames++;
    //Display("Frame increased.");
  
    // if a minute of IRL time has passed
    if (_frames >= GetGameSpeed() * 60) {
      _frames -= GetGameSpeed() * 60;
      TimePasses(MINUTES_PER_MINUTE); // advance game time
      Display("Time passes.");
    
      // display time on label
      //int hours = _minutes / 60;
      //int minutes = _minutes % 60;
      lblTime.Text = String.Format("%02d:%02d", hours, minutes);
      //Display("Displaying time on label.");

    }
    
    // set Time Of Day
    if ((hours >= 4) && (hours <= 9)) {
      //TimeOfDay = eTODMorning;
      lblTimeOfDay.Text = String.Format("Day %d: Morning",  _day);
      //Tint characters & objects
      SetAmbientTint(64, 64, 0, 50, 75);
      //Tint room background
      bgSprite = DynamicSprite.CreateFromBackground(GetBackgroundFrame());
      bgSprite.Tint(64, 64, 0, 50, 75);
      bgSurface = Room.GetDrawingSurfaceForBackground();
      bgSurface.DrawImage(0, 0, bgSprite.Graphic);
      bgSurface.Release();
      bgSprite.Delete();
    }
    else if ((hours >= 10) && (hours <= 15)) {
      //TimeOfDay = eTODMidday;
      lblTimeOfDay.Text = String.Format("Day %d: Mid-Day",  _day);
      //Tint characters & objects
      SetAmbientTint(0, 0, 0, 0, 100);
      //Tiny room background
      bgSprite = DynamicSprite.CreateFromBackground(GetBackgroundFrame());
      bgSprite.Tint(0, 0, 0, 0, 100);
      bgSurface = Room.GetDrawingSurfaceForBackground();
      bgSurface.DrawImage(0, 0, bgSprite.Graphic);
      bgSurface.Release();
      bgSprite.Delete();
    }
    else if ((hours >= 16) && (hours <= 21)) {
      //TimeOfDay = eTODEvening;
      lblTimeOfDay.Text = String.Format("Day %d: Evening",  _day);
      //Tint characters & objects
      SetAmbientTint(0, 0, 128, 50, 75);
      //Tint room background
      bgSprite = DynamicSprite.CreateFromBackground(GetBackgroundFrame());
      bgSprite.Tint(0, 0, 128, 50, 75);
      bgSurface = Room.GetDrawingSurfaceForBackground();
      bgSurface.DrawImage(0, 0, bgSprite.Graphic);
      bgSurface.Release();
      bgSprite.Delete();
    }
    else {
      //TimeOfDay = eTODNight;
      lblTimeOfDay.Text = String.Format("Day %d: Night",  _day);
      //Tint characters & objects
      SetAmbientTint(0, 0, 128, 75, 50);
      //Tint room background
      bgSprite = DynamicSprite.CreateFromBackground(GetBackgroundFrame());
      bgSprite.Tint(0, 0, 128, 75, 50);
      // Now copy it back to the background
      bgSurface = Room.GetDrawingSurfaceForBackground();
      bgSurface.DrawImage(0, 0, bgSprite.Graphic);
      // Clean up
      bgSurface.Release();
      bgSprite.Delete();
    }

}
SMF spam blocked by CleanTalk