Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Global Defaults, Logging (and XML format)

Global Defaults, Logging (and XML format)

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3  4 

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #45 on Fri 24 May 2002 10:19 PM (UTC)
Message
Quote:

I assume that an "object", is essentially a collection of data. I.E: It is not the functions/subroutines that process the data, but the data itself.

I assume that MUSHclient has a series of functions/subroutines to process "object" data.

I assume that any particular function/subroutine is not replicated for each "WorldObject".


Ah, I see where the confusion is coming from. ;)

MUSHclient is written in C++, which encapsulates both the data and the functions into a single thing, called an object. Although the actual executable code is not duplicated, as you surmised, it is, in effect, attached to a particular world. Here is a simplified portion of the MUSHclient world object ...


class CMUSHclientDoc : public CDocument
{

// Attributes
public:
  CChatSocket* m_pSocket;  // TCP/IP connection

// stuff saved to disk

  CString m_server;   // IP address
  CString m_mush_name;  // world name
  CString m_name;  // player name
  CString m_password;  // password

  // normal (ANSI) colours
  COLORREF m_normalcolour [8];
  COLORREF m_boldcolour [8];

  // custom (user-defined) colours for triggers etc.
  COLORREF m_customtext [MAX_CUSTOM];
  COLORREF m_customback [MAX_CUSTOM];

// list of output buffer lines

  CLineList m_LineList;  // linked list of output lines

  __int64 m_nBytesIn;   // bytes received
  __int64 m_nBytesOut;  // bytes sent

// Operations
public:
  BOOL ConnectSocket(void);  // connect to world
  void ProcessPendingRead();  // process new stuff
  void SendMsg(CString strText,  const bool bEchoIt,
       const bool bQueueIt = false);  // send text
  void ReceiveMsg();   // have received a line
  void DisplayMsg(LPCTSTR lpszText, int size, const int flags);  // add to output window
  void ShowStatusLine (const bool bNow = false); // update the status line

// exposed script routines ...

  afx_msg void Note(LPCTSTR Message);
  afx_msg long Send(LPCTSTR Message);
  afx_msg long Connect();
  afx_msg long Disconnect();
  afx_msg long DeleteAlias(LPCTSTR AliasName);
  afx_msg long EnableAlias(LPCTSTR AliasName, BOOL Enabled);

  };


So, say we have a world object, called "WorldObject", instead of your suggestion, to use it:


LookForMatchingTrigger (Linetoprocess, WorldObject);


We actually do:


WorldObject->LookForMatchingTrigger (Linetoprocess);


I suppose it is a minor point in a way, but the point is that the data is really "part of" the COM object (the COM object being the world object), so that the thing you call "world" in a script really points to not only the routines that you use (such as Note) but the data as well.

For a simple example of how those script routines are written, look at this:


long CMUSHclientDoc::GetReceivedBytes() 
{
  return m_nBytesIn;
}


This implements the World.GetReceivedBytes script routine. Notice there is no reference to where the data is coming from (no reference to a world object)? This is because it is implied, the function knows that it is currently referring to the current world object, whichever one that happens to be at the time.

Thus it is not particularly easy to break apart the world data from the world functions.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #46 on Fri 24 May 2002 10:22 PM (UTC)
Message
Quote:

On world initialization, you would:

Load Default Colour file
Load Default Alias file
Load Default Trigger file
Load Default Timer file
Load Default Preferences file

Load World File.

Override any Defaults if World File has "colliding" values. This is the "CORE" machine.


Actually this is how I envisage it working, except that we will do away with the so-called default files, and replace them with includes. After all, a default file is really preloaded data.

What you describe here is really the core machine I was talking about that the GetLoadedValue script would retrieve.

However I am now planning to implement a subset of the world for the plugins, a subset being the amount reasonably needed to execute a script (eg. its own language) but not things that you can't really have more than one of (eg. default background colour).

So we are perhaps more in agreement than you think. ;)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #47 on Sat 25 May 2002 02:10 AM (UTC)

Amended on Sat 25 May 2002 02:32 AM (UTC) by Magnum

Message
Nick, thank you for taking the time to teach me about this subject. I've put off learning C++ for a long time, because I've always found it's syntax very unfriendly. (It's lack of the kind of natural language syntax like many other languages, I mean).

I dropped programming 15 years ago just as I was starting to learn about "object" implementation under Turbo Pascal. (And I've just picked up programming now, with the use of MUSHclient).

Continued in new thread:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1299&page=999999

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
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.


126,038 views.

This is page 4, subject is 4 pages long:  [Previous page]  1  2  3  4 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.