Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Sun Mar 30, 2003 9:56 am   

Drastic COM Failures?
 
Alright, I am trying to set up a status bar in a child window that uses a variable from a parent window. (I don't want to write script in the parent window to send the variable to the child window.)

I can't use the simple @Windowname.Varname syntax because my main window has a blank name. If I set the session name in the char database, it doesn't name the window. If I use the #name command, save the settings, close zmud, and reopen it, the window is again unnamed.

So I started trying COM. %zmud.GetSessionNum(0).GetVar(Varname, Classname).Value seems like it should work, but it doesn't. If I #variable something to %zmud.GetSessionNum(0), and then do @whatever.GetVar(Varname, Classname).Value, it works. But %zmud.GetSessionNum(0).Hostname works. Why does zMUD allow chaining of properties but not of functions?

Another thing is, if I make that variable linking to the session, and then use the .Value thing in my status bar, it works, but it does not update when the variable changes. I have to go into the settings editor, into the status bar, hit a key and hit backspace (so it thinks it's modified) and then hit Save, for it to update. It updates fine. Why doesn't zMUD process COM updates when variables change like it processes other updates?

And then, when I close zMUD, that link to the session is dead anyway. Is there any way I can store a virtual reference to it? Putting the text in a variable and %expanding it?

Maybe I can nest %comget like I can't nest using . chaining? Will this update when I change the variable? Will it work at all?
Reply with quote
Wrudyn
Novice


Joined: 24 Mar 2003
Posts: 44
Location: USA

PostPosted: Sun Mar 30, 2003 10:40 am   
 
As reported in the beta forum, I've had trouble accessing the COM variables, such as %zmud and %session. I can only get the get properties to work, and neither the set/put properties or function calls work, meaning you can do things like retreive the window names, but cannot change anything or call functions. The workaround I just found is to create the COM objects manually and not to rely on the predefined %zmud and %session.

#VAR Zmud %comcreate("Zmud.Application")

Will make the variable @Zmud do what you are trying to do.
Reply with quote
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Sun Mar 30, 2003 11:30 am   
 
Well, I did notice that I couldn't do this.

#variable %session.Hostname {Yahoo.com}

But this works.

%comset(%session, Hostname, "Yahoo.com")

That's why I asked about %comget. It seemed to me that it was not a bug with COM, but a bug with the dot-syntax. The issue of it not updating on variable change is a separate issue, and not really a bug, but I expect just an oversight.
Reply with quote
Wrudyn
Novice


Joined: 24 Mar 2003
Posts: 44
Location: USA

PostPosted: Sun Mar 30, 2003 11:59 am   
 
That doesn't change hostname because it isn't evaluated unless it's preceeded with #CALL.

#VAR Zmud %comcreate("Zmud.Application")
#CALL %comset(@Zmud.CurrentSession, WindowName, "new window name")

This does work
Reply with quote
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Sun Mar 30, 2003 12:05 pm   
 
Uh, I tested it, and it works. I opened up my normal character for my mud, used #connect, and it went to my mud. I disconnected, then did this from the command line.

%comset(%session, Hostname, Yahoo.com)
%comset(%session, Port, 80)
#connect

It worked perfectly. Whatever you're doing is different...
Reply with quote
Wrudyn
Novice


Joined: 24 Mar 2003
Posts: 44
Location: USA

PostPosted: Sun Mar 30, 2003 12:45 pm   
 
Odd, that. Copy/Pasted it straight into the command line. In my experience, functions aren't evaluated unless preceeded with a command, at least in the command line. Things like %dice(5d2) are sent straight to the mud without change, while #ECHO %dice(5d2) echos a random number to the screen.
Reply with quote
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Sun Mar 30, 2003 12:56 pm   
 
It makes sense, though. I do it all the time, like when I want to move a random direction. I collect the exits to CurrExits, then issue %item(@CurrExits, %random(1, %numitems(@CurrExits)) to the mud as a movement command. Maybe it's a new feature or something.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Mar 30, 2003 3:31 pm   
 
Yes, you can't call a COM function on the results of another COM function. I don't know why, it's just the way it is. Creating an intermediate variable is the correct solution, like you mentioned.

The variable doesn't update because it doesn't know that what the COM function returns has been updated. The COM function is called when initially getting the variable's value, it is not called again every once in a while to see if it has changed. A crude workaround for this is to create an alarm that fires every once in a while (every second for exampl) and updates the variable.

However, I think you should first look a bit more into why the session name doesn't change and see if you can change it. You could try opening the chardb.mdb file and changing the Session ID for you character in there directly and see if that works.

Kjata
Reply with quote
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Mon Mar 31, 2003 2:10 am   
 
Oh, by the way...do I need to install Access or something to edit the database file?

Update: Aha!@# It's the layout file. When I made my layout file, the name of the window was blank, so the layout file stored it as blank. I disabled my layout, opened it up, used #name, saved the settings, did a Close All, opened it up again, and it saved it that time. Closed it again, reenabled the layout, opened it up again, and voila, it's blank again. So it's a simple bug, and the fix is to just not store the window names in the layout file, or to save them before loading the layout and restore them after it's been loaded, or ignore them when the layout is loaded.

Update #2: Confirmed. I used #name, saved the layout, closed it, opened it, and it saved the window name. Now the only thing is this *infuriating* layout bug. I looked in the beta forum and Zugg says it's not going to be fixed, so...blah. But at least we know why, now, so maybe it could be put in a FAQ or something.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Mar 31, 2003 1:23 pm   
 
He said it wasn't going to be fixed? Where? The only thing I remember about layouts recenlty in the Beta Forum is the one for the layout of the Settings Editor. He said that there still isn't any way to reproduce the error consistently, so he still doesn't know what causes it.

Kjata
Reply with quote
virtuous
Wanderer


Joined: 08 Jan 2003
Posts: 60

PostPosted: Mon Mar 31, 2003 7:58 pm   
 
Yes, I'm sorry, I think I was hallucinating. I was mistakenly thinking of the Settings Editor bug and confusing it with this. That'll teach me to read better before I paraphrase.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net