Register forum user name Search FAQ

Gammon Forum

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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Does MUSHclient use DDE?

Does MUSHclient use DDE?

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


Pages: 1  2 

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #15 on Fri 13 Jun 2003 03:49 PM (UTC)
Message
Seems like you can use the .tlb in a script afterall. I am talking about 'script components' here (.wsc file) not regular scripts. I initially tried to <reference> the .tlb by registering it with Windows, but although the reference was excepted when I installed the component, it refused to link during runtime. But when I saw 'Mushclient.World' at the bottom of the last VB window you posted, I suddenly had an idea... I tried it another way - I added a TypeLib parameter to the Mushclient.World key in the registry and hooked it to the .tlb's key I created earlier, then I used the <object> tag to add Mushclient.World to the component in hopes that Windows will recognize the reference to the .tlb in the registry. Which it finally did and I actually got to communicate with Mushclient from a script component instantiated from a completely different process than the one Mushclient's script runs in. Hooray! The only problem now is that when I try to do world.anything in the script component, Mushclient attempts to create a new world. I am hoping to find a way around that also though, will see what can be done.

Here's what I actually did:

1. Mushclient script .Run's a standalone script (.wsf)
2. .wsf creates an instance of a .wsc component
3. .wsc component uses callbacks to talk to Mushclient (to grab the timer's parameters and send a command to it when the timer fires).

The reason for using a separate script is to gain access to the Wscript object and avoid hanging Mushclient when I use Wscript.Sleep.
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #16 on Fri 13 Jun 2003 06:16 PM (UTC)
Message
Most likely reason for your problem is that your scripting object has no clue what 'world' it is trying to talk to. The '(theworld AS WORLD)' in Nick's example is a handle. Like the handles created for a window, such a handle will have a number in it that uniquely identifies the world in Mushclient. However since this number depends on any number of factors, including the order in which worlds where opened, etc. you can't hard code it into a program. This means that you need to do something like:

1. Create a wsf instance and pass it the 'world' handle.
2. Have the wsf create an instance of the .wsc.
3. Pass the world handle again to the new object so it knows what world it needs to talk to.

Looks like you hae either missed the last one or are doing it wrong and Mushclient is 'fixing' the problem by spawning a brand new world each time you execute a command. However, unless you specific gave it a value, the handle you are passing is likely EMPTY and I doubt Mushclient is setting it for you.

One 'possible' fix, assuming I am right, would be to do:

dim whandle as WORLD
whandle = whandle.getworld

however, this would only work for 'new' worlds, not existing ones. Actually I am not sure it would work at all, so... lol But I am sure that your .wsc has no clue 'which' world it is supposed to talk to and that is causing the problem.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #17 on Fri 13 Jun 2003 09:07 PM (UTC)
Message
I think this was mentioned a while back.

If you try to CreateObject ("mushclient.world") or something similar, then MUSHclient tries to create a new world (as asked). The safer thing, which it sounds like you are doing is to get MUSHclient to create your script object, not your script object to create MUSHclient.

- 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.


69,367 views.

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

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

Go to topic:           Search the forum


[Go to top] top

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