Triggers, idle time, scripting, and screen focus

Posted by Vaejor on Sat 18 May 2002 05:25 PM — 4 posts, 16,914 views.

#0
Sorry to throw this all in one item, but here's a few things that may be useful for others as well.

There are times when I rather a trigger be disabled if I am inactive at my keyboard/mouse for a general amount of time. This could be implemented in two seperate locations to allow for the most flexibility. The first location would be in the trigger(and timer?) GUI input forms. A checkbox for 'Only process when active'. Also, a scripting function such as: world.IdleTime() would allow additional flexibility for more complex users. In order to determine idleness, a global variable(per mud) allowing input of a number from 0-1800(1 hour should be enough) for the number of seconds until a character is considered idle by MushClient. This can also be used to work with the current 'Trigger - Sound - Only if Inactive' setting.

A small secondary request contains 1 new script function and altering 1 current script function. A new function would return a string containing the name of the current window in MushClient that currently has focus, including world windows, notepads, etc. The altered function would be for world.Activate in order to use this information. It would work similar to ActivateNotepad(and actually could make it obselete) and would bring the window requested to the foreground of all others.
Australia Forum Administrator #1
Quote:

It would work similar to ActivateNotepad(and actually could make it obselete) and would bring the window requested to the foreground of all others.


Isn't the window with the focus, by definition, at the foreground?
#2
My apologies, I should have been a bit more clear.

The request for windowing scripting functions should be as follows:

1) Create a new script function, world.ActiveWindow which returns a string from the titlebar of the window which has focus currently.

2) Alter a current script function, world.Activate, to accept a string containing the titlebar of any screen in Mushclient, so that it can cause that screen to come to the foreground.

*Note*
The above can use numbers corresponding to the window # as per their identification in the toolbar, as long as both functions use the same data references. This would limit Activate to only working with world windows though. It could be nice to add the ActivateNotepad functionality into Activate to give it a single function call to work with all window focus in Mushclient.

Real world concept:
Primary mud sends data to a notepad as specific triggers activate it. When it sends data to the notepad, it would be useful to make sure that the notepad attempts to come to the front of the screen; however, whichever window had focus before that point should regain its focus immediately. As long as the first window is the one being worked on, everything goes fine. But if you are working in an alternate window in Mushclient, the script will cause the focus to be reset incorrectly.

Alternate usage: Triggers can cause their own windows to forcefully get focus.
Australia Forum Administrator #3
Quote:

When it sends data to the notepad, it would be useful to make sure that the notepad attempts to come to the front of the screen; however, whichever window had focus before that point should regain its focus immediately.


How is that useful? The notepad window will just flicker into view for a moment.

Anyway, most of that functionality is there now. You can use "ActivateNotepad" to activate a notepad, knowing its title. The title is based on the trigger label.

You can use "Activate" to activate the world window.

You can use "GetWorld" to find a world by name. Thus, to activate a particular world you could do something like this:


sub ActivateWorld (name)
dim otherworld

  set otherworld = world.getworld (name)

  if otherworld is nothing then
    world.note "World " + name + " is not open"
    exit sub
  end if

  otherworld.activate
end sub