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

#81
Since I have separate guis for Save & Load (or restore) can I do something like this for the restore button? I think it makes more sense to see a screenshot of the save you want to restore.  This seems to be working but I had to comment out the first line because there is no txtNewRestoreName.Text like there is for the save. Is it ok to leave this out?

Code: ags
function lstRestoreGamesList_OnSelectionChanged(GUIControl *control)
{
 // txtNewRestoreName.Text = lstRestoreGamesList.Items[lstRestoreGamesList.SelectedIndex];
  int slot = lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex];
  buttonSprite = DynamicSprite.CreateFromSaveGame(slot, btnScrshotR.Width, btnScrshotR.Height); 
  if (buttonSprite != null) {
      btnScrshotR.NormalGraphic = buttonSprite.Graphic; }
}
#82
Perfect, thank you I'll check this out.
#83
That works perfect for removing the gui on the screenshot. 

I notice that if I save with a screenshot, for example, Dom at letter (see example), then I play some more and save again, Dom at front of house. When I come into Save again, the screenshot displays the last screen that was selected/highlighted on the gui as opposed to the last save.  So anytime I am in the Save function, it will always show the screenshot of the last item I highlighted in the gui. Should it be working like this?
#84
Thank you.  Ok, I downloaded the script, imported it and created a room and a gui gCredits. When I try to run the room I get this error.
Error (line 11): Undefined token "Credits" Here is my room script:
Code: ags
// room script file

bool credits_running;

function room_Load()
{
{
  int yellow = Game.GetColorFromRGB(255, 255, 0);
  int white = Game.GetColorFromRGB(255, 255, 255);
  
  Credits.SetFont(eFontFont0, 15); // font, line height
  Credits.SetColor(white); // default text color
  Credits.SetShadow(17, 1, 1); // color, offsetX, offsetY
  Credits.SetWidth(200); // total width of credits text
  Credits.SetDelay(1, -5); // 1 pixel per frame, 5 pixels per frame when mouse is held down

  Credits.AddLine("Made with", eAlignCenter, 0, yellow);
  Credits.AddLine("Adventure Game Studio");
  Credits.AddSpace();
  Credits.AddLine("Special Thanks To", eAlignCenter, 0, yellow); // yellow text
  Credits.AddLine("Alice", eAlignLeft);
  Credits.AddLine("Bob", eAlignRight, -1); // offset -1: add text to previous line
  Credits.AddLine("Charles", eAlignLeft);
  Credits.AddLine("Dick", eAlignRight, -1);
  Credits.AddLine("Eddie");
  Credits.AddSpace(50); // add gap of 50 pixels
  Credits.AddLine("THE END");
}

DynamicSprite* credits; // create pointer

void StartCredits() {
  credits_running = true; // set flag for room_RepExec
  gCredits.Visible = true; // show GUI
  credits = Credits.Tick(); // run first update to get sprite
  //gCredits.BackgroundGraphic = credits.Graphic; // set GUI background
}

void CreditsEnded() {
  gCredits.Visible = false; // hide GUI
  credits.Delete(); // clean up
  credits_running = false; // reset flag
  QuitGame(0); // or go to main menu
}

void DoCredits() {
  Credits.Tick(); // advance credits display
  if (Credits.Done()) CreditsEnded(); // credits have finished
}
}

function room_RepExec()

{
  if (credits_running) DoCredits();
}

void on_key_press(eKeyCode k) {
  if (k == eKeySpace) StartCredits();
}
#85
Hi, that code definitely corrected the size of the screenshot. 

I am seeing the Save Gui showing up in the screenshot. How do I eliminate that?

Also, the screenshot shows that you can save with a blank name. (Not sure if this really matters)

#86
The link for the module goes to a funny looking download page.  Is this correct? Just want to make sure before I download.
#87
Hi, Ok, I got this working, sort of.  The screenshot that displays is the correct room but it is filling up the whole area where the buttons are.  So I can't use the Save, Delete, or Cancel buttons. 
#88
Is there a current Scrolling Credits Module? I found a few listed in the forum but with old dates on them so I would like advice on which one to use.
#89
I checked both global scripts and do not find any verbiage using buttonsprite in either, other than what is shown above.
Can you show me how to code this check so player would not get an "array index out of bounds" exception if nothing is selected in the listbox?
#90
I've included the code for Saving and Restoring.  The error message I am getting on "DynamicSprite *buttonSprite;" is Attributes of identifier do not match prototype

Code: ags
//=============================================================================
// SAVE / LOAD DIALOGS
//=============================================================================

int find_save_slot(String name)
{
  bool slots[] = new bool[999];
  int slots_used = 0;

  // record which slots are occupied already, 
  // if the types save name matches any existing one, then use that
  for (int i = 0; i < lstSaveGamesList.ItemCount; i++)
  {
    if (lstSaveGamesList.Items[i] == name)
    {
      // found existing save with matching name
      return lstSaveGamesList.SaveGameSlots[i];
    }

    // remember which slots are already taken
    slots[lstSaveGamesList.SaveGameSlots[i]] = true;
    slots_used++;
  }
  
  // current version of AGS has a limit of 50 save slots
  // that may be displayed in the ListBox at the same time
  if (slots_used >= 50)
  {
    return -1;
  }

  // find first free save slot, starting with slot 1 (for "cosmetic" purposes)
  for (int i = 1; i < 999; i++)
  {
    if (!slots[i])
    {
      return i;
    }
  }

  // no free slots found
  return -1;
}

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = find_save_slot(txtNewSaveName.Text);

  if (gameSlotToSaveInto < 0)
  {
    Display("Save slots limit of 50 is reached, delete some of the existing saves first!");
  }
  else
  {
    SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
    close_owning_gui(control);
  }
}
function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
  if (lstRestoreGamesList.SelectedIndex >= 0)
  {
    RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
  }

  close_owning_gui(control);
}
DynamicSprite *buttonSprite;

function lstSaveGamesList_OnSelectionChanged(GUIControl *control)
{
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
  buttonSprite = DynamicSprite.CreateFromSaveGame(1, 78, 78);
  if (buttonSprite != null) {
    btnScrnshot.NormalGraphic = buttonSprite.Graphic; }
}

function lstSaveGamesList_OnSelectionCh(GUIControl *control)
{
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
}

function txtNewSaveName_OnActivate(GUIControl *control)
{
  // pressing Return in the text box simulates clicking the save button
  btnSaveGame_OnClick(control, eMouseLeft);
}

function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
  if (lstSaveGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
    lstSaveGamesList.FillSaveGameList();
  }
}

function gReset_OnClick(GUI *theGui, MouseButton button)
{
SetGlobalInt(420,1);
}
#91
I uderstand the button on the gui and adding this code to the OnSelectionChanged event handler. But where do I add the code where it reads "at the top of the script outside event functions"  Does this mean the global script?  If so I added at the top and I get an error.

Code: ags
// at top of script, outside event functions
DynamicSprite *buttonSprite;

// inside an event function
buttonSprite = DynamicSprite.CreateFromSaveGame(1, 50, 50);
if (buttonSprite != null) {
    btnScrnshot.NormalGraphic = buttonSprite.Graphic;
}

Secondly where do I put this code for the Saved Game Slots:
Code: ags
int index = lstSaveGames.SelectedIndex;
RestoreGameSlot(lstSaveGames.SaveGameSlots[index]);

Just a little confused how to piece this all together.
#92
Quote from: Eon_Star on Sat 10/08/2024 01:07:55Hello.

I used a mod and made a tutorial regarding the subject. You may take a look:

https://www.youtube.com/watch?v=oeQ0biGxVyY&list=PLdlsMVDmowzSkFXAwnV_dOXjrSqYsjU15&index=41

I hope to be of help.

 :-D

Do you have the code, only to plop the screenshot into a place on a Save or Restore Gui? Here are both guis I am referring to.  Early stages with no graphics yet. The screenshot would be above the buttons.

#93
This is wonderful!  I came upon it too late though.  How unfortunate for me.
#95
Can you tell me where "lstSaveGamesList.FillSaveGameList" is being initialized?  I am getting an Undefined token '1stSaveGamesList'

Also, should I be clicking on the link (BASS, Sierra, Verb Coin: updated find_save_slot(), fix going over limit) and use that code?

Code: ags
Sierra-style/function show_save_game_dialog()
{
  // get the list of save games
  lstSaveGamesList.FillSaveGameList();
  if (lstSaveGamesList.ItemCount > 0)
  {
    // if there is at least one, set the default text
    // to be the first game's name
    txtNewSaveName.Text = lstSaveGamesList.Items[0];
  }
  else
  {
    // no save games yet, so default to empty text
    txtNewSaveName.Text = "";
  }
  open_gui(gSaveGame);
}
function show_restore_game_dialog()
{
  lstRestoreGamesList.FillSaveGameList();
  open_gui(gRestoreGame);
}
#96
Very good, that's what I am needing.
#97
I am referencing the windows that are called using SaveGameDialog()/RestoreGameDialog()
See attached image - When clicking on the buttons they will execute the above, which pulls up a gray box and that's what I would like to replace and also would like to see the code to replicate saving, loading, etc.
https://mysterymanor.net/images/samples/Interface.png
#98
Is there a way to customize the default Load/Save window with different colors and font?  Also, were does it reside?  I can't find code for it.
#99
Thank you, Kris. This worked perfectly!
#100
I have gui's for all my characters and the gui stays on the screen with text until it is clicked and then the gui goes away.  I created a non character gui with a label for text and made the gui pause game when shown and clickable but it doesn't work if it is clicked on. I have to put a "wait" in between to even see it. so I have to do a gui.enabled true - a wait - then a guu.enabled = false. What do I need to have the gui stay on the screen and wait for the player to click on it?
SMF spam blocked by CleanTalk