[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  I'm trying to redirect chat to a new window. Following the tutorial, not working

I'm trying to redirect chat to a new window. Following the tutorial, not working

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


Pages: 1 2  

Posted by Horologe   (9 posts)  [Biography] bio
Date Thu 17 Dec 2015 07:52 PM (UTC)
Message
I followed all of the steps for this tutorial. http://www.gammon.com.au/forum/bbshowpost.php?id=7991&page=1

I named my new world newchat, i changed the line to newchat. I save the plugin and started it with the world i just made still open and it doesn't work. If i close the window, the plugin does not open one as the forum post implies. Help?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 18 Dec 2015 12:14 AM (UTC)

Amended on Fri 18 Dec 2015 12:15 AM (UTC) by Nick Gammon

Message
That is an 8-page thread with multiple examples. Please post the exact code you used, inside code tags.

Template:codetag To make your code more readable please use [code] tags as described here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #2 on Fri 18 Dec 2015 02:44 AM (UTC)

Amended on Sun 20 Dec 2015 01:46 AM (UTC) by Nick Gammon

Message
The server i made is called newchat. I'm using windows10. I think it has to do something with the VirtualStore in windows or how windows saves the worlds.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the 
world you want chats to go to.
-->

<muclient>
<plugin
   name="Chat_Redirector"
   author="Nick Gammon"
   id="cb84a526b476f69f403517da"
   language="Lua"
   purpose="Redirects chat messages to another world"
   date_written="2007-06-30 10:45:35"
   requires="4.08"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ (says|chats|yells) \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^You (say|chat|yell) \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "newchat"
local first_time = true

function redirect (name, line, wildcards, styles)

  -- try to find "chat" world
  local w = GetWorld (chat_world)  -- get "chat" world

  -- if not found, try to open it
  if first_time and not w then
    local filename = GetInfo (67) .. chat_world .. ".mcl"
    Open (filename)
    w = GetWorld (chat_world)  -- try again
    if not w then
      ColourNote ("white", "red", "Can't open chat world file: " .. filename)
      first_time = false  -- don't repeatedly show failure message
    end -- can't find world 
  end -- can't find world first time around

  if w then  -- if present
    for _, v in ipairs (styles) do
      w:ColourTell (RGBColourToName (v.textcolour), 
                    RGBColourToName (v.backcolour), 
                    v.text)  
    end -- for each style run
    w:Note ("")  -- wrap up line

  end -- world found

end -- function redirect 

]]>
</script>


</muclient>
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 18 Dec 2015 03:39 AM (UTC)
Message
Can you open the "newchat" world and then do this, please?

Template:bug

Please provide a summary of your world configuration:

  • Either use the scripting Immediate window (Ctrl+I) to execute: Debug ("summary")

    or

  • Install the Summary plugin (see "Summary" feature) and type "summary"

Then copy the resulting information from the output window, and paste into a Forum message.

You need version 4.55 onwards of MUSHclient to do this.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #4 on Fri 18 Dec 2015 11:39 PM (UTC)
Message
debug summary on newclient

Quote:

-------------- MUSHclient summary --------------

MUSHclient version: 4.94
Compiled: Jul 28 2014.
Time now: Friday, December 18, 2015, 5:37 PM
Client running for: 0d 00h 01m 09s
World opened for: 0d 00h 00m 44s
Operating system: Unknown (Platform 2, Major 6, Minor 2)
Libraries: Lua 5.1.4, PCRE 8.35, PNG 1.5.14, SQLite3 3.8.4.3, Zlib 1.2.8
World name: 'chat', ID: 44d3d012bb95f2ca590c8a98
-- Scripting --
Script language: Lua, enabled: yes
Scripting active: yes
Lua sandbox is 127 characters, DLL loading allowed: yes
Scripting prefix: ''. External editor in use: NO.
Scripting for: 0.000040 seconds.
-- Triggers, aliases, timers, variables --
** Triggers: 0 in world file, triggers enabled: yes.
0 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 seconds.
** Aliases: 0 in world file, aliases enabled: yes.
0 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 seconds.
** Timers: 0 in world file, timers enabled: yes.
0 enabled, 0 fired.
Timers checked every 0.1 seconds.
** Variables: 0.
-- MCCP --
MCCP not active.
-- Plugins (Processing order) --
** Plugins: 0 loaded, 0 enabled.
-- Comms --
Connect phase: 0 (Closed). NAWS wanted: NO
Received: 0 bytes (0 Kb)
Sent: 0 bytes (0 Kb)
Received 0 packets, sent 0 packets.
Total lines received: 46
This connection: Sent 0 lines, received 46 lines.
Telnet (IAC) received: DO: 0, DONT: 0, WILL: 0, WONT: 0, SB: 0
-- MXP --
MXP active: NO, Pueblo mode: NO, Activated: On command
MXP tags received: 0
MXP entities received: 0
MXP errors: 0
-- Commands --
Commands in command history: 0
Speed walking enabled: NO. Speed walking prefix: #
Command stacking enabled: NO. Command stack character: ';'
Accelerators defined: 0
-- Miniwindows --
** Miniwindows: 0 loaded, 0 shown.
-- Output window --
Output pixels: width 691, height: 789, font width: 8, font height: 15
can show 86 characters, wrapping at column 80, height 52 lines.
Output buffer: 64 of 5000 lines.
-- Miscellaneous --
Logging: NO, tracing: NO
** SQLite3 databases: 0
Sound buffers in use: 0

debug summary on active world
Quote:


-------------- MUSHclient summary --------------

MUSHclient version: 4.94
Compiled: Jul 28 2014.
Time now: Friday, December 18, 2015, 5:38 PM
Client running for: 0d 00h 02m 42s
World opened for: 0d 00h 02m 36s
World connected for: 0d 00h 02m 36s
Operating system: Unknown (Platform 2, Major 6, Minor 2)
Libraries: Lua 5.1.4, PCRE 8.35, PNG 1.5.14, SQLite3 3.8.4.3, Zlib 1.2.8
World name: 'Exile-Horologe', ID: dca6213a59b1da57a878d028
-- Scripting --
Script language: Lua, enabled: yes
Scripting active: yes
Lua sandbox is 127 characters, DLL loading allowed: yes
Scripting prefix: ''. External editor in use: NO.
Scripting for: 0.000285 seconds.
-- Triggers, aliases, timers, variables --
** Triggers: 9 in world file, triggers enabled: NO. [Triggers]
6 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 seconds.
** Aliases: 5 in world file, aliases enabled: yes. [Aliases]
5 enabled, 0 regexp, 20 attempts, 0 matched, 0.000112 seconds.
** Timers: 0 in world file, timers enabled: yes.
0 enabled, 0 fired.
Timers checked every 0.1 seconds.
** Variables: 16. [Variables]
-- MCCP --
MCCP not active.
-- Plugins (Processing order) --
ID: cb84a526b476f69f403517da, 'Chat_Redirector', (Lua, 0.000 s) Enabled [Tr]
** Plugins: 1 loaded, 1 enabled.
-- Comms --
Connect phase: 8 (Open). NAWS wanted: NO
Received: 11942 bytes (11 Kb)
Sent: 1352 bytes (1 Kb)
Received 40 packets, sent 24 packets.
Total lines received: 173
This connection: Sent 7 lines, received 153 lines.
Telnet (IAC) received: DO: 5, DONT: 0, WILL: 4, WONT: 1, SB: 6 [Telnet]
-- MXP --
MXP active: yes, Pueblo mode: NO, Activated: Yes - always
MXP tags received: 79
MXP entities received: 0
MXP errors: 0
-- Commands --
Commands in command history: 3
Speed walking enabled: NO. Speed walking prefix: #
Command stacking enabled: NO. Command stack character: ';'
Accelerators defined: 0
-- Miniwindows --
** Miniwindows: 0 loaded, 0 shown.
-- Output window --
Output pixels: width 656, height: 781, font width: 8, font height: 15
can show 82 characters, wrapping at column 80, height 52 lines.
Output buffer: 191 of 5000 lines.
-- Miscellaneous --
Logging: yes, tracing: NO
** SQLite3 databases: 0
Sound buffers in use: 0

---------------------- End summary ----------------------
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 19 Dec 2015 02:51 AM (UTC)
Message
OK, please post some example chat lines (copy and paste) that you expect to be redirected.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #6 on Sat 19 Dec 2015 05:11 PM (UTC)
Message
HTML version

<!-- Produced by MUSHclient v 4.94 - www.mushclient.com -->
<table border=0 cellpadding=5 bgcolor="#000000">
<tr><td>
<pre><code><font size=2 face="FixedSys, Lucida Console, Courier New, Courier"><font color="#0">
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1737</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#FF0000">Mithrandir tells you, 'go for it'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1737</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#C0C0C0">say can you just use say
</font><font color="#00FFFF">You say, 'can you just use say'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1767</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#C0C0C0">say and talk to me
</font><font color="#00FFFF">You say, 'and talk to me'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1767</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#C0C0C0">say literally anything
</font><font color="#00FFFF">You say, 'literally anything'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1767</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#00FFFF">Mithrandir says, 'k'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1767</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">93</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#C0C0C0">say thanks!
</font><font color="#00FFFF">You exclaim, 'thanks!'
</font><font color="#FFFFFF">&lt;</font><font color="#FF0000">1238</font><font color="#800000">/</font><font color="#FF0000">1238</font><font color="#800000">hp </font><font color="#00FF00">1767</font><font color="#008000">/</font><font color="#00FF00">1767</font><font color="#008000">m </font><font color="#00FFFF">731</font><font color="#008080">/</font><font color="#00FFFF">731</font><font color="#008080">mv </font><font color="#FF00FF">92</font><font color="#800080">e</font><font color="#FFFFFF">&gt;[</font><font color="#FFFF00">None</font><font color="#808000">xp</font><font color="#FFFFFF">] 
</font><font color="#C0C0C0">Asclepius stares at you and utters the words, 'abrazak'.
A faint outline of magical armor surrounds you
</font></font></code></pre>
</td></tr></table>


normal text

<1238/1238hp 1737/1767m 731/731mv 93e>[Nonexp] 
Mithrandir tells you, 'go for it'
<1238/1238hp 1737/1767m 731/731mv 93e>[Nonexp] 
say can you just use say
You say, 'can you just use say'
<1238/1238hp 1767/1767m 731/731mv 93e>[Nonexp] 
say and talk to me
You say, 'and talk to me'
<1238/1238hp 1767/1767m 731/731mv 93e>[Nonexp] 
say literally anything
You say, 'literally anything'
<1238/1238hp 1767/1767m 731/731mv 93e>[Nonexp] 
Mithrandir says, 'k'
<1238/1238hp 1767/1767m 731/731mv 93e>[Nonexp] 
say thanks!
You exclaim, 'thanks!'
<1238/1238hp 1767/1767m 731/731mv 92e>[Nonexp] 
Asclepius stares at you and utters the words, 'abrazak'.
A faint outline of magical armor surrounds you
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Sun 20 Dec 2015 01:58 AM (UTC)
Message
This is what you are trying to match on:


Mithrandir tells you, 'go for it'
You say, 'can you just use say'
You say, 'and talk to me'
You say, 'literally anything'
Mithrandir says, 'k'
You exclaim, 'thanks!'


But your triggers are:


   match="^[A-Za-z]+ (says|chats|yells) \'(.*?)\'$"
...
   match="^You (say|chat|yell) \'(.*?)\'$"


It isn't going to match. There is nothing matching "tells you" or "says,". Triggers have to match exactly.

If you change the triggers part of the plugin to the following, it works better:


<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ (says|chats|yells), \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells you, \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^You (say|chat|yell), \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>


I added the comma after says/chats/yells and also added a trigger for "tells you". You can tweak the triggers or add to them if other things are not matching.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #8 on Sun 20 Dec 2015 02:25 AM (UTC)
Message
thanks, I'll update my plugin accordingly. I don't get error messages about the world not opening but it doesn't automatically open.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Sun 20 Dec 2015 07:14 AM (UTC)
Message
The plugin opens the world if the trigger matches. If the trigger doesn't match the world won't open.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #10 on Mon 21 Dec 2015 04:49 AM (UTC)
Message
getting this error

SQL error on statement:
"COMMIT"
disk I/O error


here is my plugin now

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, June 30, 2007, 10:48  -->
<!-- MuClient version 4.13 -->

<!-- Plugin "Chat_Redirector" generated by Plugin Wizard -->

<!--
Edit plugin and change "chat_world" variable to be the name of the 
world you want chats to go to.
-->

<muclient>
<plugin
   name="Chat_Redirector"
   author="Nick Gammon"
   id="cb84a526b476f69f403517da"
   language="Lua"
   purpose="Redirects chat messages to another world"
   date_written="2007-06-30 10:45:35"
   requires="4.08"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Redirects chats to the specified world.

Add or modify "chat" triggers to capture different sorts of message.

Change the variable "chat_world" to be the name of the world chats are to go to.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ (says|sings|auctions|dreams|prays|shouts), \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^[A-Za-z]+ tells you, \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^(.*?)(tells|tell) the form(.*?)$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

  <trigger
   enabled="y"
   match="^(.*?) (gossip|gossips)(.*?)$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>


  <trigger
   enabled="y"
   match="^You (say|shout), \'(.*?)\'$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

<trigger
   enabled="y"
   match="^You tell (.*?)$"
   regexp="y"
   script="redirect"
   sequence="100"
  >
  </trigger>

</triggers>

<!--  Script  -->


<script>
<![CDATA[
chat_world = "chat"
local first_time = true

function redirect (name, line, wildcards, styles)

  -- try to find "chat" world
  local w = GetWorld (chat_world)  -- get "chat" world

  -- if not found, try to open it
  if first_time and not w then
    local filename = GetInfo (67) .. chat_world .. ".mcl"
    Open (filename)
    w = GetWorld (chat_world)  -- try again
    if not w then
      ColourNote ("white", "red", "Can't open chat world file: " .. filename)
      first_time = false  -- don't repeatedly show failure message
    end -- can't find world 
  end -- can't find world first time around

  if w then  -- if present
    for _, v in ipairs (styles) do
      w:ColourTell (RGBColourToName (v.textcolour), 
                    RGBColourToName (v.backcolour), 
                    v.text)  
    end -- for each style run
    w:Note ("")  -- wrap up line

  end -- world found

end -- function redirect 

]]>
</script>


</muclient>


Any idea why?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Mon 21 Dec 2015 09:57 AM (UTC)
Message
There is no "commit" in that plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #12 on Mon 21 Dec 2015 01:21 PM (UTC)
Message
I'm confused. I thought that was a sql db thing? That plugin is the only one I have installed. I haven't received this error before using this plugin.
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #13 on Mon 21 Dec 2015 05:11 PM (UTC)
Message
What's you MC install directory? Sounds like you might be trying to write to a protected memory space (most notably Program Files since Win 7 released).

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Horologe   (9 posts)  [Biography] bio
Date Reply #14 on Mon 28 Dec 2015 03:12 PM (UTC)
Message
It is in the program files directory. How do I fix this problem?
[Go to top] 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.


42,929 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]