World.Execute / AutoSay Problem

Posted by Flannel on Tue 06 May 2003 11:05 PM — 7 posts, 20,348 views.

USA #0
as far as I can tell, world.execute isnt adding the autosay prefix. I tried it in the immediate, as well as with a command over Chat.

Also, with autosay on, and exclude special characters off, and send to command parser on. (so, it goes through the command loop, but doesnt exclude 'special' characters), a #chatall test command wont end up as #chatall test with the prefix in it, but rather get picked up by the plugin, and then chatted.

So, the second part is probably the plugin grabbing the command before Autosay gets ahold of it, and the first, is execute not going through Autosay.

Hope all of that makes sense.
Australia Forum Administrator #1

To cover your first point, see release notes for 3.35 - point 13.

The description there makes it clear that auto-say is outside the Execute function. The intention here was that, first, auto-say was supposed to catch your literal typing at the keyboard, not something that might come from an alias. Second, if it *did* respect auto-say then you might have a batch of triggers/aliases/timers that sent to "execute" and which would stop working as soon as you turned auto-say on for a chat. I thought this would be undesirable, hence moving auto-say out of the Execute function.

USA #2
Alright, then world.execute Help needs to be changed, since it mentions Autosay. I was just unsure about that, since the documentation says one thing, and the client does it another.
Australia Forum Administrator #3
For your second point, if you have auto-say on and "send to command parser" it really gets sent to the Execute function, not re-sent to the function it is currently in. Otherwise I can envisage an infinite loop.

eg. auto-say on, send to command parser on.

You type "hello nick" <enter>

This gets sent to the primary command parser (let's call it PrimaryCommandParser), like this:

PrimaryCommandParser ("hello nick")

This detects that the auto-say is to be sent to the command parser, so it recalls itself, like this:

(simplified code follows)


void PrimaryCommandParser (sMessage)
  {

  if (autosay)
     if (send_to_command_parser)
       PrimaryCommandParser (sMessage); 
     else
        SendToWorld (auto_say_prefix + sMessage);
  else
     Execute (sMessage);
  }


See how that would sent you into an infinite loop?

So, what it actually does is:


void PrimaryCommandParser (sMessage)
  {

  if (autosay)
     if (send_to_command_parser)
       Execute (auto_say_prefix + sMessage); 
     else
        SendToWorld (auto_say_prefix + sMessage);
  else
     Execute (sMessage);
  }


Having said that, I'm not fully sure I understand your problem.

I set up auto-say on, exclude special characters off, auto-say prefix "say ", and then did "#chatall test".

This sent: "say #chatall test" which is what I would expect it to do.
Australia Forum Administrator #4
Quote:

Alright,then world.execute Help needs to be changed


You are right, that is a documentation error.

I have amended the documentation to replace the word "auto-say" with "scripting" as you can indeed do scripting, and added a paragraph to clarify that auto-say is not processed.
Amended on Tue 06 May 2003 11:34 PM by Nick Gammon
USA #5
My Autosay prefix was #chatall, so I could use autosay with chat (which is why autosay was sent through command interperater)
USA #6
and yes, I do see how it would be easy to make an infinite loop, which crossed my mind as I was fiddling with it, I was just wondering (as the documentation said otherwise).