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
➜ General
➜ using world windows instead of notepad windows
using world windows instead of notepad windows
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Guest1
USA (256 posts) |
Date
| Fri 16 Mar 2007 05:53 AM (UTC) |
Message
| Having another look at replacing my notepad windows with world windows so I can use multi colors.. I've looked through a couple of other threads, but I have a couple of questions if someone can help please..
At present (using VB) I can open a new notepad window and resize it with the following (which I do automatically on connection to the world):
sub open_npwindow
world.SendToNotepad "npwindowname", "blah blah text"
MoveNotepadWindow "npwindowname", 700, 0, 300, 300
end sub
and close them when I log off (I don't want to save a copy) with:
sub close_npwindow
world.CloseNotepad "npwindowname", 0
end sub
and obviously use other functions like
world.ReplaceNotepad "npwindowname", "blah text text"
to refresh the contents (or use world.AppendToNotepad etc)
What I can't quite figure is what syntax to use to replace the notepad windows with world windows, how to send notes from my active playing world window to those other world windows.. and how to get them to open as new world windows in the first place that connect to 0.0.0.0 (which apparently means they wont try to connect and send commands) ..I have no desire to save those notepad-world files each time I log off, unless it's absolutely necessary..
Is it much the same thing, for example, to open, use:
sub open_otherworldwindow
world.SendToWorld "otherworldname", "blah blah text"
MoveWorldWindow "otherworldname", 700, 0, 300, 300
end sub
but if so, how to set it to connect to 0.0.0.0 etc.. or do I have to have these 'other' world files already set up in my world files folder?
And how about sending text to those world windows? Because for what I'm doing, I'll be effectively refreshing the text in there (which consists of a number of variables etc), so I think I have to use world.DeleteOutput first, and then world.SendToWorld for the replacement text.. but again, is the syntax just a matter of adding the otherworld name into that string? eg:
sub refresh_otherworldname
world.DeleteOutput "otherworldname"
world.SendToWorld "otherworldname", "blah blah text"
end sub
or maybe the 'world.SendToWorld' should be 'world.note'..?
And will the focus still stay on my active (playing) world window, or is it going to switch over to the other notepad-world, which would be beyond annoying.
One more thing.. how to set the commandline height to zero on those world windows too..
Appreciate your help VERY much. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 16 Mar 2007 06:41 AM (UTC) Amended on Fri 16 Mar 2007 06:42 AM (UTC) by Nick Gammon
|
Message
| To open the world window, you would need to open it like a normal world. One approach would be to make it appear in the list of worlds to open. Another would be to script it, see:
http://www.gammon.com.au/scripts/doc.php?function=Open
The world file you open would need to have its IP address set to 0.0.0.0 in its configuration, so it doesn't try to connect.
Then you need to get the world object for the newly opened world. See this:
http://www.gammon.com.au/scripts/doc.php?function=GetWorldById
Given the world object, you can then send things to the world, or move the window, see this:
http://www.gammon.com.au/scripts/doc.php?function=MoveWorldWindow
Say you made a dummy world file, and found its ID (this is inside the world file itself) to be "2669794753d27b0dd5a6d0ef", then you could do this:
set otherworld = GetWorldById ("2669794753d27b0dd5a6d0ef")
otherworld.MoveWorldWindow 1, 1, 640, 480
Then to write to it:
otherworld.DeleteOutput
otherworld.Note "blah blah"
If you want multiple world windows, you would need a world file for each one, but you could quickly clone them, providing you make sure you change the ID of each one to something unique.
An example minimal world file would be:
<muclient>
<world
defaults = "y"
id="49d3588b63bc283633a7d781"
name="notepad1"
site="0.0.0.0"
output_font_name="Franklin Gothic Book"
>
</world>
</muclient>
Just make sure you make a unique ID for each world (see Edit Menu -> Generate Unique ID).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #2 on Fri 16 Mar 2007 07:03 AM (UTC) |
Message
| Thanks for your prompt reply Nick. Just realized I'm still using v3.78, which explains why I couldn't get rid of the input box either. I'll upgrade and have a play around, cheers for the clarification. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #3 on Fri 16 Mar 2007 08:55 AM (UTC) Amended on Fri 16 Mar 2007 09:24 AM (UTC) by Guest1
|
Message
| Ok I've upgraded and had a play and can get the new world open and resized by using the same trigger I did before to open the notepad windows, in this case the trigger just sends to script the following when fired:
dim otherworld
set otherworld = world.open ("AAA.mcl")
otherworld.MoveWorldWindow 710, 1, 300, 500
otherworld.Note "hello"
That's all very nice, but it makes that new notepad-world the active world, which I don't want. Is there some additional line I can add to that to change the focus back to the original world?
Once it's open, no worries, I just send from my playing world
dim otherworld
set otherworld = GetWorldById ("reallylongworldIDnumberhere")
otherworld.DeleteOutput
otherworld.ColourNote "red","", "blah blah"
and the focus still stays on my main world.
So really the only thing is getting focus back on my main world after opening the other notepad world..
Also, will that worldID always be the same, unless I generate a new one for that world from the edit menu?
Thanks again :)
: :: ::: edit ::: :: :
Nevermind - the answer was right in front of me.. add one more world.open to the end of the first script and it changes the focus back:
dim otherworld
set otherworld = world.open ("AAA.mcl")
otherworld.MoveWorldWindow 710, 1, 300, 500
otherworld.Note "hello"
world.open ("originalworldfilename.mcl")
easy :)
As long as that worldID is static, it's all good! Please let me know if it isn't static.
cheers! | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #4 on Fri 16 Mar 2007 09:23 AM (UTC) |
Message
| ..oh, there is one more thing.. is there any script command that can CLOSE a world window from another world? similar to the
world.CloseNotepad "npwindowname", 0
? | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #5 on Fri 16 Mar 2007 09:46 AM (UTC) |
Message
| Nevermind.. got that figured too:
dim otherworld
set otherworld = world.open ("nameofotherworldfile.mcl")
otherworld.DoCommand "Close"
hopefully this will help someone along the line.
I've been looking at the http://www.gammon.com.au/scripts/function.php page instead of the inbuilt MC help which has more info. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #6 on Fri 16 Mar 2007 02:22 PM (UTC) Amended on Fri 16 Mar 2007 02:25 PM (UTC) by Guest1
|
Message
| Strange problem.. this morning when I try using the scripts to open up the notepad-world, MC can't seem to decide what the relative root path is..
All the .mcl files are all in the same C:\ProgramFiles\MUSHclient\worlds directory. Last night they at first opened fine using
world.open ("nameofotherworldfile.mcl")
but then later after restarting I had to change it to
world.open ("worlds/nameofotherworldfile.mcl")
or it couldn't locate the world files.
This morning when I run the script, it tries to locate the world files in a totally different directory,
C:\ProgramFiles\MUSHclient\play
which is a directory where I keep notes on all my chars etc, and, as it happens, a shortcut to open MUSHclient itself. The problem is that the script can't seem to make a firm decision as to what the root directory is... I have no idea how to fix this one.. I guess using notepad there is no issue as the script generates the notepad windows as opposed to opening existing notepad window files? Any suggestions?
The only way to get it to work now is if I first use file>open to open the worlds, then close them again, then the script works using
world.open ("nameofotherworldfile.mcl")
but that defeats the purpose of having the script in the first place.. and since I'm eventually intending to open 4 different notepad-world windows, I'm trying to have it scripted.
Using v3.85. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #7 on Fri 16 Mar 2007 04:21 PM (UTC) |
Message
| bah.. crashing repeatedly.. I'll just stick to notepads and hope one day we'll be able to use multicolors on them. :( | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #8 on Sat 17 Mar 2007 01:15 AM (UTC) |
Message
| For the root path issues, you might want to put in the full path name for the file. Also make sure that the site is 0.0.0.0 to prevent weird issues with trying to connect to a world multiple times. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #9 on Sat 17 Mar 2007 04:52 AM (UTC) |
Message
| Yeah I tried that (full path) but it kept making up its own path and putting in front of the path I had in the script, if that makes sense, and the big issue is that it wasn't always the same from session to session. Quite bizarre. And yeah I used the 0.0.0.0, there was no connect attempts fortunately. Once I had the other world windows open they seemed to be operate fine, it's the path to those world files changing that is the problem. Weirdness. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #10 on Sat 17 Mar 2007 06:32 AM (UTC) |
Message
|
Quote:
So really the only thing is getting focus back on my main world after opening the other notepad world..
See:
http://www.gammon.com.au/scripts/doc.php?function=Activate
As for the path issue, the open without a path will open whatever the current working directory is. Simply browsing for something in the file browser can change that. I suggest using one of the GetInfo functions to find the correct directory, for example GetInfo (67).
As for the crash, you need to be careful when using world objects (which are COM objects) that they remain valid, or a crash wouldn't surprise me. Perhaps, re-getting the world object, and confirming it is valid, each time, would help.
Quote:
Also, will that worldID always be the same, unless I generate a new one for that world from the edit menu?
The same as what? The "id" line in the world file defines that world's ID, that won't change. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #11 on Sat 17 Mar 2007 06:44 AM (UTC) |
Message
| Thanks, that GetInfo should do the trick.
and yeah, I meant do the individual world IDs remain the same for each world, which they do. | 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.
28,075 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top