This is even better yet. Thank you!!!
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 Menufunction 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; }
}
// 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();
}
//=============================================================================
// 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);
}
// 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;
}
int index = lstSaveGames.SelectedIndex;
RestoreGameSlot(lstSaveGames.SaveGameSlots[index]);
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.037 seconds with 14 queries.