command, ";"

Post Reply
Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

command, ";"

Post by Nyyrazzilyss »

Question:

The command separator for multiple commands sent on the same line is "command1;command2"

Right after someone types that, I receive a response from the mud. In that trigger, when it looks at the 'command' variable the contents of it will be 'command2'. How would I find 'command1', or the full "command1;command2" line typed?

(edit)

It looks like I might be able to somewhat figure this out using the 'sysDataSendRequest' event.

Code: Select all

function onNetworkOutput(__, xcommand)
	command2 = commandSent
	commandSent=xcommand
end
The above worked to create a global 'command2' holding the command prior to 'command'. Obviously better would be a table holding a lot more history on commands. The help entry mentioned to not misuse the event and use it as a keylogger, however, in effect that's exactly what i'm doing in creating a usable command history.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: command, ";"

Post by demonnic »

The command separator is something which can be set in the Mudlet settings. So this is not guarunteed to be a semi colon. It's actually fairly common practice to change it to ";;" so you can use a semicolon in your writing.

I'm not really sure what it is you're trying to do here? IE what is your end goal?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: command, ";"

Post by Nyyrazzilyss »

There's a problem with the mud I play that a lot of special exits don't actually provide a message to indicate usage, other then showing the room description for the room you've been moved to. The only unique indicator for a room change (which isn't always a room change, it could be for another reason) is the 'Exits:' line from the mud.

If I receive that line, and the last command entered was a special exit command assigned to the previous room I was in I update the map accordingly to the destination room.

The difficulty though is when people use the exit with stacked commands. For example, if the command to use the exit is 'enter portal', and it was used because someone typed 'enter portal;backstab sometarget;escape north' when the 'Exits:' line arrives from the mud the value of 'command' is 'escape north'.

I was hoping there might have been something I could check to get the entire unprocessed line, though I can work around that.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: command, ";"

Post by Jor'Mox »

Have you tried using the sysDataSendRequest event to capture commands getting sent? My guess is that would let you separate those out, without having to rely on the "command" variable.

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: command, ";"

Post by Nyyrazzilyss »

That's what i'm doing right now, using sysDataSendRequest to generate a command history. Just wasn't sure if there was already something pre-existing

Post Reply