Gammon Forum
Entire forum
MUSHclient
VBscript
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
| Deqitosv
USA (26 posts) bio
|
Date
| Sat 28 Jul 2001 08:50 PM (UTC) Amended on Tue 31 Jul 2001 10:02 PM (UTC) by Deqitosv
|
Message
| Out of curiousity, are there any DDE controls in MushClient, or is there another way to make it interact with other programs (self-written or DDE based) That I'm unaware of? Thanks!
|
Deqitosv
MushClient Plugins for LegendMUD:
http://www.itgotdeleted.com/ (currently offline)
Experiments in Film:
http://www.cookiejarfilms.com/
15, a Parody of 24:
http://www.pkill.org
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #1 on Sun 29 Jul 2001 02:43 AM (UTC) |
Message
| MUSHclient exposes an extensive list of interfaces via the COM method, which are documented at:
MUSHclient functions
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Deqitosv
USA (26 posts) bio
|
Date
| Reply #2 on Sun 29 Jul 2001 06:53 PM (UTC) |
Message
| Now I just gotta figure out how to use this to my advantage in a VB-based external program. *lost and clueless* Thanks though! |
Deqitosv
MushClient Plugins for LegendMUD:
http://www.itgotdeleted.com/ (currently offline)
Experiments in Film:
http://www.cookiejarfilms.com/
15, a Parody of 24:
http://www.pkill.org
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #3 on Sun 29 Jul 2001 11:45 PM (UTC) |
Message
| If you initially call your program from MUSHclient, it can pass an "object reference" to your program. That program can then use that to do things to MUSHclient.
After a considerable amount of mucking about I got something like that to work. :)
Here is what I did:
- Start Visual Basic
- Create a new ActiveX EXE project
- Under Properties change the class "(Name)" field from "Class1" to "MC_class"
- Under Properties change the project "(Name)" field from "Project1" to "MC_callback"
- Go to the Project menu and click on References
- When the References window opens click on the Browse button and navigate to the "MUSHclient.tlb" file that came as part of the MUSHclient download, then click Open.
- Confirm that "MUSHclient" appears in the list of "Available References" and is ticked.
- Open the Object Browser (F2) or use the View Menu -> Object Browser, and change the top combo-box to "MUSHclient". You will see "World" appear in the list of classes down the bottom of that window. Double-click on World and you will see all the supported world functions (eg. AddAlias, AddTimer and so on). Close the browser.
- In the code window for the project type in a test subroutine:
Sub TestNote(theworld As World)
theworld.Note "This is a test"
End Sub
- Go to the File menu and click on Save Project. Accept the suggested file names (MC_callback.vbp and MC_class.cls).
- Go to the File menu and click on "Make MC_callback.exe".
The above steps have created a ActiveX file that can be called from MUSHclient.
Testing the ActiveX project
- Start MUSHclient and open a world
- Make sure scripting is active - VBscript language
- Type:
/dim testobject
/set testobject = createobject ("mc_callback.mc_class")
/testobject.TestNote (world)
/set testobject = nothing
- You should see "this is a test" echo on the output window. What the lines above are doing is:
- Making a variable "testobject"
- Assigning to it a reference to the new class "mc_callback.mc_class" from your Visual Basic application
- Calling the "TestNote" subroutine in that class. We pass to it the reference to our current world. The "TestNote" subroutine uses that reference to call "world.note"
- By setting the testobject to "nothing" we release the reference to that world
This is just an example program. However once you have it working you can expand it somewhat. For instance, you could store the "world" reference in a global variable and use it later on for other subroutine calls without having to pass it down every time.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Deqitosv
USA (26 posts) bio
|
Date
| Reply #4 on Tue 31 Jul 2001 01:30 AM (UTC) |
Message
| Alright, that worked quite well and has me well on the way with what I'm doing. However I've come accross another stumbling block which confounds me. If I, in my external form called fromt he ActiveX control, click a button, I want this to interact with the world (send text, do a world.note, create/delete triggers, etc). I just can't seem to do this. Any ideas? (HAving data sent from triggers and variablse TO the form works great though, and I'm happy for that!) |
Deqitosv
MushClient Plugins for LegendMUD:
http://www.itgotdeleted.com/ (currently offline)
Experiments in Film:
http://www.cookiejarfilms.com/
15, a Parody of 24:
http://www.pkill.org
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #5 on Tue 31 Jul 2001 04:52 AM (UTC) |
Message
| Once you have the "world" variable stored somewhere (eg. in a global variable) then you should be able to do things like:
theworld.send "say hi there"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Deqitosv
USA (26 posts) bio
|
Date
| Reply #6 on Tue 31 Jul 2001 10:04 PM (UTC) |
Message
| As I'm only a 'hobby' programmer (much less than yourself). I unfortunately haven't a clue what I'm doing at this point and have no idea how to create or store within a global Variable (not that I'm asking you to teach me, I rather like you working on the client itself heh.) Thanks for all the help so far though! |
Deqitosv
MushClient Plugins for LegendMUD:
http://www.itgotdeleted.com/ (currently offline)
Experiments in Film:
http://www.cookiejarfilms.com/
15, a Parody of 24:
http://www.pkill.org
| top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #7 on Tue 31 Jul 2001 11:35 PM (UTC) Amended on Tue 31 Jul 2001 11:36 PM (UTC) by Nick Gammon
|
Message
| Just to help you get your VB-based program going, here is an example of what I am talking about.
In the code window (in VB) replace my earlier example with the following. You will note that I am saving the "world" variable into a "public" variable, that will persist between calls. then you can do (in MUSHclient):
/testobject.Anothertest
This will say "Hi there" to the previously-saved world.
New lines are in bold.
Public savedworld As World
Sub TestNote(theworld As World)
theworld.Note "This is a test"
Set savedworld = theworld ' save variable
End Sub
Sub AnotherTest()
If Not savedworld Is Nothing And Not IsEmpty(savedworld) Then
savedworld.Send "say Hi there!"
End If
End Sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Ishnaf
Australia (17 posts) bio
|
Date
| Reply #8 on Thu 18 Jul 2002 02:16 PM (UTC) |
Message
| Ok, i have a little silly question :)
Lets say i make a program in Vbasic, and want to communicate with mushclient.
DO i have to communicate with an "active x exe" prementioned, then into MUSH, or can I Integrate these together? If it's possible could you please post some snippets of code just showing the jist of it :)
Thankye everyone |
egads! | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #9 on Thu 18 Jul 2002 10:37 PM (UTC) |
Message
| I'm not totally sure I understand this question. An "ActiveX exe" is a program, so it is not a question of making one or the other. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Ishnaf
Australia (17 posts) bio
|
Date
| Reply #10 on Fri 19 Jul 2002 01:24 PM (UTC) Amended on Fri 19 Jul 2002 01:30 PM (UTC) by Ishnaf
|
Message
| Basically, i was having trouble putting the class file into a standard exe (it kept turning private or something), so i was wondering how to get a VB form to interact with the COM interface and then send to mushclient... Hope that helps :) |
egads! | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #11 on Fri 19 Jul 2002 11:11 PM (UTC) |
Message
| A bit depends on where you want the "conversation" to begin. Do you want MUSHclient to get the external app to do something, or the external app to get MUSHclient do to something?
Can you give a brief example? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Ishnaf
Australia (17 posts) bio
|
Date
| Reply #12 on Fri 26 Jul 2002 02:45 PM (UTC) |
Message
| ok, if you could just show how i can make a button to send "test" to mushclient as a world.note on the button click, I should be able to work it all out from there.... |
egads! | top |
|
Posted by
| Ked
Russia (524 posts) bio
|
Date
| Reply #13 on Thu 12 Jun 2003 02:03 PM (UTC) |
Message
| I know that this thread is kind of old, but...
In Nick's post:
/dim testobject
/set testobject = createobject ("mc_callback.mc_class")
/testobject.TestNote (world)
/set testobject = nothing
What exactly is passed on to mc_callback as 'world'? Is it possible to hardcode that value in the VB project without having to originate it in Mushclient? I am trying to make a millisecond timer which involves using a script component (.wsc file) but I can't seem to work out how to use callbacks in mushclient.tlb. I actually haven't managed to even reference the .tlb in the script component yet, but I am hoping to do that sooner or later, though it appears that registering that .tlb is somewhat problematic - unless the main problem is myself :) | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #14 on Thu 12 Jun 2003 09:15 PM (UTC) |
Message
| The "world" reference is the actual address of the relevant MUSHclient world in memory. Since COM is an Object management system (hence the O) it deals in object (executable code). You can't "remember" it, the address will be different every time.
As for the .tlb file, I doubt you can use it in a script, it is for if you are writing a program in full Visual Basic. In that case it isn't necessary, just helpful. Here is an example. If you start up VB and open a new project, and then go to the Project menu > References, you can click the Browse button, and use that to add the mushclient.tlb file. After you do that you should see something like this:
Once you have done that then you can use the object browser in your project, and it will show you the names of all the MUSHclient script functions, and also hopefully auto-complete the names and arguments if you happen to use a MUSHclient world in your program ...
|
- 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.
44,836 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.