Using COM to pull map data from CMUD.

Posted by Falgor on Thu 08 Oct 2015 10:35 PM — 10 posts, 36,562 views.

#0
Hi,

MUSHclient was my first client, the only reason I left it was because of zmUDs/CMUDs map, I want to test out pulling map data from CMUD's map to use in MUSH.

I'm trying to get my head around Lua Com Objects, I know both MUSH and CMUD support com.

How would I go about communicating from MUSH to CMUD? I can work on the rest from there.

Where do I put the lua script? I've tried messing around with holding it in an alias, but to no avial so far.

Thanks in advance.
Australia Forum Administrator #1
See: http://www.gammon.com.au/forum/?id=6022

Also: http://www.gammon.com.au/forum/?id=12628
#2
I can communicate from MUSH to CMUD okay, but I can't find any of the documentation for MUSHclients com functions. I basically want to be able to send a string from CMUD to MUSHclient.

I've tried:

require "luacom"

cmud = luacom.CreateObject("MUSHclient.Application")

But I'm failing at even that first hurdle!
Australia Forum Administrator #3
You are not intended to create an instance of MUSHclient from within it. The link I have shows creating instances of other objects. Can you find how CMud stores the map? Or export it somehow? That might be easier.

And it also might be quicker just to re-map with the MUSHclient mapper.
#4
I did try with the MUSHclient mapper (I play T2T, which your post is based on). But there are so many weird room exits and structures that I think it'll be a pretty impossible task.
#5
This is what I'm trying to do, order CMUD to work out directions from A to B, which saves that data in a variable. Then grab the data from that variable for use in MUSH, once I can do this the rest is a easy peasy.

require("luacom")
require("luacom5")

cmud = luacom.CreateObject("cMUD.Application")
cmud.CurrentSession:ProcessCommand("getdirections")
var = cmud.CurrentSession:GetVar("test")

print(var)


What is currently happening when I print is I just get:

table: 046C0178
table: 046C0420
table: 046C06C8
table: 046C0970
table: 046C10A0
table: 046C0FB0
table: 046C1618
table: 046C18C0


Table is random each time.
Australia Forum Administrator #6
Looks like you might be close. Try printing that table:


require "tprint"

tprint (var)
#7
Same again, just a different format for randomness :)

I'm trying to get your mapper up and running again. I've tweaked the roomdesc/exits wildcards and have them triggering fine and grabbing the right data on a normal trigger, when I add it all into the mapper.xml it isn't working though.
#8
The brief mode on T2T is a lot simpler for movement:

The Adornas Road(e, n, w and s)
 Merchant is riding a brown horse
 A brown horse
HP:140 EP:140 >


So I've tweaked the trigger too:


<triggers>
  <trigger
   enabled="y"
   match="^(?P<roomdesc>.*)\((?P<exits>.*)\)$"
   multi_line="n"
   regexp="y"
   script="process_room_description"
   sequence="100"
  >
    </trigger>
</triggers>


The match as a normal trigger works fine (I've sent the wildcards to output to test what it captures). But not working when I modified the plugin, I guess the later stages aren't ready to receive wildcards in that format.
Australia Forum Administrator #9
I'm not sure what you mean by that.