Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Order of saved games  (Read 3878 times)

0 Members and 1 Guest are viewing this topic.

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Order of saved games
« on: July 29, 2007, 11:59:20 PM »

In the load/save windows, is there an easy way to place the latest save ABOVE previous ones rather than below all previous ones?

Thanks!

Mikael
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Order of saved games
« Reply #1 on: July 30, 2007, 09:53:31 AM »

You'd need to modify the save.script file (especially the setstate function). It should be relatively easy (I already did it for my game although I use thumbnail images).
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Re: Order of saved games
« Reply #2 on: July 30, 2007, 04:00:27 PM »

Hmm ... that's what I thought. But to be honest, I don't even have a clue where to begin. All I really want to do is to reverse the order in which the savegames are displayed in the saving and loading windows.
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Order of saved games
« Reply #3 on: July 30, 2007, 06:21:41 PM »

this is not true as you want to have probably one <new savegame> and the rest existing. Am I right?

Anyway my save works like this:

save.script

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

self.xResult = false;

var NumSlotButtons = 6;
var NumSavegames = 100;
var ScrollOffset = 0;
var SelectedSlot = -1;
var toLoad;
var validGames;
var totalGames = 1;

self.xResult = true;

for (var al = 0; al < 100; al=al+1)
{
   if (Game.IsSaveSlotUsed(al))
   {
    validGames[totalGames] = al;
    totalGames = totalGames + 1;
   }
}

 validGames[0] = totalGames;

SetState();

////////////////////////////////////////////////////////////////////////////////
on "close"
{
  self.Close();
}

////////////////////////////////////////////////////////////////////////////////
on "up"
{
  for(var i=0; i<NumSlotButtons; i=i+1)
  {
    var SlotButton = this.GetControl("d"+i);
    var Thumbnail = this.GetControl("i"+i);
    SlotButton.Visible = false;
      Thumbnail.Visible = false;
  }

  ScrollOffset = ScrollOffset - 6;
  SetState();
}

////////////////////////////////////////////////////////////////////////////////
on "down"
{

  for(var i=0; i<NumSlotButtons; i=i+1)
  {
    var SlotButton = this.GetControl("d"+i);
    var Thumbnail = this.GetControl("i"+i);
    SlotButton.Visible = false;
      Thumbnail.Visible = false;
  }

  ScrollOffset = ScrollOffset + 6;
  SetState();
}


////////////////////////////////////////////////////////////////////////////////
on "save"
{
  if(SelectedSlot >= 0)
  {
  var saver;
saver = validGames[SelectedSlot];


    var WinName = Game.LoadWindow("interface\system\savename.window");
    if(Game.IsSaveSlotUsed(saver))
    {
      WinName.xDescription = Game.GetSaveSlotDescription(saver);
    }

    WinName.Center();
    WinName.GoSystemExclusive();
    if(WinName.xResult==true)
    {
GameLoaded = true; //Ulozime si resume ;-)
      self.xResult = true;
SavingNow = true;
SavingSlot = saver;
SavingDescription = WinName.xDescription;
     
      GameLoaded = false;
    }
    else
      self.xResult = false;

    Game.UnloadObject(WinName);

    if(self.xResult) self.Close();
    var w = Scene.GetNode("ResumeGame");
    w.ApplyEvent("LeftClick");
   
  }
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  var button;

  if(Keyboard.KeyCode==VK_ESCAPE){
    button = self.GetWidget("close");
    button.Press();
  }
}

////////////////////////////////////////////////////////////////////////////////
function SetState()
{
  var BtnUp = self.GetControl("up");
  var BtnDown = self.GetControl("down");
  var BtnLoad = self.GetControl("save");
 
   
  BtnUp.Visible = (ScrollOffset > 0);
  BtnDown.Visible = (ScrollOffset+NumSlotButtons < totalGames);
  BtnLoad.Visible = false;
   
var SlotButton = this.GetControl("d0");
var Thumbnail = this.GetControl("i0");
SlotButton.Visible = true;
Thumbnail.Visible = true;
   
SlotButton.Text = "<New Savegame>";   
Thumbnail.Image = "null";   
   
  for(var i=0; i<NumSlotButtons; i=i+1)
  {
var q = ScrollOffset + i;

if (q == totalGames) return;

       var SaveSlot = ScrollOffset + i;
SlotButton = this.GetControl("d"+ i );
   
Thumbnail = this.GetControl("i"+ i );
       
  Thumbnail.SetCursor("sprites\system\active.sprite");

if (q != 0)
{
SlotButton.Text = Game.GetSaveSlotDescription(validGames[q]);
    SlotButton.Disabled = false;
      Thumbnail.SetImage("savegame:" + validGames[q]);
}
else
{
SlotButton.Text = "<New savegame>";
    SlotButton.Disabled = false;
      Thumbnail.SetImage(null);
}
      SlotButton.Visible = true;
      Thumbnail.Visible = true;
  }

}


on "i0"
{
  SelectedSlot = ScrollOffset;
  SetState();
  this.ApplyEvent("save");
}

on "i1"
{
  SelectedSlot = ScrollOffset+1;
  SetState();
    this.ApplyEvent("save");
}
on "i2"
{
  SelectedSlot = ScrollOffset+2;
  SetState();
    this.ApplyEvent("save");
}
on "i3"
{
  SelectedSlot = ScrollOffset+3;
  SetState();
    this.ApplyEvent("save");
}
on "i4"
{
  SelectedSlot = ScrollOffset+4;
  SetState();
   this.ApplyEvent("save");
}
on "i5"
{
  SelectedSlot = ScrollOffset+5;
  SetState();
   this.ApplyEvent("save");
}

save.window
Code: [Select]
WINDOW
{
  X = 0
  Y= 0
  WIDTH = 1024
  HEIGHT = 768
  NAME = "save"

  IMAGE = "windows\loadsave\save_window.jpg"
  FONT = "fonts\verdana2.font"
  SCRIPT = "interface\system\save.script"
 
;----- save slot buttons -----


  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i0"
    TEXT = ""
    X = 209
    Y = 157
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
}

  STATIC
  {
    NAME = "d0"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 181
    ;  - 28
    Y = 257
    ; + 100
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }

  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i1"
    TEXT = ""
    X = 409
    Y = 157
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
  }

  STATIC
  {
    NAME = "d1"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 381
    Y = 257
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }


  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i2"
    TEXT = ""
    X = 209
    Y = 327
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
  }

  STATIC
  {
    NAME = "d2"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 181
    Y = 427
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }



BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i3"
    TEXT = ""
    X = 409
    Y = 327
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
  }

  STATIC
  {
    NAME = "d3"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 381
    Y = 427
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }

  BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i4"
    TEXT = ""
    X = 209
    Y = 497
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
  }

  STATIC
  {
    NAME = "d4"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 181
    Y = 597
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }



BUTTON
  {
    TEMPLATE = "ui_elements\template\but.button"
    NAME = "i5"
    TEXT = ""
    X = 409
    Y = 497
    WIDTH = 120
    HEIGHT = 100
    PRESSED = TRUE
    PARENT_NOTIFY = TRUE
    VISIBLE = FALSE
  }

  STATIC
  {
    NAME = "d5"
    TEXT = ""
    TEXT_ALIGN = "center"
    FONT = "fonts\verdana5.font"
    X = 381
    Y = 597
    WIDTH = 176
    HEIGHT = 20
    VISIBLE = FALSE
  }


;----- scroll buttons -----
  BUTTON
  {
    IMAGE  = "windows\loadsave\arrow_down.png"
   PARENT_NOTIFY = TRUE

    NAME = "down"
 
    X = 649
    Y = 484
    WIDTH = 64
    HEIGHT = 179
  }

  BUTTON
  {
    PARENT_NOTIFY = TRUE
    NAME = "up"
    IMAGE  = "windows\loadsave\arrow_up.png"
    X = 649
    Y = 144
    WIDTH = 64
    HEIGHT = 179
  }

;----- load/cancel buttons -----
  BUTTON
  {
    IMAGE  = "windows\loadsave\save.png"
    PARENT_NOTIFY = TRUE

    NAME = "save"
    X = 778
    Y = 146
    WIDTH = 143
    HEIGHT = 189
  }

BUTTON
  {
    IMAGE  = "windows\loadsave\back.png"
    PARENT_NOTIFY = TRUE

    NAME = "close"
    X = 778
    Y = 553
    WIDTH = 143
    HEIGHT = 189
  }


}

For inspiration. In game it looks like this:

http://www.ghostinthesheet.com/wme/save.jpg


Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Order of saved games
« Reply #4 on: July 30, 2007, 06:46:35 PM »

Well I tried to modify the save/load scripts from WME demo to get the reversed sorting. It's a little hacked together, but it seems to work. http://dead-code.org/download/saveload_reversed.zip
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Re: Order of saved games
« Reply #5 on: July 30, 2007, 07:27:14 PM »

I'm very happy now. Your modification seems to work 100%, Mnemonic. That was exactly what I meant. Metamorphium, thanks for the example, but you misunderstood me slightly, which no doubt was due to me being quite ambiguous in my first post, I can see now. What I was after was a complete reversion of the display of saves and loads. In my game, you can see 10 slots without scrolling. I know that some players like to make lots of saves, and since you always have to scroll to the last slot in the original version, that will be a LOT of scrolling for a player with let's say 30 saves, and that likes to save often. (see jpeg).

http://www.mdna-games.com/save.jpg

I also have a modest proposition that the reversed display of saves/loads should be implemented in the WME demo, since it is by far the mot common (and by far most practical) way to display saves/loads in adventure games.

Once again, thanks a lot, you're an invaluable help.

Mikael
Logged
 

Page created in 0.046 seconds with 23 queries.