|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 12:09 am
Help converting part of a zMUD script with #CALL |
Code: |
#CALL @DB1.Open( "SELECT ObjId FROM Rooms WHERE Name='"@smobtof"'", @MDBConnStr2)
#MXP <send>runto @DB1("ObjId")</send> - %ansi( green, high)%zonename( %roomzone( @DB1("ObjId"))) %ansi( blue, hign)%roomname( @DB1("ObjId"))%ansi( grey) |
This piece of code displays this in zMUD:
runto 5696 - [AreaName] [RoomName]
correctly.
But in CMUD, I get:
runto <COMObject> -
The first line is in CMUD format now, because before some changing I got some error messages, now I don't. But the second line doesn't work apparently.
I'd appreciate if I could some help with this.
Thank you
D |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Aug 14, 2007 1:03 am |
I have run into a few problems myself using ADODB via COM calls. I just assumed that I was doing something wrong. I decided to table my efforts until the CMUD 2.0 since there would be so many improvements in it.
|
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 14, 2007 1:42 am |
The problem is that the argument to #MXP needs to be enclosed in {}. Otherwise it's not getting parsed properly. I'm not aware of any specific COM bugs in CMUD at the moment. And v2.0 doesn't do anything to change COM, so if there's an existing COM bug, it probably isn't fixed in 2.0.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Aug 14, 2007 2:11 am |
Ok. I'll look into my ADODB stuff and post more later. For me it was around the GetFields calls.
|
|
_________________ Asati di tempari! |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 7:36 am |
This piece of code
Code: |
#MXP {<send>runto @DB1("ObjId")</send> - %ansi( green, high)%zonename( %roomzone( @DB1("ObjId"))) %ansi( blue, hign)%roomname( @DB1("ObjId"))%ansi( grey)} |
now gives this instead.
runto @DB1("ObjId") - %ansi( green, high)%zonename( %roomzone( @DB1("ObjId"))) %ansi( blue, hign)%roomname( @DB1("ObjId"))%ansi( grey)
While
Code: |
#MXP {<send>runto @DB1("ObjId")</send>} - {%ansi( green, high)%zonename( %roomzone( @DB1("ObjId"))) %ansi( blue, hign)%roomname( @DB1("ObjId"))%ansi( grey)} |
gives a somewhat more proper output, being:
runto @DB1("ObjId") - [Current Area] [Current Room]
Where current means the room and area that I have set to being in atm ni the automapper. It is not what I want, but it is parsed at least.
If I have this piece of code on the other hand:
Code: |
#MXP runto {<send>@DB1("ObjId")</send> - %ansi( green, high)%zonename( %roomzone( @DB1("ObjId"))) %ansi( blue, hign)%roomname( @DB1("ObjId"))%ansi( grey)} |
I get the output
runto - [Current Area] [Current Room]
meaning it somehow doesn't send @DB1("ObjId") or something. That makes me wonder if this line is correctly converted, because it now doesn't give me error messages like it first did:
zMUD
Code: |
#CALL @DB1.Open( SELECT ObjId FROM Rooms WHERE Name=~'@smobtof~', @MDBConnStr2) |
CMUD
Code: |
#CALL @DB1.Open( "SELECT ObjId FROM Rooms WHERE Name='"@smobtof"'", @MDBConnStr2) |
What do you think?
D |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 10:29 am |
After some more research, I've found this:
zMUD
Code: |
#VAR DB1 %comcreate( "ADODB.Recordset") |
gives this value to the DB1 variable:
<OLE object: ADODB.Recordset>
while
CMUD
Code: |
#VAR DB1 %comcreate( "ADODB.Recordset") |
gives this content:
<COMObject>
I'm not sure, but shouldn't they be the same actually?
So I changed the value in DB1 to the same value as in zMUD, and then tried using this:
Code: |
#VAR DB1 %comactive( "ADODB.Recordset") |
to call it, but that seemed totally dead. And now I'm out of ideas on what to do. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 14, 2007 4:56 pm |
No, these are the same value. Since there is no way for zMUD or CMUD to display the actual value of a generic COM object, zMUD uses the output and CMUD uses the output.
On the #MXP command, there seems to be a bug in 1.34 that requires the first argument to be 1. So try:
#MXP 1 {other stuff here}
to get it to parse correctly.
On the COM stuff, try the full COM syntax instead of using the defaults. If @DB1 contains the Recordset, then the proper full syntax for getting a field value is:
@DB1.Fields("FieldName").Value
Try playing with this and the #SHOW command until you can display the value you want. Once you have it working with #SHOW, then try using #MXP. |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 5:28 pm |
First of all, this is a result from that test:
Code: |
#SHOW @DB1.Fields("ObjId").Value |
displays
5696
which is correct, while
Code: |
#MXP 1 {@DB1.Fields("ObjId").Value} |
displays
("ObjId"
which is not correct. |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 5:35 pm |
Ok, this is what I had to do in order to make if fully work... instead of doing all on one line, I had to change the calling to this:
Code: |
#VAR DB4 @DB1.Fields("ObjId").Value
#MXP runto <send>@DB4</send> - %ansi( green, high)%zonename( %roomzone( @DB4)) %ansi( blue, hign)%roomname( @DB4)%ansi( grey) |
then it all works the way it should. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 14, 2007 6:31 pm |
Ah Ha! I took a closer look at the #MXP command and found that it isn't parsing it's arguments properly at all! I think it was left over from when the < and > characters were special characters in zMUD. Anyway, this should be fixed in v2.0.
But I'm curious about the COM stuff. In your last script, if you do this:
Code: |
#VAR DB4 @DB1("ObjId") |
does that work too? |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Tue Aug 14, 2007 7:12 pm |
Tested now, and it didn't work.
Code: |
#VAR DB4 @DB1("ObjId")
#SHOW @DB4 |
only gives an empty line, and the previously posted code doesn't work with it either, so I guess it's broken.
D |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 14, 2007 10:12 pm |
Well, I got really curious about this, so I decided to look into it a bit more.
Turns out, there *is* a COM Problem in v1.34. It actually causes a stack corruption in some cases, and the COM variable gets overwritten. So depending upon the exact commands in your script, even the @DB1.Open call might not work. In other words, you'll see unpredictable results, which sounds like what you are getting.
In addition, there was a problem dealing with default fields. So doing @DB1("ObjId") would never work, but @DB1.Fields("ObjId") would sometimes work.
Both issues should be fixed in v2.0
It was actually good that you got me interested to look into this since it also turned out that the new threading system in 2.0 had completely messed up COM stuff. So I fixed that too :) |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Aug 14, 2007 10:29 pm |
Wow Zugg you super rock!!!
My biggest challenge for 2.0 will be figuring which way to take advantage of all the bells and whistles and shiny new fixes and which one I want to use first. |
|
_________________ Asati di tempari! |
|
|
|
|
|