Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Listing] GM 6.1 Registered-New Prob-Rising Darkness needs your help!  (Read 1148 times)

0 Members and 1 Guest are viewing this topic.

King Tetiro

Leader of Phoenix Heart
[Request / Listing] GM 6.1 Registered-New Prob-R...
« on: July 15, 2006, 03:08:32 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I need help. I haven't the faintest idea how to do a save game engine. I really need it. These are the files that will be the saved game files

File1
File2
File3

PLEASE! HELP! It must be easy to code in and is using the DRAG and DROP button code to do it (game_save(___)

If this can't be done, how can I make it save and load a game progress?


Code: [Select]
var load_name;
load_name = get_open_filename ('Savegames (*.sav)|*.sav','');
game_load (load_name);


I want it to AUTOMATICALLY load Start.sav. How do I do this?
« Last Edit: February 11, 2012, 01:47:26 pm by Niek »
Logged
  • Phoenix Heart

mit

Re: Please help! GM 6.1 Registered-Save Game pro...
« Reply #1 on: July 15, 2006, 10:38:41 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
If you just want to use the built in save engine in Game Maker but with three file slots, then
Quote from: Manual
game_save(string) Saves the game to the file with name string.
game_load(string) Loads the game from the file with name string.
should do you. So, for instance, you could have global.fileslot equal 1, 2 or 3, and when you load, do
Code: [Select]
game_load("save_file"+string(global.fileslot)+".sav")and to save it,
Code: [Select]
game_save("save_file"+string(global.fileslot)+".sav")So that would be save_file1.sav or whatever. You'd then make a menu to choose what global.fileslot needs to be, and you could use file_delete() and file_copy() with the same name to, err, copy and erase files.

If you wanted to do that with drag and drop, then just use the Save-the-game and Load-the-game icons, and put "save_file"+string(global.fileslot)+".sav" as the file name.


If you want to use your own method of saving, which usually uses a lot less memory, then you need to write down what you want. Let's say you want to store the current room, the number of lives, and the x and y position only. You could do this with INI files if you want, there are a few examples. Or, if you just want to do a very basic thing, then...

We'll make the files like this:
Quote
room
lives
x
y
Because each thing is on a new line, it'll be fairly easy to read and write. To write it, we just need to overwrite what's there.

So, in a delightful script:
Code: [Select]
//save_game_progress(string)
var id;
file_delete(argument0) //delete what's already in the file
id = file_text_open_write(argument0) //Open the file
file_text_write_string(id,string(room)) //So write the room
file_text_writeln(id) //Then a new line character
file_text_write_string(id,string(global.hearts)) //Then the lives, supposing you're using global.hearts
file_text_writeln(id)
file_text_write_string(id,string(x)) //Now the X
file_text_writeln(id)
file_text_write_string(id,string(y)) //and the y.
//Now close the file and end.
file_text_close(id)
return id;
and then to load it:
Code: [Select]
//load_game_progress(string)
var id;
id = file_text_open_read(argument0) //Open the file
room=real(file_text_read_string(id)) //So READ the room
file_text_readln(id) //Then a new line character
global.hearts=real(file_text_read_string(id)) //Now the hearts
file_text_readln(id)
x=real(file_text_read_string(id)) //and the x
file_text_readln(id)
y=real(file_text_read_string(id)) //and the y
file_text_close(id)
return id;
You could then use the above code, but with load_game_progress instead of game_load, and so on.

I'm fairly tired and may have just chatted nonsense for all that, if so, sorry >_>
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

King Tetiro

Leader of Phoenix Heart
Re: Please help! GM 6.1 Registered-New Prob-Risi...
« Reply #2 on: July 16, 2006, 06:20:23 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
var load_name;
load_name = get_open_filename ('Savegames (*.sav)|*.sav','');
game_load (load_name);

I want it to AUTOMATICALLY load Start.sav. How do I do this?
« Last Edit: July 16, 2006, 08:00:13 am by Laigonaz »
Logged
  • Phoenix Heart

Dayjo

shut the fuck up donny.
Re: GM 6.1 Registered-New Prob-Rising Darkness n...
« Reply #3 on: July 16, 2006, 08:25:10 am »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
game_load('Start.sav');

Should work (if it's in the same directory as the executable).
Logged
  • My Blog

King Tetiro

Leader of Phoenix Heart
Re: GM 6.1 Registered-New Prob-Rising Darkness n...
« Reply #4 on: July 16, 2006, 08:29:09 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I'll try it out.
Logged
  • Phoenix Heart
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.015 seconds with 60 queries.

anything