Limiting undo command
tbritton
21 Nov 2013, 19:16I've searched the forum and wiki on this topic and have not found anything to point me in the right direction. My issue is that I would like to limit the amount of undo's to 1. The game has been designed so there's no reason for a player to go back five turns. One should be sufficient.
At the same time would it make sense to limit the logger to only keep track of one turn? Any performance advantage to doing that?
At the same time would it make sense to limit the logger to only keep track of one turn? Any performance advantage to doing that?
Liam315
22 Nov 2013, 01:05Second part first. The only performance advantage to limiting the screen to only display the last turn would be in the loading of saved games. In my opinion though this would be far outweighed by the frustration of not being able to see the last few commands that you have tried. Being able to see what you've just done, having the room description remain on the screen, etc. are very helpful when exploring new areas.
As for limiting the undo command, it should be possible but the only way I can think of to make it work is more trouble than it's worth. If there is no real reason for a player to undo their turns, then what does it matter if the ability to undo 5 of them exists?
If you still want to do it though, I'd edit the undo command to something like this:
The tricky part is how to unset the flag. You could just run a turn script that says after x turns unset the flag, but just continuing to type "undo" would get past that limit it and the player could undo multiple turns anyway. This is because an unrecognized command still counts as a turn. A better solution would be to put a script to unset the flag in another of the default functions; in such a place where the flag is only unset when the command is not another attempt to undo or an unrecognized command. Finding the appropriate spot though might require a bit of trial and error, like I said, not really worth the effort.
As for limiting the undo command, it should be possible but the only way I can think of to make it work is more trouble than it's worth. If there is no real reason for a player to undo their turns, then what does it matter if the ability to undo 5 of them exists?
If you still want to do it though, I'd edit the undo command to something like this:
if (GetBoolean(player, "undo")) {
msg ("One undo is sufficient.")
}
else {
undo
SetObjectFlagOn (player, "undo")
}
The tricky part is how to unset the flag. You could just run a turn script that says after x turns unset the flag, but just continuing to type "undo" would get past that limit it and the player could undo multiple turns anyway. This is because an unrecognized command still counts as a turn. A better solution would be to put a script to unset the flag in another of the default functions; in such a place where the flag is only unset when the command is not another attempt to undo or an unrecognized command. Finding the appropriate spot though might require a bit of trial and error, like I said, not really worth the effort.
tbritton
22 Nov 2013, 18:23As for limiting the undo command, it should be possible but the only way I can think of to make it work is more trouble than it's worth. If there is no real reason for a player to undo their turns, then what does it matter if the ability to undo 5 of them exists?
Hey Liam, thanks for the response. My thought was that people would be more willing to try different things if they knew they could undo their action. Your comment made me realize I'm over-thinking this and should probably just leave well enough alone.