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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Maximun character limit for a trigger reached in internal editor
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Maximun character limit for a trigger reached in internal editor

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


Posted by Marsun   (3 posts)  [Biography] bio
Date Thu 18 Dec 2008 (UTC)

Amended on Thu 18 Dec 2008 12:01 AM (UTC) by Marsun

Message
A warm hello,

I have been working on a quite complex trigger, in the sense of it is very stuffed one. The problem is that it is so long now that the internal editor doesn't let me add any more characters, it simply won't write the characters I am typing on the keyboard.

I have tried opening the world MCL file on an external editor and editing it there, it works: after closing the world and reopening it afterwards the changes made are there. There is a problem in this solution though, it is precisely the necessity of closing and reopening the current session.

That being said my question is if there is any way or workaround, or maybe something I am simply missing, that would allow the edition of this long trigger without needing to close the active world.

* I am using MUSHclient version 4.27.
* Character limit after the editor doesn't allow inserting more seems to be: 30,002

Thank you very much for your attention.

Best regards,
Marc
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Thu 18 Dec 2008 01:18 AM (UTC)
Message
Obvious but perhaps not so useful answer: move to a plugin and edit that, which means you can reload the plugin. Plugins are sandboxed though, so you can't use your variables there. Although you could always use a very ugly'ish hack to work around this limitation. Which hack to use would depend on the kind of trigger you have in the first place, though.

Basic idea for one hack is as follows... Make a plugin, inside it put your godly insane trigger. Make it execute a script, which goes: world.Execute("VerySpecialLongAliasThatShouldNeverFireManually " .. line)

This way, you could update your huge trigger outside of the actual special alias (located in your world) which would do your processing. Of course, this assumes you are only using your huge regular expression to -match-, any captured groups would be lost for the alias that follows in this manner. It might not work if your trigger contained newlines either, come to think of it.

The other hack assumes another way of thinking. Rather than being picky about what you match, match anything, and use scripting to do the matching and extract the useful bits. The Lua re modules should be able to help you with that (assuming you even have a regex in that field...) This method would take quite a bit of trouble to get working (if at all possible) if you were already depending on other features than plain matching - think of gagging the trigger, multiline-ness and colourmatching.


But, after typing all this.. I am wondering. What the hell are you triggering on? Your local MU*s constitution and policies? :)
[Go to top] top

Posted by Marsun   (3 posts)  [Biography] bio
Date Reply #2 on Thu 18 Dec 2008 02:31 AM (UTC)
Message
Hehe, I couldn't help but smile widely when I read the constitution and policies stuff!

Thank you for your time and for answering, Worstje. I appreciate it very much and you propose very smart tricks.

I have to say that I am sorry though, becouse I didn't put my thoughts in words clearly. I will explain this. The text matched by the trigger to activate its contents inside is short and pretty simple: just a prompt. The trigger captures from the prompt the variables it needs and then executes the code inside itself. This code part is what I cannot edit further using the internal editor becouse of its length.

I really hope I have done it better this time when it comes to explaining things.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #3 on Thu 18 Dec 2008 03:06 AM (UTC)

Amended on Thu 18 Dec 2008 03:08 AM (UTC) by Worstje

Message
Ah, that is a very simple one to fix. :)

Just start using your scriptfile. Assuming you use Lua as your scripting language:

function MyTrigger(name, line, wildcs)
  -- code goes here
end


Clear your Send: box completely, and put MyTrigger in the script box of your trigger. Minor changes will likely need to be made: %1 will need to be replaced by wildcs[1], and @stuff by GetVariable("stuff").

Good luck :)

Edit: All of the above assumes you were writing a script to start with. If you were sending stuff to output/execute, you may want to look at the Note() or Execute() functions.
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 18 Dec 2008 06:33 AM (UTC)
Message
Worstje's suggestion will also be faster. If you are using "send to script" then your 30,000+ characters have to be compiled every time. If you follow his suggestion it is compiled once. This will be faster and also cleaner. To say nothing of being easier to edit.

- Nick Gammon

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

Posted by Marsun   (3 posts)  [Biography] bio
Date Reply #5 on Thu 18 Dec 2008 12:27 PM (UTC)
Message
Aha! I am very happy this could be easily solved, and I am very thankful for you help.

Up to now the only way I knew of writting code for triggers was using the "Send:" box as the container, this means this approach to it you propose is new and very revealing for me. I have already searched more about it and with the help of your helpful hints I think I will be able to make it work in the end (or we will meet again in the future :)).

Thank you very much, Worstje, for your help; and sincere thanks to you, Nick, for such a great program and such a praiseworthy dedication!

Best regards,
Marc
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Thu 18 Dec 2008 06:51 PM (UTC)
Message
See: http://mushclient.com/scripting

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


2,717 views.

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 FutureQuest]