Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Omitting a command

Omitting a command

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shadoweave   (42 posts)  Bio
Date Mon 17 Sep 2007 06:46 AM (UTC)
Message
I was wondering if there is a way to send commands to the mud that will be omitted, but the response from the mud will show. Alternately, if this isn't possible, is there a way to send commands coloured black?
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #1 on Mon 17 Sep 2007 06:59 AM (UTC)
Message
In the world in question, press ALT + 0 (zero) and uncheck the "Echo my input in" check box, and your input will no longer be echoed :)

-Onoitsu2
Top

Posted by Shadoweave   (42 posts)  Bio
Date Reply #2 on Mon 17 Sep 2007 07:05 AM (UTC)
Message
No, that wasn't it. I want to send a command that will be omitted from the output inside a script, and only that command will be omitted. Not all my commands, I have no reason to do that.

And while we are on the subject, why isn't this working?

function spam_com (sCom, dNum)
if dNum <= 5 then
	Note (sCom.." "..tostring(dNum))
	DoAfterSpecial (1, "spam_com (sCom, dNum+1)", 12)
end -- if
end -- function


Error message:

Run-time error
World: Lusternia
Immediate execution
[string "Timer: "]:1: attempt to perform arithmetic on global 'dNum' (a nil value)
stack traceback:
        [string "Timer: "]:1: in main chunk

Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #3 on Mon 17 Sep 2007 07:35 AM (UTC)
Message
I can tell you why that is not working as you would expect it to. It is because after that line executes the variable dNum no longer exists, as the script has finished execution, THEN it tries to use the number stored in the dNum variable which does not exist. To do something using that method you need to store the value in a MUSHclient variable, and the recall it using the GetVariable("name") method, which in this particular case you would surround with a tonumber() call.

I have had to use this method in many things, due to this issue.

Also on the omitting thing, I was unaware that you only wanted it for a certain things. the SendNoEcho() function should be what you are looking for, just put the string you want to send in quotes and you are set :)

-Onoitsu2
Top

Posted by Shadoweave   (42 posts)  Bio
Date Reply #4 on Mon 17 Sep 2007 08:32 AM (UTC)
Message
Quote:

Also on the omitting thing, I was unaware that you only wanted it for a certain things. the SendNoEcho() function should be what you are looking for, just put the string you want to send in quotes and you are set :)

Thanks, it worked perfectly! About that function, I have decided not to use it, not in that form anyway, too much of a headache for what I am trying to do.
Top

Posted by Shadoweave   (42 posts)  Bio
Date Reply #5 on Mon 17 Sep 2007 07:16 PM (UTC)
Message
Ok, another question about omitting. This time, I was wondering if there is a way to omit all the lines between two triggers.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #6 on Mon 17 Sep 2007 08:32 PM (UTC)
Message
The easiest way to do that would be to have the first trigger activate two other triggers. There should be an ending trigger which turns off itself and the other trigger activated by the first one. The other trigger should match on everything ( match="*" ) and omit all these lines from output.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #7 on Mon 17 Sep 2007 09:11 PM (UTC)
Message
Don't forget to make sure that the termination trigger has a lower sequence than the one that matches on everything, this way you will not have to have the match on everything "keep evaluating" and that can save some processing cycles, depending on the number of triggers that might activate during the particular task.

-Onoitsu2
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #8 on Mon 17 Sep 2007 10:46 PM (UTC)
Message
Oops... completely forgot to mention that. Thanks for catching that Onoitsu. It might still be beneficial to have the trigger gagging all the random output keep evaluating, if you do not want to interrupt any other triggers, but normally it would not be needed.

I would set the sequence of the end check to 1, and the gagger to 2, that way you won't have to deal with any other triggers being tested while the script is gagging everything.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #9 on Tue 18 Sep 2007 01:54 AM (UTC)
Message
Beneficial to use keep evaluating, that can only be said if you have less than a few hundred triggers, if more then EVERY line would be checked on the "catch-all" trigger, and have to be matched against all triggers. This is why I suggested not enabling that, as it is more safe to not keep evaluating.

Of course there probably will be the exception to my outlook on this, but generally less checks equals less chance the system can lag.

-Onoitsu2
Top

Posted by Shadoweave   (42 posts)  Bio
Date Reply #10 on Tue 18 Sep 2007 07:15 PM (UTC)
Message
Ok, thank you guys very much for this. I was thinking something along those lines, but I feared that the system I am writing would lag if I used the .* trigger. But now, thanks for the sequence tips you gave me, it works like a charm!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


27,718 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.