Getting last command passed by user

General discussion about the Genesis Web Client located at https://www.genesismud.org/play/

Moderator: Eowul

Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Post Reply
User avatar
Vlek
Wanderer
Posts: 71
Joined: 06 Apr 2014 07:40
Contact:

Getting last command passed by user

Post by Vlek » 11 May 2015 07:44

I was wondering if there was a way to retrieve the last command entered by the user. Does this get saved, kind of like args, in the background? If not, is there any temporary fixes that anyone can think of? I've tried making an empty alias that saved all args to a variable, but that did not work. Making a trigger that looks for an ">" in front of a statement to save it did not work either.

User avatar
britanica
Wizard
Posts: 45
Joined: 28 Sep 2015 16:42

Re: Getting last command passed by user

Post by britanica » 10 Oct 2015 07:33

A very late answer on what I found works.

Code: Select all

var keys = Object.keys(mud.InputHistory.history);
var last = keys[keys.length-1];
gwc.output.append('last command: ' + mud.InputHistory.history[last]);
The command triggered from the numpad directions does not get added to the history. Directions where the full word is typed in the command input and enter is pressed do get added to the history.

User avatar
Alisa
Hero
Posts: 392
Joined: 16 Nov 2014 23:10

Re: Getting last command passed by user

Post by Alisa » 10 Oct 2015 22:30

That is for an alias right?

For some reason these commands confuse me a bit :-)

User avatar
britanica
Wizard
Posts: 45
Joined: 28 Sep 2015 16:42

Re: Getting last command passed by user

Post by britanica » 11 Oct 2015 01:23

The code will work in either an alias or a trigger

The difference between the two is that the code for a trigger is run in response to the client receiving a message from the mud server. An alias runs the code when the client receives a command from the player.

User avatar
Snowrose
Rising Hero
Posts: 307
Joined: 09 Mar 2012 22:04
Location: Reseda
Contact:

Re: Getting last command passed by user

Post by Snowrose » 19 Oct 2015 14:11

there is a quicktyper dhorthand of %% that will autoexecute your lastcommand in a do
and it will say doing: whatever last command was.
so if your trying to redo your last command you can use %%.

however if you use %% in an alias it will have a substitute function
ie
alias hhug hug %% happily
and you "hhug friend" you will "hug friend happily"
thus it would be difficult to use %% in an in game alias fir last command reasons.
Image

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/