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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sun Jan 18, 2009 6:56 am   

zScript Object properties questions
 
I am trying to figure out how to use a couple of the common properties for zScript objects. The first one is the isvalid property. I made a simple test alias as follows:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="test" copy="yes">
    <value>obj = zs.getclass("COURSES")
print(obj.isvalid)</value>
  </alias>
</cmud>

This always prints false regardless of whether the class name I specify exists or not. What am I doing wrong here?

The other two I am having problems with are the beginupdate() and endupdate() functions listed under the common properties. Basically I have a menu button that points to a submenu class folder. The items in the submenu class folder can change and the button doesn't automatically update when they do. I thought I would use the beginupdate() and endupdate() since it sounded like that was what they were meant for, so I tried the following:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="test" copy="yes">
    <value>button = zs.getbutton("Coordinates")
button.beginupdate()</value>
  </alias>
</cmud>

When I try to execute this alias, I always get a popup Parse Error dialog that says 'Property beginupdate does not exist'. How are you supposed to execute these functions?

Thanks!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Jan 19, 2009 9:00 am   
 
In terms of the invalid property you may have come across a bug, or at least an error in the documentation. I think it's the former because in my case the print method always printed true.

However if you print the just the object itself it will say it's invalid with an invalid class. Also the other properties such as index, and name will be nil. Also bear in mind I believe the isvalid property was designed specifically with window objects in mind ( although that doesn't mean that this isn't a bug).

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="test" copy="yes">
    <value>obj = zs.getclass("COURSES")
print(obj)</value>
  </alias>
</cmud>


As for the beginupdate / endupdate methods I think you misunderstand their purpose. They are not for the updating of the screen, but rather to tell CMUD that you are modifying that object and that CMUD should not try to access (not 100% on this) or store the value until the endupdate method is called. This is to help maintain data integrity and avoid dirty read/writes.
_________________
Asati di tempari!
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Mon Jan 19, 2009 1:32 pm   
 
Thanks, Tech.

I saw that printing the object correctly showed the state but that didn't help in determining through code whether it was a valid object or not. I redesigned what I was trying to do so I don't need that method anymore anyway though.

I found this thread by Zugg that had some information related to #BEGINUPDATE and #ENDUPDATE and it looks like they eventually got removed. I thought that since these were zs object properties that they may have been there for a different reason, but maybe they got removed as well and should no longer be documented there?

Also, I'm not sure if it is a bug or not, but my menu button that points to a menu class folder will not update the items displayed in the list when you click the button automatically as the items in the associated menu class folder change. I got around this by disabling the button before my scripts change the items in the menu class folder and then re-enabling it after
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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