Force undo command
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
-
- Posts: 2
- Joined: August 5th, 2010, 8:43 am
Force undo command
Just a simple little idea which I hope would be easy to implement. A force undo for debug mode would save a lot of bother with recruiting the wrong unit and misclicks in shroud, which I seem to do constantly.
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: Force undo command
What exactly would that accomplish? You can manually do just about anything in debug that this would accomplish (grant more moves, change a unit's side and set hitpoints to 1 then grant attacks_left to another unit and kill the first unit, actually, i have a command that kills units when I debug in my campaign, so i don't even need to do this). Sure, it's not as easy as pressing u, but it's not that much trouble either.
-
- Posts: 2
- Joined: August 5th, 2010, 8:43 am
Re: Force undo command
As you say, it would be a timesaver. There's already redundancy in the commands; :unit advances, for example, can also be replicated in a roundabout way.
- Simons Mith
- Posts: 821
- Joined: January 27th, 2005, 10:46 pm
- Location: Twickenham
- Contact:
Re: Force undo command
In order to provide a reliable undo, the game would have to be able to restore information from a previous state that is currently lost. Shroud, for example, is trivial to remove, but you'd need significant coding effort to track where it used to be in order to put it back correctly. Scenario events, harder still. Given that you can bodge most of the important stuff either by save-loading or by using debug mode, I doubt a forced undo would ever be coded. After all, the presence or absence of a few hexes of shroud or the odd ambush rarely matters that much.
Re: Force undo command
The engine flush the undo stack after each not-undoable move, this is the only thing preventing invalid undo. This is simple and simplicity is needed because undo code is already tricky. So, I doubt that we can add this ":undo" command without make the code more messy, and it will be a rarely used feature (and it's a bit cheating).
Just in case you missed it, there is a "Delay shroud update" option ;p
It seems that what you need is a debug command to change the MP of a unit. That will allow to give it enough MP to come back to its previous position and then restore its inital MP count.
":unit moves=5" to set its MP to 5
":alias m=unit moves=" to create an alias, so ":m 5" will be enough
I don't see a direct command to kill a unit, that probably should be added.
To restore lost gold: ":gold 15"
I don't know Lua enough, but maybe it's possible to kill and restore correct amount of gold in one Lua call (:lua)-.
1.9 will probably have planning feature possibly helping for this kind of input error.
Just in case you missed it, there is a "Delay shroud update" option ;p
It seems that what you need is a debug command to change the MP of a unit. That will allow to give it enough MP to come back to its previous position and then restore its inital MP count.
":unit moves=5" to set its MP to 5
":alias m=unit moves=" to create an alias, so ":m 5" will be enough
I don't see a direct command to kill a unit, that probably should be added.
To restore lost gold: ":gold 15"
I don't know Lua enough, but maybe it's possible to kill and restore correct amount of gold in one Lua call (:lua)-.
1.9 will probably have planning feature possibly helping for this kind of input error.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Force undo command
in 1.8 (untested):Alink wrote: I don't see a direct command to kill a unit, that probably should be added.
:debug
:lua wesnoth.fire("kill", {id = ...})
It's really useful when debugging scenarios, e.g. kill some side all at once on-the-fly if you have forgotten to provide such a feature:
:lua wesnoth.fire("kill", {side = 2})
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: Force undo command
Use delay fog, and you'll be able to undo, even if you'd be able to have discovered new terrains.gorillaman wrote:[...]misclicks in shroud, which I seem to do constantly.
Re: Force undo command
It is true that everybody does some misclicks or makes an error in s recruit. Who has not put his lider in wrong position by mysclick?
Who has not recruited a fish instead of a spearman?
It would be nice to be able to "force undo" once in a game. ONE "force undo" for each player each scenary.
Sincerely.
Paxe
Who has not recruited a fish instead of a spearman?
It would be nice to be able to "force undo" once in a game. ONE "force undo" for each player each scenary.
Sincerely.
Paxe
Best computer game ever played?...... Wesnoth, The Battle for Wesnoth, of course!
Re: Force undo command
Sorry Paxe. In MP, stuff like this causes OSS.
CHKDSK has repaired bad sectors in CHKDSK.EXE