Force undo command

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
gorillaman
Posts: 2
Joined: August 5th, 2010, 8:43 am

Force undo command

Post by gorillaman »

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.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Force undo command

Post by Ken_Oh »

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.
gorillaman
Posts: 2
Joined: August 5th, 2010, 8:43 am

Re: Force undo command

Post by gorillaman »

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.
User avatar
Simons Mith
Posts: 821
Joined: January 27th, 2005, 10:46 pm
Location: Twickenham
Contact:

Re: Force undo command

Post by Simons Mith »

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.
 
Alink
Inactive Developer
Posts: 181
Joined: March 5th, 2007, 6:45 am
Location: Belgium

Re: Force undo command

Post by Alink »

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.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Force undo command

Post by Anonymissimus »

Alink wrote: I don't see a direct command to kill a unit, that probably should be added.
in 1.8 (untested):
: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 startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
fog_of_gold
Posts: 637
Joined: December 20th, 2009, 5:59 pm
Location: Germany

Re: Force undo command

Post by fog_of_gold »

gorillaman wrote:[...]misclicks in shroud, which I seem to do constantly.
Use delay fog, and you'll be able to undo, even if you'd be able to have discovered new terrains.
User avatar
Paxe
Posts: 34
Joined: January 14th, 2008, 9:02 am
Location: Madrid

Re: Force undo command

Post by Paxe »

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
Best computer game ever played?...... Wesnoth, The Battle for Wesnoth, of course!
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Re: Force undo command

Post by joshudson »

Sorry Paxe. In MP, stuff like this causes OSS.
CHKDSK has repaired bad sectors in CHKDSK.EXE
Post Reply