dMZX Forums: Save Player Position - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Save Player Position

#1 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 15 July 2007 - 07:12 PM

So, I am nearly done with my custom save implementation... (woo)... but what I was doing is use the "SAVE PLAYER POSITION 3" command, then saving the game. But it seems like when you reload the game, and then immediately "RESTORE PLAYER POSITION 3", it doesn't work, in 2.81g it teleports me back to the title screen. Does SAVE PLAYER POSITION after a reload (and exiting completely out of MZX, and restarting MZX) work?
Posted Image

Posted Image
0

#2 User is offline   Wervyn 

  • I can see you
  • Group: DigiStaff
  • Posts: 1,855
  • Joined: 24-December 00
  • Gender:Male
  • Location:Caras Galadhon

Posted 15 July 2007 - 07:51 PM

This appears to work under normal operations. That is, saved player positions don't get lost when you save the game, either with robotic or with the program itself. Here's a question, then, how are you saving the game? Are you doing it with "set "filename" "save_game"", or are you writing out counter values to a file? And if you're doing the first one, there'd be no reason to bother with saving and restoring the player position, since you'd just be saving the game itself.
If, as I suspect, you're saving the game by just exporting the counters, then obviously the restore player position won't work, since there's no way to store that information in a counter and set it back. You'll have to write your own code to manually save and load the player's position.

"A requiem, for the clever hacks of yesteryear."
To lie is to change the truth.
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.

-Wervyn
0

#3 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 15 July 2007 - 09:05 PM

I can't believe you actually expected MZX to backup the save player position slots somewhere so that they'd be retained even if you exited MZX completely.

Well, since you're so determined to make your life difficult all so you can make your game look slightly less like it was created in MZX (at least, to the people who don't know what MZX is), I'll give you a hint. There's a string called "board_name." Have fun.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#4 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 15 July 2007 - 11:07 PM

Exophase, on Jul 15 2007, 09:05 PM, said:

I can't believe you actually expected MZX to backup the save player position slots somewhere so that they'd be retained even if you exited MZX completely.

Well, since you're so determined to make your life difficult all so you can make your game look slightly less like it was created in MZX (at least, to the people who don't know what MZX is), I'll give you a hint. There's a string called "board_name." Have fun.

Wervyn - I'm actually doing the set "filename" "save_game" command...
Then when I have the player load the game (from my in-game status screen), i quickly call the "restore player position 3" command, to teleport to the last save point the player was on. In 2.81c, after you exit and restart MZX, then load, it'll teleport you to the board of the save point, but in position 0,0... in 2.81g, it teleports you to the title screen.

Exo - I'm not determined to make my life difficult, most of what I did was relatively easy and didn't take me long at all to implement. I just don't understand why you are constantly chewing me out for wanting to customize my game a bit?

I could probably do something manually, that'll give each save point their own ID and teleport player to that save point upon load, I just found it really curious that MZX doesn't save your position in its .sav files.
Posted Image

Posted Image
0

#5 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 15 July 2007 - 11:21 PM

djtiesto, on Jul 15 2007, 07:07 PM, said:

...MZX doesn't save your position in its .sav files.

Yes it does. What on Earth gave you the idea that it doesn't? Try hitting F9 and move around a bit and hit F10 while playing something. It does indeed save your position.

Why are you bothering trying to restore the player's position when it's saved in the .sav files, anyway?

EDIT: In fact, there are only two reasons "restore player position 3" would put you in any place other than where the player was when you did "save player position 3." You are either not ever actually saving the player's position to 3, or are not actually loading the .sav before you restore the player's position from 3. There's still no point in messing with saved player position slots anyway when you can just save the game while the player is at the save point and load the game later to put the player back at that same point.

This post has been edited by Guy: 15 July 2007 - 11:26 PM

0

#6 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 15 July 2007 - 11:49 PM

Guy, on Jul 15 2007, 11:21 PM, said:

djtiesto, on Jul 15 2007, 07:07 PM, said:

...MZX doesn't save your position in its .sav files.

Yes it does. What on Earth gave you the idea that it doesn't? Try hitting F9 and move around a bit and hit F10 while playing something. It does indeed save your position.

Why are you bothering trying to restore the player's position when it's saved in the .sav files, anyway?

EDIT: In fact, there are only two reasons "restore player position 3" would put you in any place other than where the player was when you did "save player position 3." You are either not ever actually saving the player's position to 3, or are not actually loading the .sav before you restore the player's position from 3. There's still no point in messing with saved player position slots anyway when you can just save the game while the player is at the save point and load the game later to put the player back at that same point.

The save points teleport the player to a special board that has a menu setup of the slots you can save your game in, like an RPG.
Posted Image

Posted Image
0

#7 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,262
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 15 July 2007 - 11:52 PM

make yourself a numbered list, in notepad, of all the points where the player can save. have the game, upon loading, read a byte which corresponds to one of them, and teleport you to the appropriate spot corresponding to the location number.

or save the board_name, playerx and playery to the file and just do one line of teleport code.

come on guys maybe he's practicing for when he works on a real game
Need a dispenser here.
0

#8 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 16 July 2007 - 12:03 AM

CJA, on Jul 15 2007, 11:52 PM, said:

come on guys maybe he's practicing for when he works on a real game

I'm taking a looooooooooooooooooooong break from game making once Keeks is done.
Posted Image

Posted Image
0

#9 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 16 July 2007 - 12:06 AM

If this is actually an MZX bug you have to be absolutely sure to reproduce a world that works in 2.81c and not in 2.81g. Then it'll be fixed.

I still don't really understand what you're getting at. You're saying that when the player loads a saved game you want them to teleport to the last save point they were on. Do you mean the last one they were on when they saved the game or when they load the game? I'm going to assume you mean the former because that's the only thing that makes sense. Restore player position SHOULD work, maybe someone broke something.

But as a workaround you can do:

set "$save_board" "board_name"
set "save_x" "playerx"
set "save_y" "playery"
teleport player "save_board" x y

Then in the reload code:

teleport player "&$save_board&" "save_x" "save_y"

I do hope you allow the player to save in most places too (although I'm pretty sure you won't)
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#10 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 16 July 2007 - 01:22 AM

Exophase, on Jul 16 2007, 12:06 AM, said:

If this is actually an MZX bug you have to be absolutely sure to reproduce a world that works in 2.81c and not in 2.81g. Then it'll be fixed.

I still don't really understand what you're getting at. You're saying that when the player loads a saved game you want them to teleport to the last save point they were on. Do you mean the last one they were on when they saved the game or when they load the game? I'm going to assume you mean the former because that's the only thing that makes sense. Restore player position SHOULD work, maybe someone broke something.

But as a workaround you can do:

set "$save_board" "board_name"
set "save_x" "playerx"
set "save_y" "playery"
teleport player "save_board" x y

Then in the reload code:

teleport player "&$save_board&" "save_x" "save_y"

I do hope you allow the player to save in most places too (although I'm pretty sure you won't)

There's like one or two save points per area... one in each town... kinda similar to what was in the demo. Did you think the save points in the demo were a bit too sporadic? I'm thinking of putting access to the save screen on the world map, as well. Saves restore all your HP/MP/etc as well.

Here is an example of my code, I really apologize for explaining it badly:

SavePt (when you step on a sensor):
end
:sensoron
lockplayer
. blah blah effects and sfx go here
move player SOUTH
save player position 3
teleport player "[SYSTEM] Data Management" 0 0
unlockplayer
end

Then in the "Data Management" screen
. blah blah, select the slot you wanna save in
set "savegame.sav" "SAVE_GAME"
end

Then, when you select "Load" from the main menu...
.blah blah, select the game you wanna load
set "LOAD_GAME" "savegame.sav"
restore player position 3
end

And I want that RESTORE PLAYER POSITION 3 command to teleport you to the save point you were at when you saved the game originally. But when I do a load, after quitting MZX, it'll restore me to the title screen in 2.81g. It's really strange.

But anyways, I'll probably do the thing with the board_name string, that sounds really good.
Posted Image

Posted Image
0

#11 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 16 July 2007 - 01:26 AM

djtiesto, on Jul 15 2007, 09:22 PM, said:

set "LOAD_GAME" "savegame.sav"

set "savegame.sav" "LOAD_GAME"

You realize that your problem could have been fixed by just reading the help manual, right?
0

#12 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 16 July 2007 - 01:34 AM

Guy, on Jul 16 2007, 01:26 AM, said:

djtiesto, on Jul 15 2007, 09:22 PM, said:

set "LOAD_GAME" "savegame.sav"

set "savegame.sav" "LOAD_GAME"

You realize that your problem could have been fixed by just reading the help manual, right?

Yeah, just changed this now, but it makes no difference.
Posted Image

Posted Image
0

#13 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 16 July 2007 - 02:24 AM

Doesn't anyone else notice something off here?

As soon as you load the game you will NOT be in that same robot, you will be in the context of the robot that did the save game. So that's where the restore player position should be.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#14 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 16 July 2007 - 06:25 AM

I think what dj wants it to have a save screen but when you load the game up he doesn't want it to show up on the save screen, instead he'd like to save a player position, save the game in a standard save file on the save screen, then when the player opens the save file he wants it to start with the player in the location where he saved, and not at the save screen.

The answer is simple, player positions ARE saved in the sav file... all you have to do is on the save screen have a robot that says

:"Justloaded"
restore player position #
end

That's it.

What this does is as soon as the game is opened and started from this position (a save file load) it executes that code (restore player position).

Once the load save file command is called, it DUMPS the previous data in favor of the new, you'll never get to that restore player position command if you put a load save game RIGHT BEFORE IT.

"think about the way things work not the way you'd like them too"

This post has been edited by Koji: 16 July 2007 - 06:32 AM

0

#15 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 16 July 2007 - 11:09 AM

Interesting, yeah that may be my problem. I have separate 'bots for both saving and loading games...

Oh yeah and for those curious as to why I'm putting custom systems like this - my aim with Kikan is to have it so I can hook up my brother's laptop to my TV, and after initially loading MZX up, use my brother's controller to play through the whole game from the comfort of my couch :(
Posted Image

Posted Image
0

#16 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 16 July 2007 - 12:49 PM

Not like you need more than one F3, F4, and enter mapped to a gamepad (in addition to the arrow keys) for normal saving...
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#17 User is offline   Pyro1588 

  • wojtek
  • PipPip
  • Group: Members
  • Posts: 145
  • Joined: 20-October 02
  • Gender:Male
  • Location:Minnesota

Posted 19 July 2007 - 01:07 AM

for what it's worth, i'd use the $board_name option instead of restore player position, if only for the fact that they don't involve a brief color fade in. i'm doing the same thing with a menu system and yeah, if you want an instant switch, definitely use teleport player.
<Tox> bah. I may as well give in and shop australia. D:
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
0

#18 User is offline   djtiesto 

  • SHOPPING PLEASE
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,660
  • Joined: 01-June 04
  • Gender:Male
  • Location:Long Island

Posted 19 July 2007 - 01:29 AM

Changed it all over to the $board_name and everything seems to be working in order now.
Posted Image

Posted Image
0

#19 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 19 July 2007 - 11:17 AM

oh I forgot about the fades :< blargh
0

#20 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 19 July 2007 - 11:56 AM

the only other thing is that the BOARD_NAME method requires all boards to be uniquely named. otherwise they are pretty much identical
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

8 User(s) are reading this topic
0 members, 8 guests, 0 anonymous users