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
➜ Plugins
➜ Couple Questions/Suggestions
Couple Questions/Suggestions
|
Posting of new messages is disabled at present.
Refresh page
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Mon 28 May 2007 01:25 AM (UTC) |
Message
| I have a couple questions. The suggestions really should go on the suggestions board, but I'm thinking these as I go along. Forgive me if I ramble on, I have a tendancy to do that.
1.) What is the maximum size of the notepad?
2.) Is there any way to get a list of open notepad windows.
3.) Do you have a link to a site where I could maybe get a help file for lua, or maybe a tutorial, I'm kinda curious to learn it.
4.) Does MUSHclient have, or will it have a builtin MsgBox and Inputbox methods. I gather that lua has these by what I've read in the help files, but I haven't learned lua yet, and I think it'd be nice to use them in other languages. I suppose I could write a simple ActiveX .dll in VB6 but that seems like a waste of effort, and I'm a little concerned about the ActiveX object not being released in JavaScript, in VBScript setting it to Nothing seems to release it, but last time I tried messing with ActiveX in JavaScript, it stayed open, I had to write a method to force it to exit before I set the reference to null. I guess it's just a limitation of JavaScript. Unless I'm doing it wrong...
Also a listbox and/or combobox to select between several options might be nice, but I suspect those would be better as an ActiveX dll, as actual objects in would make setting the options, and getting the results easier, also maybe have access to the common dialog control for selecting files. I really don't feel like coding that just yet though, not until I really really need it.
5.) I think it'd be cool to have a way to run scripts/plugins from or maybe add seperate plugins to the notepad, for example I could write a script to format a piece of text, but currently I have no way of applying it to text in the notepad other than copying it to the clipboard, switching to the world window and running the alias, then switching back and hitting paste, or maybe switching to the world window and using an alias and specifying the notepad's name. I haven't put much thought into how this would work, maybe adding a menu to the top, although how you would specify the code... and where would it be saved... It might require adding another option to aliases to appear in the notepad menu... Never mind, it seems like an aweful lot of work, and a lot of details haven't been worked out, it'd be easier to just use copy & paste.
That's all I can think of for now. Although I could swear there was more. | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #1 on Mon 28 May 2007 03:33 AM (UTC) |
Message
| I won't be terribly helpful with the first two because I rarely use the inbuilt notepad. I usually run through wine, and I just recently got my computer to have the correct dlls to not crash when I opened a notepad window. I usually just use worlds connected to 0.0.0.0 for displaying text in another window.
1) no idea.
2) Also no idea. They don't show up on GetWorldList
3) http://lua-users.org/wiki/TutorialDirectory So long as you know at least a little about programming, this is a great site. Lists off pretty much all you need to know about Lua. Anything else, I'm sure there will be someone around to answer your questions here. When I search on Google for answers to my Lua questions, I'm referred to these forums quite frequently.
4) Only msgbox, or input boxes I know of are just in the utils file for lua. This link http://www.gammon.com.au/forum/bbshowpost.php?id=6124 has a few links off of it where you can see how to use those utilities.
5) http://www.gammon.com.au/scripts/function.php?name=AppendToNotepad is the help for AppendToNotepad, which will send text to a specific notepad window. SendToNotepad, ActivateNotepad, and SaveNotepad are some related links down at the bottom of that page which might be helpful for you. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 28 May 2007 04:50 AM (UTC) |
Message
|
Quote:
1.) What is the maximum size of the notepad?
It is really a Windows Edit control, so whatever its maximum size is, on your version of the operating system.
One article I found on MSDN suggested the maximum size is 2,147,483,646 characters.
However I would be dubious about putting much more than 65,535 in it.
Quote:
2.) Is there any way to get a list of open notepad windows.
There doesn't seem to be, maybe that could be a future suggestion.
Quote:
Do you have a link to a site where I could maybe get a help file for lua ...
As mentioned on the Lua part of this forum, the Programming in Lua book is very good, there is an online version at:
http://www.lua.org/pil/
Quote:
Does MUSHclient have, or will it have a builtin MsgBox and Inputbox methods. I gather that lua has these by what I've read in the help files, but I haven't learned lua yet ...
It isn't part of Lua per se, they are Lua library extensions built into MUSHclient. Very similar functions are built into VBscript, and possibly JScript as well.
Quote:
Also a listbox and/or combobox to select between several options might be nice ...
See:
http://www.gammon.com.au/scripts/doc.php?lua=utils.choose
http://www.gammon.com.au/scripts/doc.php?lua=utils.listbox
Quote:
I think it'd be cool to have a way to run scripts/plugins from or maybe add seperate plugins to the notepad, for example I could write a script to format a piece of text ...
You can do that by using the "Global Replace" function which is built into the Notepad. See:
http://www.gammon.com.au/scripts/doc.php?dialog=IDD_LUA_GSUB
There have been some forum postings about doing fancy stuff with that, for example correctly capitalizing key words. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #3 on Mon 28 May 2007 05:46 AM (UTC) |
Message
| Thanks for the answers.
Just a couple things.
Regarding the notepad size, I agree, I don't think it reaches anywhere near that large, I know this because a few years ago I set my client to send channel output to the notepad and it filled up overnight. I don't know if you're using the same control or not since then, but I assume you are.
A lot of the answers to my questions were LUA related, so I guess I'll have to learn it. I checked out a couple LUA references, and I find the language rather confusing at first glance, the syntax seems quite different to what I'm used to. Maybe it's because it's past 1 AM here, but when I tried to read the manual I just started getting a big headache. What might be nice is if I could maybe use multiple scripting languages at once. Maybe either I or somebody else could write a plugin with functions in LUA to access the features that only LUA seems to have, and then it could be called from other plugins via CallPlugin(), Hmm, although it seems that only supports like a single string argument... Hmm, there might be some alternative method of passing arguments... Anyway, I'm just brainstorming here.
Shaun Biggs suggested AppendNotePad and the like for the notepad problem, but those require you call the notepad by name, so unless you have it create a notepad window specifically for the purpose, you'd have to supply the name of that notepad, which may or may not be a big deal. And despite the whole Global replace answer, while it seems good as long as you know LUA, it wouldn't really be suited for general users to use from a plugin. So the clipboard remains the best and easiest option, in fact in one of the purposes I had in mind, running it from the notepad would have increased the number of steps that the user had to take.
Anyway, thanks for your prompt answers. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #4 on Mon 28 May 2007 05:54 AM (UTC) |
Message
|
Quote:
2.) Is there any way to get a list of open notepad windows.
I have added the script function GetNotepadList to version 4.08, so you can enumerate the open notepad windows.
Quote:
a few years ago I set my client to send channel output to the notepad and it filled up overnight
There is now an alternative way of doing this, which is to create a "dummy" world with an IP address of 0.0.0.0. This does not attempt to connect, and by scripting to send notes to it you can output in colour up to the maximum size (500,000 lines).
Quote:
I find the language rather confusing at first glance ...
Check out the Programming in Lua link - the author of Lua does a really good job of doing a simple explanation. Plus, read the various "how to"s in the Lua part of this forum.
Quote:
Hmm, there might be some alternative method of passing arguments.
You could make a comma-delimited list if you had to.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #5 on Thu 31 May 2007 12:04 AM (UTC) Amended on Thu 31 May 2007 12:07 AM (UTC) by Cage_fire_2000
|
Message
| Ok, update and some other questions.
First of all, I created a simple ActiveX .dll in VB6 and tried accessing it with JavaScript, and I discovered that it /did/ in fact release the object after the reference to it was gone, it's just that java/javascript has a garbage collection cycle instead of destroying it the moment the object is no longer referenced like in VBScript.
Anyway, I went on to add MsgBox and InputBox functions/interfaces that I could use them in JavaScript(They'll probably work in other languages but I only know how to code in VBScript and JavaScript).
I also wrote a function to convert a JavaScript Array into a VB Array(Apparently the values come out as strings, because I had to use the slice method to get each element, but I dimmed it a variant array, I might change that to string in the future.) It works, Although it doesn't really have type checking, and it returns silently whatever it's got if there are any errors. I suspect if one were to supply a string instead of an array it'd still work, and treat each letter as a different element.
I'm planning on incorporating Common Dialog Control Functionality, although I might have to make a seperate class(es) for that and it might have to be handled differently, since it might not be possible/practical to set all the values in one function call.
I wanted to include those listbox/combobox controls from LUA, but apparently they don't exist in VB, so I'd have to code them from scratch, and I'm not sure how to resize the label control and such to make the prompt fit.
Question, you said a dummy world could be used to forward text to, I actually have tried something like this before, what I'm wondering though, is it possible to dynamically create this dummy world from inside the script, or would it have to be done manually(and with seperate .mcl files) for each seperate window you want.(Like I had tried)
Oh, this should probably go under bug reports, but I was messing around with the alias menu while I was offline last week or so, and I found out that clicking on the entries while the world isn't connected(Like a dummy world) doesn't execute the aliases, even if typing the aliases directly into the command window does.
Anyway, I think that's it for now, I've done my ranting. | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #6 on Thu 31 May 2007 12:54 AM (UTC) |
Message
|
Quote: Oh, this should probably go under bug reports, but I was messing around with the alias menu while I was offline last week or so, and I found out that clicking on the entries while the world isn't connected(Like a dummy world) doesn't execute the aliases, even if typing the aliases directly into the command window does.
The same is true for when the world is connected. There are too many times where the aliases have wildcards that have to be entered in order for them to match.
As for creating worlds with inbuilt functions, there does not appear to be a way to do that at the moment. At least aside from creating the world as a text file and saving it as a .xml file... but you still can't open that through scripts. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #7 on Thu 31 May 2007 01:32 AM (UTC) |
Message
| You can use world.Open to open a text file (with a .mcl extension) that you have created on-the-fly.
Up till version 4.08 Lua did not support opening such files (however other languages did), but from 4.08 onwards you can also open them in Lua. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #8 on Thu 31 May 2007 01:46 AM (UTC) |
Message
| That would be why I couldn't figure out how to use that function... I only script in Lua :( Can we open a world by importing xml, or do we have to save the file, then open it with that function?
I'd like to have my channel capturing plugin be able to create worlds on the fly, if needed. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #9 on Thu 31 May 2007 01:48 AM (UTC) |
Message
| You would need to create an actual disk file. The open is an application-wide function, it is not part of the existing world. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #10 on Thu 31 May 2007 01:49 AM (UTC) |
Message
|
Quote:
... I found out that clicking on the entries while the world isn't connected(Like a dummy world) doesn't execute the aliases ...
I have fixed that in version 4.08. A test for being connected was being done a bit prematurely in the click handling. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cage_fire_2000
USA (119 posts) Bio
|
Date
| Reply #11 on Thu 31 May 2007 02:35 AM (UTC) Amended on Thu 31 May 2007 03:45 AM (UTC) by Cage_fire_2000
|
Message
| OK, regarding the alias menu thing, somebody mentioned aliases requiring arguments, I just had a thought that it'd be cool if you could make an alias prompt for arguments(if they aren't specified?), although... I suppose doing it automatically would be difficult, since detecting how many arguments an alias had would be hard(at least with regexp), although using an ActiveX component to prompt for arguments you could always script it... Or you could just have it load the command into the command prompt, it'd be simpler but wouldn't be as cool. Anyway, just a thought.
Regarding the creating a text file and saving it as .mcl, I suppose that'd be easy enough, and you could use GetUniqueID() to name the file. Or... Instead of generating the file from scratch you could just copy an existing file(possibly the current world.) Although you'd have to change the address to 0.0.0.0, change the name maybe, and add a plugin to handle sending commands back to the original world, but you probably would be able to do that after you open it, couldn't you? As long as it doesn't try to connect automatically or something.
Question: If you use world.Open() to open a text file in like notepad, what object is returned? Is it like the edit control of the notepad or what?
Suggestion: Add an option to the script config window to load constants with the scripting file.
| Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #12 on Thu 31 May 2007 08:21 AM (UTC) |
Message
|
Quote:
If you use world.Open() to open a text file in like notepad, what object is returned? Is it like the edit control of the notepad or what?
See:
http://www.gammon.com.au/scripts/doc.php?function=Open
It is an "object" for the COM object of the Notepad, which isn't particularly useful as the internal notepad does not expose any functions to speak of. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
32,109 views.
Posting of new messages is disabled at present.
Refresh page
top